#line 1 "MAIN.C" #line 1 "C:\C166\INC\REG167.H" sfr ADCIC = 0xFF98; sfr ADCON = 0xFFA0; sfr ADDAT = 0xFEA0; sfr ADEIC = 0xFF9A; sfr ADDAT2 = 0xF0A0; sbit ADST = ADCON^7; sbit ADBSY = ADCON^8; sbit ADWR = ADCON^9; sbit ADCIN = ADCON^10; sbit ADCRQ = ADCON^11; sbit ADCIE = ADCIC^6; sbit ADCIR = ADCIC^7; sbit ADEIE = ADEIC^6; sbit ADEIR = ADEIC^7; sfr CC0 = 0xFE80; sfr CC0IC = 0xFF78; sfr CC1 = 0xFE82; sfr CC1IC = 0xFF7A; sfr CC2 = 0xFE84; sfr CC2IC = 0xFF7C; sfr CC3 = 0xFE86; sfr CC3IC = 0xFF7E; sfr CC4 = 0xFE88; sfr CC4IC = 0xFF80; sfr CC5 = 0xFE8A; sfr CC5IC = 0xFF82; sfr CC6 = 0xFE8C; sfr CC6IC = 0xFF84; sfr CC7 = 0xFE8E; sfr CC7IC = 0xFF86; sfr CC8 = 0xFE90; sfr CC8IC = 0xFF88; sfr CC9 = 0xFE92; sfr CC9IC = 0xFF8A; sfr CC10 = 0xFE94; sfr CC10IC = 0xFF8C; sfr CC11 = 0xFE96; sfr CC11IC = 0xFF8E; sfr CC12 = 0xFE98; sfr CC12IC = 0xFF90; sfr CC13 = 0xFE9A; sfr CC13IC = 0xFF92; sfr CC14 = 0xFE9C; sfr CC14IC = 0xFF94; sfr CC15 = 0xFE9E; sfr CC15IC = 0xFF96; sfr CC16 = 0xFE60; sfr CC16IC = 0xF160; sfr CC17 = 0xFE62; sfr CC17IC = 0xF162; sfr CC18 = 0xFE64; sfr CC18IC = 0xF164; sfr CC19 = 0xFE66; sfr CC19IC = 0xF166; sfr CC20 = 0xFE68; sfr CC20IC = 0xF168; sfr CC21 = 0xFE6A; sfr CC21IC = 0xF16A; sfr CC22 = 0xFE6C; sfr CC22IC = 0xF16C; sfr CC23 = 0xFE6E; sfr CC23IC = 0xF16E; sfr CC24 = 0xFE70; sfr CC24IC = 0xF170; sfr CC25 = 0xFE72; sfr CC25IC = 0xF172; sfr CC26 = 0xFE74; sfr CC26IC = 0xF174; sfr CC27 = 0xFE76; sfr CC27IC = 0xF176; sfr CC28 = 0xFE78; sfr CC28IC = 0xF178; sfr CC29 = 0xFE7A; sfr CC29IC = 0xF184; sfr CC30 = 0xFE7C; sfr CC30IC = 0xF18C; sfr CC31 = 0xFE7E; sfr CC31IC = 0xF194; sfr CCM0 = 0xFF52; sfr CCM1 = 0xFF54; sfr CCM2 = 0xFF56; sfr CCM3 = 0xFF58; sfr CCM4 = 0xFF22; sfr CCM5 = 0xFF24; sfr CCM6 = 0xFF26; sfr CCM7 = 0xFF28; sfr T0 = 0xFE50; sfr T01CON = 0xFF50; sfr T0IC = 0xFF9C; sfr T0REL = 0xFE54; sfr T1 = 0xFE52; sfr T1IC = 0xFF9E; sfr T1REL = 0xFE56; sfr T7 = 0xF050; sfr T78CON = 0xFF20; sfr T7IC = 0xF17A; sfr T7REL = 0xF054; sfr T8 = 0xF052; sfr T8IC = 0xF17C; sfr T8REL = 0xF056; sbit CC0IR = CC0IC^7; sbit CC0IE = CC0IC^6; sbit CC1IR = CC1IC^7; sbit CC1IE = CC1IC^6; sbit CC2IR = CC2IC^7; sbit CC2IE = CC2IC^6; sbit CC3IR = CC3IC^7; sbit CC3IE = CC3IC^6; sbit CC4IR = CC4IC^7; sbit CC4IE = CC4IC^6; sbit CC5IR = CC5IC^7; sbit CC5IE = CC5IC^6; sbit CC6IR = CC6IC^7; sbit CC6IE = CC6IC^6; sbit CC7IR = CC7IC^7; sbit CC7IE = CC7IC^6; sbit CC8IR = CC8IC^7; sbit CC8IE = CC8IC^6; sbit CC9IR = CC9IC^7; sbit CC9IE = CC9IC^6; sbit CC10IR = CC10IC^7; sbit CC10IE = CC10IC^6; sbit CC11IR = CC11IC^7; sbit CC11IE = CC11IC^6; sbit CC12IR = CC12IC^7; sbit CC12IE = CC12IC^6; sbit CC13IR = CC13IC^7; sbit CC13IE = CC13IC^6; sbit CC14IR = CC14IC^7; sbit CC14IE = CC14IC^6; sbit CC15IR = CC15IC^7; sbit CC15IE = CC15IC^6; sbit CC16IR = CC16IC^7; sbit CC16IE = CC16IC^6; sbit CC17IR = CC17IC^7; sbit CC17IE = CC17IC^6; sbit CC18IR = CC18IC^7; sbit CC18IE = CC18IC^6; sbit CC19IR = CC19IC^7; sbit CC19IE = CC19IC^6; sbit CC20IR = CC20IC^7; sbit CC20IE = CC20IC^6; sbit CC21IR = CC21IC^7; sbit CC21IE = CC21IC^6; sbit CC22IR = CC22IC^7; sbit CC22IE = CC22IC^6; sbit CC23IR = CC23IC^7; sbit CC23IE = CC23IC^6; sbit CC24IR = CC24IC^7; sbit CC24IE = CC24IC^6; sbit CC25IR = CC25IC^7; sbit CC25IE = CC25IC^6; sbit CC26IR = CC26IC^7; sbit CC26IE = CC26IC^6; sbit CC27IR = CC27IC^7; sbit CC27IE = CC27IC^6; sbit CC28IR = CC28IC^7; sbit CC28IE = CC28IC^6; sbit CC29IR = CC29IC^7; sbit CC29IE = CC29IC^6; sbit CC30IR = CC30IC^7; sbit CC30IE = CC30IC^6; sbit CC31IR = CC31IC^7; sbit CC31IE = CC31IC^6; sbit ACC0 = CCM0^3; sbit ACC1 = CCM0^7; sbit ACC2 = CCM0^11; sbit ACC3 = CCM0^15; sbit ACC4 = CCM1^3; sbit ACC5 = CCM1^7; sbit ACC6 = CCM1^11; sbit ACC7 = CCM1^15; sbit ACC8 = CCM2^3; sbit ACC9 = CCM2^7; sbit ACC10 = CCM2^11; sbit ACC11 = CCM2^15; sbit ACC12 = CCM3^3; sbit ACC13 = CCM3^7; sbit ACC14 = CCM3^11; sbit ACC15 = CCM3^15; sbit ACC16 = CCM4^3; sbit ACC17 = CCM4^7; sbit ACC18 = CCM4^11; sbit ACC19 = CCM4^15; sbit ACC20 = CCM5^3; sbit ACC21 = CCM5^7; sbit ACC22 = CCM5^11; sbit ACC23 = CCM5^15; sbit ACC24 = CCM6^3; sbit ACC25 = CCM6^7; sbit ACC26 = CCM6^11; sbit ACC27 = CCM6^15; sbit ACC28 = CCM7^3; sbit ACC29 = CCM7^7; sbit ACC30 = CCM7^11; sbit ACC31 = CCM7^15; sbit T0IE = T0IC^6; sbit T0IR = T0IC^7; sbit T0M = T01CON^3; sbit T0R = T01CON^6; sbit T1IE = T1IC^6; sbit T1IR = T1IC^7; sbit T1M = T01CON^11; sbit T1R = T01CON^14; sbit T7IE = T7IC^6; sbit T7IR = T7IC^7; sbit T7M = T78CON^3; sbit T7R = T78CON^6; sbit T8IE = T8IC^6; sbit T8IR = T8IC^7; sbit T8M = T78CON^11; sbit T8R = T78CON^14; sfr CP = 0xFE10; sfr CSP = 0xFE08; sfr DPP0 = 0xFE00; sfr DPP1 = 0xFE02; sfr DPP2 = 0xFE04; sfr DPP3 = 0xFE06; sfr MDC = 0xFF0E; sfr MDH = 0xFE0C; sfr MDL = 0xFE0E; sfr ONES = 0xFF1E; sfr PSW = 0xFF10; sfr SP = 0xFE12; sfr STKOV = 0xFE14; sfr STKUN = 0xFE16; sfr SYSCON = 0xFF12; sfr TFR = 0xFFAC; sfr ZEROS = 0xFF1C; sfr BUSCON0 = 0xFF0C; sfr BUSCON1 = 0xFF14; sfr BUSCON2 = 0xFF16; sfr BUSCON3 = 0xFF18; sfr BUSCON4 = 0xFF1A; sfr ADDRSEL1 = 0xFE18; sfr ADDRSEL2 = 0xFE1A; sfr ADDRSEL3 = 0xFE1C; sfr ADDRSEL4 = 0xFE1E; sbit WRCFG = SYSCON^7; sbit CLKEN = SYSCON^8; sbit BYTDIS = SYSCON^9; sbit ROMEN = SYSCON^10; sbit SGTEN = SYSCON^11; sbit ROMS1 = SYSCON^12; sbit MDRIU = MDC^4; sbit N = PSW^0; sbit C = PSW^1; sbit V = PSW^2; sbit Z = PSW^3; sbit E = PSW^4; sbit MULIP = PSW^5; sbit USR0 = PSW^6; sbit HLDEN = PSW^10; sbit IEN = PSW^11; sbit RWDC0 = BUSCON0^4; sbit MTTC0 = BUSCON0^5; sbit ALECTL0 = BUSCON0^9; sbit BUSACT0 = BUSCON0^10; sbit RDYEN0 = BUSCON0^12; sbit RWDC1 = BUSCON1^4; sbit MTTC1 = BUSCON1^5; sbit ALECTL1 = BUSCON1^9; sbit BUSACT1 = BUSCON1^10; sbit RDYEN1 = BUSCON1^12; sbit CSREN1 = BUSCON1^14; sbit CSWEN1 = BUSCON1^15; sbit RWDC2 = BUSCON2^4; sbit MTTC2 = BUSCON2^5; sbit ALECTL2 = BUSCON2^9; sbit BUSACT2 = BUSCON2^10; sbit RDYEN2 = BUSCON2^12; sbit CSREN2 = BUSCON2^14; sbit CSWEN2 = BUSCON2^15; sbit RWDC3 = BUSCON3^4; sbit MTTC3 = BUSCON3^5; sbit ALECTL3 = BUSCON3^9; sbit BUSACT3 = BUSCON3^10; sbit RDYEN3 = BUSCON3^12; sbit CSREN3 = BUSCON3^14; sbit CSWEN3 = BUSCON3^15; sbit RWDC4 = BUSCON4^4; sbit MTTC4 = BUSCON4^5; sbit ALECTL4 = BUSCON4^9; sbit BUSACT4 = BUSCON4^10; sbit RDYEN4 = BUSCON4^12; sbit CSREN4 = BUSCON4^14; sbit CSWEN4 = BUSCON4^15; sbit ILLBUS = TFR^0; sbit ILLINA = TFR^1; sbit ILLOPA = TFR^2; sbit PRTFLT = TFR^3; sbit UNDOPC = TFR^7; sbit STKUF = TFR^13; sbit STKOF = TFR^14; sbit NMI = TFR^15; sfr EXICON = 0xF1C0; sfr ISNC = 0xF1DE; sbit RTCIE = ISNC^0; sbit RTCIR = ISNC^1; sbit PLLIE = ISNC^2; sbit PLLIR = ISNC^3; sfr PECC0 = 0xFEC0; sfr PECC1 = 0xFEC2; sfr PECC2 = 0xFEC4; sfr PECC3 = 0xFEC6; sfr PECC4 = 0xFEC8; sfr PECC5 = 0xFECA; sfr PECC6 = 0xFECC; sfr PECC7 = 0xFECE; sfr DP0L = 0xF100; sfr DP0H = 0xF102; sfr DP1L = 0xF104; sfr DP1H = 0xF106; sfr DP2 = 0xFFC2; sfr DP3 = 0xFFC6; sfr DP4 = 0xFFCA; sfr DP6 = 0xFFCE; sfr DP7 = 0xFFD2; sfr DP8 = 0xFFD6; sfr P0L = 0xFF00; sfr P0H = 0xFF02; sfr P1L = 0xFF04; sfr P1H = 0xFF06; sfr P2 = 0xFFC0; sfr P3 = 0xFFC4; sfr P4 = 0xFFC8; sfr P5 = 0xFFA2; sfr P6 = 0xFFCC; sfr P7 = 0xFFD0; sfr P8 = 0xFFD4; sfr ODP2 = 0xF1C2; sfr ODP3 = 0xF1C6; sfr ODP6 = 0xF1CE; sfr ODP7 = 0xF1D2; sfr ODP8 = 0xF1D6; sfr RP0H = 0xF108; sfr S0BG = 0xFEB4; sfr S0CON = 0xFFB0; sfr S0EIC = 0xFF70; sfr S0RBUF = 0xFEB2; sfr S0RIC = 0xFF6E; sfr S0TBUF = 0xFEB0; sfr S0TIC = 0xFF6C; sfr S0TBIC = 0xF19C; sbit S0STP = S0CON^3; sbit S0REN = S0CON^4; sbit S0PEN = S0CON^5; sbit S0FEN = S0CON^6; sbit S0OEN = S0CON^7; sbit S0PE = S0CON^8; sbit S0FE = S0CON^9; sbit S0OE = S0CON^10; sbit S0ODD = S0CON^12; sbit S0BRS = S0CON^13; sbit S0LB = S0CON^14; sbit S0R = S0CON^15; sbit S0TIE = S0TIC^6; sbit S0TIR = S0TIC^7; sbit S0TBIE = S0TBIC^6; sbit S0TBIR = S0TBIC^7; sbit S0RIE = S0RIC^6; sbit S0RIR = S0RIC^7; sbit S0EIE = S0EIC^6; sbit S0EIR = S0EIC^7; sfr SSCTIC = 0xFF72; sfr SSCRIC = 0xFF74; sfr SSCEIC = 0xFF76; sfr SSCTB = 0xF0B0; sfr SSCRB = 0xF0B2; sfr SSCBR = 0xF0B4; sfr SSCCON = 0xFFB2; sbit SSCHB = SSCCON^4; sbit SSCPH = SSCCON^5; sbit SSCPO = SSCCON^6; sbit SSCTE = SSCCON^8; sbit SSCTEN = SSCCON^8; sbit SSCRE = SSCCON^9; sbit SSCREN = SSCCON^9; sbit SSCPE = SSCCON^10; sbit SSCPEN = SSCCON^10; sbit SSCBE = SSCCON^11; sbit SSCBEN = SSCCON^11; sbit SSCBSY = SSCCON^12; sbit SSCMS = SSCCON^14; sbit SSCEN = SSCCON^15; sbit SSCTIR = SSCTIC^7; sbit SSCTIE = SSCTIC^6; sbit SSCRIR = SSCRIC^7; sbit SSCRIE = SSCRIC^6; sbit SSCEIR = SSCEIC^7; sbit SSCEIE = SSCEIC^6; sfr CAPREL = 0xFE4A; sfr CRIC = 0xFF6A; sfr T2 = 0xFE40; sfr T2CON = 0xFF40; sfr T2IC = 0xFF60; sfr T3 = 0xFE42; sfr T3CON = 0xFF42; sfr T3IC = 0xFF62; sfr T4 = 0xFE44; sfr T4CON = 0xFF44; sfr T4IC = 0xFF64; sfr T5 = 0xFE46; sfr T5CON = 0xFF46; sfr T5IC = 0xFF66; sfr T6 = 0xFE48; sfr T6CON = 0xFF48; sfr T6IC = 0xFF68; sfr WDT = 0xFEAE; sfr WDTCON = 0xFFAE; sbit CRIE = CRIC^6; sbit CRIR = CRIC^7; sbit T2R = T2CON^6; sbit T2UD = T2CON^7; sbit T2UDE = T2CON^8; sbit T2IE = T2IC^6; sbit T2IR = T2IC^7; sbit T3R = T3CON^6; sbit T3UD = T3CON^7; sbit T3UDE = T3CON^8; sbit T3OE = T3CON^9; sbit T3OTL = T3CON^10; sbit T3IE = T3IC^6; sbit T3IR = T3IC^7; sbit T4R = T4CON^6; sbit T4UD = T4CON^7; sbit T4UDE = T4CON^8; sbit T4IE = T4IC^6; sbit T4IR = T4IC^7; sbit T5R = T5CON^6; sbit T5UD = T5CON^7; sbit T5UDE = T5CON^8; sbit T5CLR = T5CON^14; sbit T5SC = T5CON^15; sbit T5IE = T5IC^6; sbit T5IR = T5IC^7; sbit T6R = T6CON^6; sbit T6UD = T6CON^7; sbit T6UDE = T6CON^8; sbit T6OE = T6CON^9; sbit T6OTL = T6CON^10; sbit T6SR = T6CON^15; sbit T6IE = T6IC^6; sbit T6IR = T6IC^7; sbit T0IN = P3^0; sbit T2IN = P3^7; sbit T3IN = P3^6; sbit T4IN = P3^5; sbit T5IN = P5^13; sbit T6IN = P5^12; sbit T2EUD = P5^15; sbit T3EUD = P3^4; sbit T4EUD = P5^14; sbit T5EUD = P5^11; sbit T6EUD = P5^10; sbit T3OUT = P3^3; sbit CAPIN = P3^2; sbit T6OUT = P3^1; sbit WDTIN = WDTCON^0; sbit WDTR = WDTCON^1; sfr PWMCON0 = 0xFF30; sfr PWMCON1 = 0xFF32; sfr PW0 = 0xFE30; sfr PW1 = 0xFE32; sfr PW2 = 0xFE34; sfr PW3 = 0xFE36; sfr PWMIC = 0xF17E; sfr PT0 = 0xF030; sfr PT1 = 0xF032; sfr PT2 = 0xF034; sfr PT3 = 0xF036; sfr PP0 = 0xF038; sfr PP1 = 0xF03A; sfr PP2 = 0xF03C; sfr PP3 = 0xF03E; sbit PTR0 = PWMCON0^0; sbit PTR1 = PWMCON0^1; sbit PTR2 = PWMCON0^2; sbit PTR3 = PWMCON0^3; sbit PTI0 = PWMCON0^4; sbit PTI1 = PWMCON0^5; sbit PTI2 = PWMCON0^6; sbit PTI3 = PWMCON0^7; sbit PIE0 = PWMCON0^8; sbit PIE1 = PWMCON0^9; sbit PIE2 = PWMCON0^10; sbit PIE3 = PWMCON0^11; sbit PIR0 = PWMCON0^12; sbit PIR1 = PWMCON0^13; sbit PIR2 = PWMCON0^14; sbit PIR3 = PWMCON0^15; sbit PEN0 = PWMCON1^0; sbit PEN1 = PWMCON1^1; sbit PEN2 = PWMCON1^2; sbit PEN3 = PWMCON1^3; sbit PM0 = PWMCON1^4; sbit PM1 = PWMCON1^5; sbit PM2 = PWMCON1^6; sbit PM3 = PWMCON1^7; sbit PB01 = PWMCON1^12; sbit PS2 = PWMCON1^14; sbit PS3 = PWMCON1^15; sbit PWMIR = PWMIC^7; sbit PWMIE = PWMIC^6; sfr XP0IC = 0xF186; sfr XP1IC = 0xF18E; sfr XP2IC = 0xF196; sfr XP3IC = 0xF19E; sbit XP0IR = XP0IC^7; sbit XP0IE = XP0IC^6; sbit XP1IR = XP1IC^7; sbit XP1IE = XP1IC^6; sbit XP2IR = XP2IC^7; sbit XP2IE = XP2IC^6; sbit XP3IR = XP3IC^7; sbit XP3IE = XP3IC^6; #line 3 "MAIN.C" #line 1 "C:\C166\INC\STDARG.H" typedef char *va_list; #line 4 "MAIN.C" #line 1 "C:\C166\INC\STDLIB.H" #line 10 "C:\C166\INC\STDLIB.H" #line 12 "C:\C166\INC\STDLIB.H" typedef unsigned int size_t; typedef char wchar_t; extern int abs (int val); extern long labs (long val); extern double atof (void *s1); extern long atol (void *s1); extern int atoi (void *s1); extern int rand (void); extern void srand (unsigned int); #line 38 "C:\C166\INC\STDLIB.H" #line 44 "C:\C166\INC\STDLIB.H" extern void far *malloc (size_t size); extern void free (void far *p); extern void init_mempool (void far *p, size_t size); extern void far *realloc (void far *p, size_t size); extern void far *calloc (size_t size, size_t len); extern void xhuge *xmalloc (unsigned long size); extern void xhuge *xcalloc (unsigned long size, unsigned long len); extern void xhuge *xrealloc (void xhuge *p, unsigned long size); extern void xinit_mempool (void xhuge *p, unsigned long size); extern void xfree (void xhuge *p); #line 5 "MAIN.C" #line 1 "C:\C166\INC\STDIO.H" #line 18 "C:\C166\INC\STDIO.H" #line 20 "C:\C166\INC\STDIO.H" extern char _getkey (void); extern char getchar (void); extern char ungetchar (char); extern char putchar (char); extern int printf (const char *, ...); extern int sprintf (char *, const char *, ...); extern int vprintf (const char *, char *); extern int vsprintf (char *, const char *, char *); extern char *gets (char *, unsigned int n); extern int scanf (const char *, ...); extern int sscanf (char *, const char *, ...); extern int puts (const char *); #line 6 "MAIN.C" #line 1 "C:\C166\INC\STRING.H" #line 10 "C:\C166\INC\STRING.H" #line 13 "C:\C166\INC\STRING.H" #line 15 "C:\C166\INC\STRING.H" #line 17 "C:\C166\INC\STRING.H" extern char *strcat (char *s1, char *s2); extern char *strncat (char *s1, char *s2, unsigned int n); extern int strcmp (char *s1, char *s2); extern int strncmp (char *s1, char *s2, unsigned int n); extern char *strcpy (char *s1, char *s2); extern char *strncpy (char *s1, char *s2, unsigned int n); extern size_t strlen (char *); extern char *strchr (char *s, char c); extern int strpos (char *s, char c); extern char *strrchr (char *s, char c); extern int strrpos (char *s, char c); extern int strspn (char *s, char *set); extern int strcspn (char *s, char *set); extern char *strpbrk (char *s, char *set); extern char *strrpbrk(char *s, char *set); extern int memcmp (void *s1, void *s2, unsigned int n); extern void *memcpy (void *s1, void *s2, unsigned int n); extern void *memchr (void *s, char val, unsigned int n); extern void *memccpy (void *s1, void *s2, char val, unsigned int n); extern void *memmove (void *s1, void *s2, unsigned int n); extern void *memset (void *s, char val, unsigned int n); extern char far *fstrcat (char far *s1, char far *s2); extern char far *fstrncat (char far *s1, char far *s2, unsigned int n); extern int fstrcmp (char far *s1, char far *s2); extern int fstrncmp (char far *s1, char far *s2, unsigned int n); extern char *fstrcpy (char far *s1, char far *s2); extern char *fstrncpy (char far *s1, char far *s2, unsigned int n); extern size_t fstrlen (char far *); extern char far *fstrchr (const char far *s, char c); extern char far *fstrrchr (const char far *s, char c); extern int fstrpos (const char far *s, char c); extern int fstrrpos (const char far *s, char c); extern int fstrspn (char far *s, char far *set); extern int fstrcspn (char far *s, char far *set); extern char *fstrpbrk (char far *s, char far *set); extern char *fstrrpbrk (char far *s, char far *set); extern int fmemcmp (void far *s1, void far *s2, unsigned int n); extern void far *fmemcpy (void far *s1, void far *s2, unsigned int n); extern void far *fmemchr (void far *s, char val, unsigned int n); extern void far *fmemccpy (void far *s1, void far *s2, char val, unsigned int n); extern void far *fmemmove (void far *s1, void far *s2, unsigned int n); extern void far *fmemset (void far *s, char val, unsigned int n); extern int xmemcmp (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemcpy (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemchr (void xhuge *s, char val, unsigned long n); extern void xhuge *xmemccpy (void xhuge *s1, void xhuge *s2, char val, unsigned long n); extern void xhuge *xmemmove (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemset (void xhuge *s, char val, unsigned long n); #line 7 "MAIN.C" #line 1 "C:\C166\INC\MATH.H" extern int abs (int val); extern long labs (long val); extern double fabs (double val); extern double sqrt (double val); extern double exp (double val); extern double log (double val); extern double log10 (double val); extern double sin (double val); extern double cos (double val); extern double tan (double val); extern double asin (double val); extern double acos (double val); extern double atan (double val); extern double sinh (double val); extern double cosh (double val); extern double tanh (double val); extern double atan2 (double y, double x); extern double ceil (double val); extern double floor (double val); extern double modf (double val, double *n); extern double pow (double x, double y); extern unsigned int _chkfloat_ (float x); extern unsigned int _chkdouble_ (double x); #line 8 "MAIN.C" #line 1 "C:\C166\INC\ABSACC.H" #line 10 "C:\C166\INC\ABSACC.H" #line 13 "C:\C166\INC\ABSACC.H" #line 9 "MAIN.C" #line 1 "C:\C166\INC\INTRINS.H" void _nop_ (void); void _idle_ (void); void _srvwdt_ (void); void _pwrdn_ (void); void _diswdt_ (void); void _einit_ (void); void _bfld_ (unsigned int sfr_, unsigned mask1, unsigned mask2); void _trap_ (int intno); void _atomic_ (int n_instr); void _endatomic_ (void); unsigned int _sof_ (void huge *); #line 22 "C:\C166\INC\INTRINS.H" #line 24 "C:\C166\INC\INTRINS.H" bit _testclear_ (bit); bit _testset_ (bit); extern unsigned char _crol_ (unsigned char, int); extern unsigned int _irol_ (unsigned int, int); extern unsigned long _lrol_ (unsigned long, int); extern unsigned char _cror_ (unsigned char, int); extern unsigned int _iror_ (unsigned int, int); extern unsigned long _lror_ (unsigned long, int); #line 10 "MAIN.C" #line 1 "global.h" sbit DP2_8 = DP2^8; sbit DP2_9 = DP2^9; sbit DP2_10 = DP2^10; sbit DP2_11 = DP2^11; sbit DP7_0 = DP7^0; sbit DP7_1 = DP7^1; sbit DP7_2 = DP7^2; sbit DP7_3 = DP7^3; sbit DP7_4 = DP7^4; sbit DP7_5 = DP7^5; sbit DP7_6 = DP7^6; sbit DP7_7 = DP7^7; sbit DP8_0 = DP8^0; sbit DP8_1 = DP8^1; sbit DP8_2 = DP8^2; sbit DP8_3 = DP8^3; sbit DP8_4 = DP8^4; sbit P2_8 = P2^8; sbit P2_9 = P2^9; sbit P2_10 = P2^10; sbit P2_11 = P2^11; sbit MOTORSWITCH = P8^4; #line 12 "MAIN.C" #line 1 "int.h" #line 1 "C:\C166\INC\REG167.H" sfr ADCIC = 0xFF98; sfr ADCON = 0xFFA0; sfr ADDAT = 0xFEA0; sfr ADEIC = 0xFF9A; sfr ADDAT2 = 0xF0A0; sbit ADST = ADCON^7; sbit ADBSY = ADCON^8; sbit ADWR = ADCON^9; sbit ADCIN = ADCON^10; sbit ADCRQ = ADCON^11; sbit ADCIE = ADCIC^6; sbit ADCIR = ADCIC^7; sbit ADEIE = ADEIC^6; sbit ADEIR = ADEIC^7; sfr CC0 = 0xFE80; sfr CC0IC = 0xFF78; sfr CC1 = 0xFE82; sfr CC1IC = 0xFF7A; sfr CC2 = 0xFE84; sfr CC2IC = 0xFF7C; sfr CC3 = 0xFE86; sfr CC3IC = 0xFF7E; sfr CC4 = 0xFE88; sfr CC4IC = 0xFF80; sfr CC5 = 0xFE8A; sfr CC5IC = 0xFF82; sfr CC6 = 0xFE8C; sfr CC6IC = 0xFF84; sfr CC7 = 0xFE8E; sfr CC7IC = 0xFF86; sfr CC8 = 0xFE90; sfr CC8IC = 0xFF88; sfr CC9 = 0xFE92; sfr CC9IC = 0xFF8A; sfr CC10 = 0xFE94; sfr CC10IC = 0xFF8C; sfr CC11 = 0xFE96; sfr CC11IC = 0xFF8E; sfr CC12 = 0xFE98; sfr CC12IC = 0xFF90; sfr CC13 = 0xFE9A; sfr CC13IC = 0xFF92; sfr CC14 = 0xFE9C; sfr CC14IC = 0xFF94; sfr CC15 = 0xFE9E; sfr CC15IC = 0xFF96; sfr CC16 = 0xFE60; sfr CC16IC = 0xF160; sfr CC17 = 0xFE62; sfr CC17IC = 0xF162; sfr CC18 = 0xFE64; sfr CC18IC = 0xF164; sfr CC19 = 0xFE66; sfr CC19IC = 0xF166; sfr CC20 = 0xFE68; sfr CC20IC = 0xF168; sfr CC21 = 0xFE6A; sfr CC21IC = 0xF16A; sfr CC22 = 0xFE6C; sfr CC22IC = 0xF16C; sfr CC23 = 0xFE6E; sfr CC23IC = 0xF16E; sfr CC24 = 0xFE70; sfr CC24IC = 0xF170; sfr CC25 = 0xFE72; sfr CC25IC = 0xF172; sfr CC26 = 0xFE74; sfr CC26IC = 0xF174; sfr CC27 = 0xFE76; sfr CC27IC = 0xF176; sfr CC28 = 0xFE78; sfr CC28IC = 0xF178; sfr CC29 = 0xFE7A; sfr CC29IC = 0xF184; sfr CC30 = 0xFE7C; sfr CC30IC = 0xF18C; sfr CC31 = 0xFE7E; sfr CC31IC = 0xF194; sfr CCM0 = 0xFF52; sfr CCM1 = 0xFF54; sfr CCM2 = 0xFF56; sfr CCM3 = 0xFF58; sfr CCM4 = 0xFF22; sfr CCM5 = 0xFF24; sfr CCM6 = 0xFF26; sfr CCM7 = 0xFF28; sfr T0 = 0xFE50; sfr T01CON = 0xFF50; sfr T0IC = 0xFF9C; sfr T0REL = 0xFE54; sfr T1 = 0xFE52; sfr T1IC = 0xFF9E; sfr T1REL = 0xFE56; sfr T7 = 0xF050; sfr T78CON = 0xFF20; sfr T7IC = 0xF17A; sfr T7REL = 0xF054; sfr T8 = 0xF052; sfr T8IC = 0xF17C; sfr T8REL = 0xF056; sbit CC0IR = CC0IC^7; sbit CC0IE = CC0IC^6; sbit CC1IR = CC1IC^7; sbit CC1IE = CC1IC^6; sbit CC2IR = CC2IC^7; sbit CC2IE = CC2IC^6; sbit CC3IR = CC3IC^7; sbit CC3IE = CC3IC^6; sbit CC4IR = CC4IC^7; sbit CC4IE = CC4IC^6; sbit CC5IR = CC5IC^7; sbit CC5IE = CC5IC^6; sbit CC6IR = CC6IC^7; sbit CC6IE = CC6IC^6; sbit CC7IR = CC7IC^7; sbit CC7IE = CC7IC^6; sbit CC8IR = CC8IC^7; sbit CC8IE = CC8IC^6; sbit CC9IR = CC9IC^7; sbit CC9IE = CC9IC^6; sbit CC10IR = CC10IC^7; sbit CC10IE = CC10IC^6; sbit CC11IR = CC11IC^7; sbit CC11IE = CC11IC^6; sbit CC12IR = CC12IC^7; sbit CC12IE = CC12IC^6; sbit CC13IR = CC13IC^7; sbit CC13IE = CC13IC^6; sbit CC14IR = CC14IC^7; sbit CC14IE = CC14IC^6; sbit CC15IR = CC15IC^7; sbit CC15IE = CC15IC^6; sbit CC16IR = CC16IC^7; sbit CC16IE = CC16IC^6; sbit CC17IR = CC17IC^7; sbit CC17IE = CC17IC^6; sbit CC18IR = CC18IC^7; sbit CC18IE = CC18IC^6; sbit CC19IR = CC19IC^7; sbit CC19IE = CC19IC^6; sbit CC20IR = CC20IC^7; sbit CC20IE = CC20IC^6; sbit CC21IR = CC21IC^7; sbit CC21IE = CC21IC^6; sbit CC22IR = CC22IC^7; sbit CC22IE = CC22IC^6; sbit CC23IR = CC23IC^7; sbit CC23IE = CC23IC^6; sbit CC24IR = CC24IC^7; sbit CC24IE = CC24IC^6; sbit CC25IR = CC25IC^7; sbit CC25IE = CC25IC^6; sbit CC26IR = CC26IC^7; sbit CC26IE = CC26IC^6; sbit CC27IR = CC27IC^7; sbit CC27IE = CC27IC^6; sbit CC28IR = CC28IC^7; sbit CC28IE = CC28IC^6; sbit CC29IR = CC29IC^7; sbit CC29IE = CC29IC^6; sbit CC30IR = CC30IC^7; sbit CC30IE = CC30IC^6; sbit CC31IR = CC31IC^7; sbit CC31IE = CC31IC^6; sbit ACC0 = CCM0^3; sbit ACC1 = CCM0^7; sbit ACC2 = CCM0^11; sbit ACC3 = CCM0^15; sbit ACC4 = CCM1^3; sbit ACC5 = CCM1^7; sbit ACC6 = CCM1^11; sbit ACC7 = CCM1^15; sbit ACC8 = CCM2^3; sbit ACC9 = CCM2^7; sbit ACC10 = CCM2^11; sbit ACC11 = CCM2^15; sbit ACC12 = CCM3^3; sbit ACC13 = CCM3^7; sbit ACC14 = CCM3^11; sbit ACC15 = CCM3^15; sbit ACC16 = CCM4^3; sbit ACC17 = CCM4^7; sbit ACC18 = CCM4^11; sbit ACC19 = CCM4^15; sbit ACC20 = CCM5^3; sbit ACC21 = CCM5^7; sbit ACC22 = CCM5^11; sbit ACC23 = CCM5^15; sbit ACC24 = CCM6^3; sbit ACC25 = CCM6^7; sbit ACC26 = CCM6^11; sbit ACC27 = CCM6^15; sbit ACC28 = CCM7^3; sbit ACC29 = CCM7^7; sbit ACC30 = CCM7^11; sbit ACC31 = CCM7^15; sbit T0IE = T0IC^6; sbit T0IR = T0IC^7; sbit T0M = T01CON^3; sbit T0R = T01CON^6; sbit T1IE = T1IC^6; sbit T1IR = T1IC^7; sbit T1M = T01CON^11; sbit T1R = T01CON^14; sbit T7IE = T7IC^6; sbit T7IR = T7IC^7; sbit T7M = T78CON^3; sbit T7R = T78CON^6; sbit T8IE = T8IC^6; sbit T8IR = T8IC^7; sbit T8M = T78CON^11; sbit T8R = T78CON^14; sfr CP = 0xFE10; sfr CSP = 0xFE08; sfr DPP0 = 0xFE00; sfr DPP1 = 0xFE02; sfr DPP2 = 0xFE04; sfr DPP3 = 0xFE06; sfr MDC = 0xFF0E; sfr MDH = 0xFE0C; sfr MDL = 0xFE0E; sfr ONES = 0xFF1E; sfr PSW = 0xFF10; sfr SP = 0xFE12; sfr STKOV = 0xFE14; sfr STKUN = 0xFE16; sfr SYSCON = 0xFF12; sfr TFR = 0xFFAC; sfr ZEROS = 0xFF1C; sfr BUSCON0 = 0xFF0C; sfr BUSCON1 = 0xFF14; sfr BUSCON2 = 0xFF16; sfr BUSCON3 = 0xFF18; sfr BUSCON4 = 0xFF1A; sfr ADDRSEL1 = 0xFE18; sfr ADDRSEL2 = 0xFE1A; sfr ADDRSEL3 = 0xFE1C; sfr ADDRSEL4 = 0xFE1E; sbit WRCFG = SYSCON^7; sbit CLKEN = SYSCON^8; sbit BYTDIS = SYSCON^9; sbit ROMEN = SYSCON^10; sbit SGTEN = SYSCON^11; sbit ROMS1 = SYSCON^12; sbit MDRIU = MDC^4; sbit N = PSW^0; sbit C = PSW^1; sbit V = PSW^2; sbit Z = PSW^3; sbit E = PSW^4; sbit MULIP = PSW^5; sbit USR0 = PSW^6; sbit HLDEN = PSW^10; sbit IEN = PSW^11; sbit RWDC0 = BUSCON0^4; sbit MTTC0 = BUSCON0^5; sbit ALECTL0 = BUSCON0^9; sbit BUSACT0 = BUSCON0^10; sbit RDYEN0 = BUSCON0^12; sbit RWDC1 = BUSCON1^4; sbit MTTC1 = BUSCON1^5; sbit ALECTL1 = BUSCON1^9; sbit BUSACT1 = BUSCON1^10; sbit RDYEN1 = BUSCON1^12; sbit CSREN1 = BUSCON1^14; sbit CSWEN1 = BUSCON1^15; sbit RWDC2 = BUSCON2^4; sbit MTTC2 = BUSCON2^5; sbit ALECTL2 = BUSCON2^9; sbit BUSACT2 = BUSCON2^10; sbit RDYEN2 = BUSCON2^12; sbit CSREN2 = BUSCON2^14; sbit CSWEN2 = BUSCON2^15; sbit RWDC3 = BUSCON3^4; sbit MTTC3 = BUSCON3^5; sbit ALECTL3 = BUSCON3^9; sbit BUSACT3 = BUSCON3^10; sbit RDYEN3 = BUSCON3^12; sbit CSREN3 = BUSCON3^14; sbit CSWEN3 = BUSCON3^15; sbit RWDC4 = BUSCON4^4; sbit MTTC4 = BUSCON4^5; sbit ALECTL4 = BUSCON4^9; sbit BUSACT4 = BUSCON4^10; sbit RDYEN4 = BUSCON4^12; sbit CSREN4 = BUSCON4^14; sbit CSWEN4 = BUSCON4^15; sbit ILLBUS = TFR^0; sbit ILLINA = TFR^1; sbit ILLOPA = TFR^2; sbit PRTFLT = TFR^3; sbit UNDOPC = TFR^7; sbit STKUF = TFR^13; sbit STKOF = TFR^14; sbit NMI = TFR^15; sfr EXICON = 0xF1C0; sfr ISNC = 0xF1DE; sbit RTCIE = ISNC^0; sbit RTCIR = ISNC^1; sbit PLLIE = ISNC^2; sbit PLLIR = ISNC^3; sfr PECC0 = 0xFEC0; sfr PECC1 = 0xFEC2; sfr PECC2 = 0xFEC4; sfr PECC3 = 0xFEC6; sfr PECC4 = 0xFEC8; sfr PECC5 = 0xFECA; sfr PECC6 = 0xFECC; sfr PECC7 = 0xFECE; sfr DP0L = 0xF100; sfr DP0H = 0xF102; sfr DP1L = 0xF104; sfr DP1H = 0xF106; sfr DP2 = 0xFFC2; sfr DP3 = 0xFFC6; sfr DP4 = 0xFFCA; sfr DP6 = 0xFFCE; sfr DP7 = 0xFFD2; sfr DP8 = 0xFFD6; sfr P0L = 0xFF00; sfr P0H = 0xFF02; sfr P1L = 0xFF04; sfr P1H = 0xFF06; sfr P2 = 0xFFC0; sfr P3 = 0xFFC4; sfr P4 = 0xFFC8; sfr P5 = 0xFFA2; sfr P6 = 0xFFCC; sfr P7 = 0xFFD0; sfr P8 = 0xFFD4; sfr ODP2 = 0xF1C2; sfr ODP3 = 0xF1C6; sfr ODP6 = 0xF1CE; sfr ODP7 = 0xF1D2; sfr ODP8 = 0xF1D6; sfr RP0H = 0xF108; sfr S0BG = 0xFEB4; sfr S0CON = 0xFFB0; sfr S0EIC = 0xFF70; sfr S0RBUF = 0xFEB2; sfr S0RIC = 0xFF6E; sfr S0TBUF = 0xFEB0; sfr S0TIC = 0xFF6C; sfr S0TBIC = 0xF19C; sbit S0STP = S0CON^3; sbit S0REN = S0CON^4; sbit S0PEN = S0CON^5; sbit S0FEN = S0CON^6; sbit S0OEN = S0CON^7; sbit S0PE = S0CON^8; sbit S0FE = S0CON^9; sbit S0OE = S0CON^10; sbit S0ODD = S0CON^12; sbit S0BRS = S0CON^13; sbit S0LB = S0CON^14; sbit S0R = S0CON^15; sbit S0TIE = S0TIC^6; sbit S0TIR = S0TIC^7; sbit S0TBIE = S0TBIC^6; sbit S0TBIR = S0TBIC^7; sbit S0RIE = S0RIC^6; sbit S0RIR = S0RIC^7; sbit S0EIE = S0EIC^6; sbit S0EIR = S0EIC^7; sfr SSCTIC = 0xFF72; sfr SSCRIC = 0xFF74; sfr SSCEIC = 0xFF76; sfr SSCTB = 0xF0B0; sfr SSCRB = 0xF0B2; sfr SSCBR = 0xF0B4; sfr SSCCON = 0xFFB2; sbit SSCHB = SSCCON^4; sbit SSCPH = SSCCON^5; sbit SSCPO = SSCCON^6; sbit SSCTE = SSCCON^8; sbit SSCTEN = SSCCON^8; sbit SSCRE = SSCCON^9; sbit SSCREN = SSCCON^9; sbit SSCPE = SSCCON^10; sbit SSCPEN = SSCCON^10; sbit SSCBE = SSCCON^11; sbit SSCBEN = SSCCON^11; sbit SSCBSY = SSCCON^12; sbit SSCMS = SSCCON^14; sbit SSCEN = SSCCON^15; sbit SSCTIR = SSCTIC^7; sbit SSCTIE = SSCTIC^6; sbit SSCRIR = SSCRIC^7; sbit SSCRIE = SSCRIC^6; sbit SSCEIR = SSCEIC^7; sbit SSCEIE = SSCEIC^6; sfr CAPREL = 0xFE4A; sfr CRIC = 0xFF6A; sfr T2 = 0xFE40; sfr T2CON = 0xFF40; sfr T2IC = 0xFF60; sfr T3 = 0xFE42; sfr T3CON = 0xFF42; sfr T3IC = 0xFF62; sfr T4 = 0xFE44; sfr T4CON = 0xFF44; sfr T4IC = 0xFF64; sfr T5 = 0xFE46; sfr T5CON = 0xFF46; sfr T5IC = 0xFF66; sfr T6 = 0xFE48; sfr T6CON = 0xFF48; sfr T6IC = 0xFF68; sfr WDT = 0xFEAE; sfr WDTCON = 0xFFAE; sbit CRIE = CRIC^6; sbit CRIR = CRIC^7; sbit T2R = T2CON^6; sbit T2UD = T2CON^7; sbit T2UDE = T2CON^8; sbit T2IE = T2IC^6; sbit T2IR = T2IC^7; sbit T3R = T3CON^6; sbit T3UD = T3CON^7; sbit T3UDE = T3CON^8; sbit T3OE = T3CON^9; sbit T3OTL = T3CON^10; sbit T3IE = T3IC^6; sbit T3IR = T3IC^7; sbit T4R = T4CON^6; sbit T4UD = T4CON^7; sbit T4UDE = T4CON^8; sbit T4IE = T4IC^6; sbit T4IR = T4IC^7; sbit T5R = T5CON^6; sbit T5UD = T5CON^7; sbit T5UDE = T5CON^8; sbit T5CLR = T5CON^14; sbit T5SC = T5CON^15; sbit T5IE = T5IC^6; sbit T5IR = T5IC^7; sbit T6R = T6CON^6; sbit T6UD = T6CON^7; sbit T6UDE = T6CON^8; sbit T6OE = T6CON^9; sbit T6OTL = T6CON^10; sbit T6SR = T6CON^15; sbit T6IE = T6IC^6; sbit T6IR = T6IC^7; sbit T0IN = P3^0; sbit T2IN = P3^7; sbit T3IN = P3^6; sbit T4IN = P3^5; sbit T5IN = P5^13; sbit T6IN = P5^12; sbit T2EUD = P5^15; sbit T3EUD = P3^4; sbit T4EUD = P5^14; sbit T5EUD = P5^11; sbit T6EUD = P5^10; sbit T3OUT = P3^3; sbit CAPIN = P3^2; sbit T6OUT = P3^1; sbit WDTIN = WDTCON^0; sbit WDTR = WDTCON^1; sfr PWMCON0 = 0xFF30; sfr PWMCON1 = 0xFF32; sfr PW0 = 0xFE30; sfr PW1 = 0xFE32; sfr PW2 = 0xFE34; sfr PW3 = 0xFE36; sfr PWMIC = 0xF17E; sfr PT0 = 0xF030; sfr PT1 = 0xF032; sfr PT2 = 0xF034; sfr PT3 = 0xF036; sfr PP0 = 0xF038; sfr PP1 = 0xF03A; sfr PP2 = 0xF03C; sfr PP3 = 0xF03E; sbit PTR0 = PWMCON0^0; sbit PTR1 = PWMCON0^1; sbit PTR2 = PWMCON0^2; sbit PTR3 = PWMCON0^3; sbit PTI0 = PWMCON0^4; sbit PTI1 = PWMCON0^5; sbit PTI2 = PWMCON0^6; sbit PTI3 = PWMCON0^7; sbit PIE0 = PWMCON0^8; sbit PIE1 = PWMCON0^9; sbit PIE2 = PWMCON0^10; sbit PIE3 = PWMCON0^11; sbit PIR0 = PWMCON0^12; sbit PIR1 = PWMCON0^13; sbit PIR2 = PWMCON0^14; sbit PIR3 = PWMCON0^15; sbit PEN0 = PWMCON1^0; sbit PEN1 = PWMCON1^1; sbit PEN2 = PWMCON1^2; sbit PEN3 = PWMCON1^3; sbit PM0 = PWMCON1^4; sbit PM1 = PWMCON1^5; sbit PM2 = PWMCON1^6; sbit PM3 = PWMCON1^7; sbit PB01 = PWMCON1^12; sbit PS2 = PWMCON1^14; sbit PS3 = PWMCON1^15; sbit PWMIR = PWMIC^7; sbit PWMIE = PWMIC^6; sfr XP0IC = 0xF186; sfr XP1IC = 0xF18E; sfr XP2IC = 0xF196; sfr XP3IC = 0xF19E; sbit XP0IR = XP0IC^7; sbit XP0IE = XP0IC^6; sbit XP1IR = XP1IC^7; sbit XP1IE = XP1IC^6; sbit XP2IR = XP2IC^7; sbit XP2IE = XP2IC^6; sbit XP3IR = XP3IC^7; sbit XP3IE = XP3IC^6; #line 6 "int.h" #line 1 "C:\C166\INC\ABSACC.H" #line 10 "C:\C166\INC\ABSACC.H" #line 13 "C:\C166\INC\ABSACC.H" #line 7 "int.h" #line 1 "C:\C166\INC\STDARG.H" #line 10 "C:\C166\INC\STDARG.H" #line 8 "int.h" #line 8 "int.h" #line 1 "C:\C166\INC\STDLIB.H" #line 10 "C:\C166\INC\STDLIB.H" #line 12 "C:\C166\INC\STDLIB.H" #line 14 "C:\C166\INC\STDLIB.H" #line 17 "C:\C166\INC\STDLIB.H" #line 19 "C:\C166\INC\STDLIB.H" #line 22 "C:\C166\INC\STDLIB.H" #line 24 "C:\C166\INC\STDLIB.H" #line 26 "C:\C166\INC\STDLIB.H" extern int abs (int val); extern long labs (long val); extern double atof (void *s1); extern long atol (void *s1); extern int atoi (void *s1); extern int rand (void); extern void srand (unsigned int); #line 38 "C:\C166\INC\STDLIB.H" #line 44 "C:\C166\INC\STDLIB.H" extern void far *malloc (size_t size); extern void free (void far *p); extern void init_mempool (void far *p, size_t size); extern void far *realloc (void far *p, size_t size); extern void far *calloc (size_t size, size_t len); extern void xhuge *xmalloc (unsigned long size); extern void xhuge *xcalloc (unsigned long size, unsigned long len); extern void xhuge *xrealloc (void xhuge *p, unsigned long size); extern void xinit_mempool (void xhuge *p, unsigned long size); extern void xfree (void xhuge *p); #line 9 "int.h" #line 1 "C:\C166\INC\STDIO.H" #line 10 "C:\C166\INC\STDIO.H" #line 10 "int.h" #line 10 "int.h" #line 1 "C:\C166\INC\STRING.H" #line 10 "C:\C166\INC\STRING.H" #line 13 "C:\C166\INC\STRING.H" #line 15 "C:\C166\INC\STRING.H" #line 17 "C:\C166\INC\STRING.H" extern char *strcat (char *s1, char *s2); extern char *strncat (char *s1, char *s2, unsigned int n); extern int strcmp (char *s1, char *s2); extern int strncmp (char *s1, char *s2, unsigned int n); extern char *strcpy (char *s1, char *s2); extern char *strncpy (char *s1, char *s2, unsigned int n); extern size_t strlen (char *); extern char *strchr (char *s, char c); extern int strpos (char *s, char c); extern char *strrchr (char *s, char c); extern int strrpos (char *s, char c); extern int strspn (char *s, char *set); extern int strcspn (char *s, char *set); extern char *strpbrk (char *s, char *set); extern char *strrpbrk(char *s, char *set); extern int memcmp (void *s1, void *s2, unsigned int n); extern void *memcpy (void *s1, void *s2, unsigned int n); extern void *memchr (void *s, char val, unsigned int n); extern void *memccpy (void *s1, void *s2, char val, unsigned int n); extern void *memmove (void *s1, void *s2, unsigned int n); extern void *memset (void *s, char val, unsigned int n); extern char far *fstrcat (char far *s1, char far *s2); extern char far *fstrncat (char far *s1, char far *s2, unsigned int n); extern int fstrcmp (char far *s1, char far *s2); extern int fstrncmp (char far *s1, char far *s2, unsigned int n); extern char *fstrcpy (char far *s1, char far *s2); extern char *fstrncpy (char far *s1, char far *s2, unsigned int n); extern size_t fstrlen (char far *); extern char far *fstrchr (const char far *s, char c); extern char far *fstrrchr (const char far *s, char c); extern int fstrpos (const char far *s, char c); extern int fstrrpos (const char far *s, char c); extern int fstrspn (char far *s, char far *set); extern int fstrcspn (char far *s, char far *set); extern char *fstrpbrk (char far *s, char far *set); extern char *fstrrpbrk (char far *s, char far *set); extern int fmemcmp (void far *s1, void far *s2, unsigned int n); extern void far *fmemcpy (void far *s1, void far *s2, unsigned int n); extern void far *fmemchr (void far *s, char val, unsigned int n); extern void far *fmemccpy (void far *s1, void far *s2, char val, unsigned int n); extern void far *fmemmove (void far *s1, void far *s2, unsigned int n); extern void far *fmemset (void far *s, char val, unsigned int n); extern int xmemcmp (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemcpy (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemchr (void xhuge *s, char val, unsigned long n); extern void xhuge *xmemccpy (void xhuge *s1, void xhuge *s2, char val, unsigned long n); extern void xhuge *xmemmove (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemset (void xhuge *s, char val, unsigned long n); #line 11 "int.h" #line 1 "C:\C166\INC\MATH.H" extern int abs (int val); extern long labs (long val); extern double fabs (double val); extern double sqrt (double val); extern double exp (double val); extern double log (double val); extern double log10 (double val); extern double sin (double val); extern double cos (double val); extern double tan (double val); extern double asin (double val); extern double acos (double val); extern double atan (double val); extern double sinh (double val); extern double cosh (double val); extern double tanh (double val); extern double atan2 (double y, double x); extern double ceil (double val); extern double floor (double val); extern double modf (double val, double *n); extern double pow (double x, double y); extern unsigned int _chkfloat_ (float x); extern unsigned int _chkdouble_ (double x); #line 12 "int.h" #line 1 "global.h" #line 5 "global.h" #line 204 "global.h" #line 13 "int.h" #line 1 "util.h" #line 1 "C:\C166\INC\STDIO.H" #line 10 "C:\C166\INC\STDIO.H" #line 5 "util.h" #line 5 "util.h" #line 1 "C:\C166\INC\ABSACC.H" #line 10 "C:\C166\INC\ABSACC.H" #line 13 "C:\C166\INC\ABSACC.H" #line 6 "util.h" #line 1 "C:\C166\INC\INTRINS.H" void _nop_ (void); void _idle_ (void); void _srvwdt_ (void); void _pwrdn_ (void); void _diswdt_ (void); void _einit_ (void); void _bfld_ (unsigned int sfr_, unsigned mask1, unsigned mask2); void _trap_ (int intno); void _atomic_ (int n_instr); void _endatomic_ (void); unsigned int _sof_ (void huge *); #line 22 "C:\C166\INC\INTRINS.H" #line 24 "C:\C166\INC\INTRINS.H" bit _testclear_ (bit); bit _testset_ (bit); extern unsigned char _crol_ (unsigned char, int); extern unsigned int _irol_ (unsigned int, int); extern unsigned long _lrol_ (unsigned long, int); extern unsigned char _cror_ (unsigned char, int); extern unsigned int _iror_ (unsigned int, int); extern unsigned long _lror_ (unsigned long, int); #line 7 "util.h" #line 1 "C:\C166\INC\REG167.H" sfr ADCIC = 0xFF98; sfr ADCON = 0xFFA0; sfr ADDAT = 0xFEA0; sfr ADEIC = 0xFF9A; sfr ADDAT2 = 0xF0A0; sbit ADST = ADCON^7; sbit ADBSY = ADCON^8; sbit ADWR = ADCON^9; sbit ADCIN = ADCON^10; sbit ADCRQ = ADCON^11; sbit ADCIE = ADCIC^6; sbit ADCIR = ADCIC^7; sbit ADEIE = ADEIC^6; sbit ADEIR = ADEIC^7; sfr CC0 = 0xFE80; sfr CC0IC = 0xFF78; sfr CC1 = 0xFE82; sfr CC1IC = 0xFF7A; sfr CC2 = 0xFE84; sfr CC2IC = 0xFF7C; sfr CC3 = 0xFE86; sfr CC3IC = 0xFF7E; sfr CC4 = 0xFE88; sfr CC4IC = 0xFF80; sfr CC5 = 0xFE8A; sfr CC5IC = 0xFF82; sfr CC6 = 0xFE8C; sfr CC6IC = 0xFF84; sfr CC7 = 0xFE8E; sfr CC7IC = 0xFF86; sfr CC8 = 0xFE90; sfr CC8IC = 0xFF88; sfr CC9 = 0xFE92; sfr CC9IC = 0xFF8A; sfr CC10 = 0xFE94; sfr CC10IC = 0xFF8C; sfr CC11 = 0xFE96; sfr CC11IC = 0xFF8E; sfr CC12 = 0xFE98; sfr CC12IC = 0xFF90; sfr CC13 = 0xFE9A; sfr CC13IC = 0xFF92; sfr CC14 = 0xFE9C; sfr CC14IC = 0xFF94; sfr CC15 = 0xFE9E; sfr CC15IC = 0xFF96; sfr CC16 = 0xFE60; sfr CC16IC = 0xF160; sfr CC17 = 0xFE62; sfr CC17IC = 0xF162; sfr CC18 = 0xFE64; sfr CC18IC = 0xF164; sfr CC19 = 0xFE66; sfr CC19IC = 0xF166; sfr CC20 = 0xFE68; sfr CC20IC = 0xF168; sfr CC21 = 0xFE6A; sfr CC21IC = 0xF16A; sfr CC22 = 0xFE6C; sfr CC22IC = 0xF16C; sfr CC23 = 0xFE6E; sfr CC23IC = 0xF16E; sfr CC24 = 0xFE70; sfr CC24IC = 0xF170; sfr CC25 = 0xFE72; sfr CC25IC = 0xF172; sfr CC26 = 0xFE74; sfr CC26IC = 0xF174; sfr CC27 = 0xFE76; sfr CC27IC = 0xF176; sfr CC28 = 0xFE78; sfr CC28IC = 0xF178; sfr CC29 = 0xFE7A; sfr CC29IC = 0xF184; sfr CC30 = 0xFE7C; sfr CC30IC = 0xF18C; sfr CC31 = 0xFE7E; sfr CC31IC = 0xF194; sfr CCM0 = 0xFF52; sfr CCM1 = 0xFF54; sfr CCM2 = 0xFF56; sfr CCM3 = 0xFF58; sfr CCM4 = 0xFF22; sfr CCM5 = 0xFF24; sfr CCM6 = 0xFF26; sfr CCM7 = 0xFF28; sfr T0 = 0xFE50; sfr T01CON = 0xFF50; sfr T0IC = 0xFF9C; sfr T0REL = 0xFE54; sfr T1 = 0xFE52; sfr T1IC = 0xFF9E; sfr T1REL = 0xFE56; sfr T7 = 0xF050; sfr T78CON = 0xFF20; sfr T7IC = 0xF17A; sfr T7REL = 0xF054; sfr T8 = 0xF052; sfr T8IC = 0xF17C; sfr T8REL = 0xF056; sbit CC0IR = CC0IC^7; sbit CC0IE = CC0IC^6; sbit CC1IR = CC1IC^7; sbit CC1IE = CC1IC^6; sbit CC2IR = CC2IC^7; sbit CC2IE = CC2IC^6; sbit CC3IR = CC3IC^7; sbit CC3IE = CC3IC^6; sbit CC4IR = CC4IC^7; sbit CC4IE = CC4IC^6; sbit CC5IR = CC5IC^7; sbit CC5IE = CC5IC^6; sbit CC6IR = CC6IC^7; sbit CC6IE = CC6IC^6; sbit CC7IR = CC7IC^7; sbit CC7IE = CC7IC^6; sbit CC8IR = CC8IC^7; sbit CC8IE = CC8IC^6; sbit CC9IR = CC9IC^7; sbit CC9IE = CC9IC^6; sbit CC10IR = CC10IC^7; sbit CC10IE = CC10IC^6; sbit CC11IR = CC11IC^7; sbit CC11IE = CC11IC^6; sbit CC12IR = CC12IC^7; sbit CC12IE = CC12IC^6; sbit CC13IR = CC13IC^7; sbit CC13IE = CC13IC^6; sbit CC14IR = CC14IC^7; sbit CC14IE = CC14IC^6; sbit CC15IR = CC15IC^7; sbit CC15IE = CC15IC^6; sbit CC16IR = CC16IC^7; sbit CC16IE = CC16IC^6; sbit CC17IR = CC17IC^7; sbit CC17IE = CC17IC^6; sbit CC18IR = CC18IC^7; sbit CC18IE = CC18IC^6; sbit CC19IR = CC19IC^7; sbit CC19IE = CC19IC^6; sbit CC20IR = CC20IC^7; sbit CC20IE = CC20IC^6; sbit CC21IR = CC21IC^7; sbit CC21IE = CC21IC^6; sbit CC22IR = CC22IC^7; sbit CC22IE = CC22IC^6; sbit CC23IR = CC23IC^7; sbit CC23IE = CC23IC^6; sbit CC24IR = CC24IC^7; sbit CC24IE = CC24IC^6; sbit CC25IR = CC25IC^7; sbit CC25IE = CC25IC^6; sbit CC26IR = CC26IC^7; sbit CC26IE = CC26IC^6; sbit CC27IR = CC27IC^7; sbit CC27IE = CC27IC^6; sbit CC28IR = CC28IC^7; sbit CC28IE = CC28IC^6; sbit CC29IR = CC29IC^7; sbit CC29IE = CC29IC^6; sbit CC30IR = CC30IC^7; sbit CC30IE = CC30IC^6; sbit CC31IR = CC31IC^7; sbit CC31IE = CC31IC^6; sbit ACC0 = CCM0^3; sbit ACC1 = CCM0^7; sbit ACC2 = CCM0^11; sbit ACC3 = CCM0^15; sbit ACC4 = CCM1^3; sbit ACC5 = CCM1^7; sbit ACC6 = CCM1^11; sbit ACC7 = CCM1^15; sbit ACC8 = CCM2^3; sbit ACC9 = CCM2^7; sbit ACC10 = CCM2^11; sbit ACC11 = CCM2^15; sbit ACC12 = CCM3^3; sbit ACC13 = CCM3^7; sbit ACC14 = CCM3^11; sbit ACC15 = CCM3^15; sbit ACC16 = CCM4^3; sbit ACC17 = CCM4^7; sbit ACC18 = CCM4^11; sbit ACC19 = CCM4^15; sbit ACC20 = CCM5^3; sbit ACC21 = CCM5^7; sbit ACC22 = CCM5^11; sbit ACC23 = CCM5^15; sbit ACC24 = CCM6^3; sbit ACC25 = CCM6^7; sbit ACC26 = CCM6^11; sbit ACC27 = CCM6^15; sbit ACC28 = CCM7^3; sbit ACC29 = CCM7^7; sbit ACC30 = CCM7^11; sbit ACC31 = CCM7^15; sbit T0IE = T0IC^6; sbit T0IR = T0IC^7; sbit T0M = T01CON^3; sbit T0R = T01CON^6; sbit T1IE = T1IC^6; sbit T1IR = T1IC^7; sbit T1M = T01CON^11; sbit T1R = T01CON^14; sbit T7IE = T7IC^6; sbit T7IR = T7IC^7; sbit T7M = T78CON^3; sbit T7R = T78CON^6; sbit T8IE = T8IC^6; sbit T8IR = T8IC^7; sbit T8M = T78CON^11; sbit T8R = T78CON^14; sfr CP = 0xFE10; sfr CSP = 0xFE08; sfr DPP0 = 0xFE00; sfr DPP1 = 0xFE02; sfr DPP2 = 0xFE04; sfr DPP3 = 0xFE06; sfr MDC = 0xFF0E; sfr MDH = 0xFE0C; sfr MDL = 0xFE0E; sfr ONES = 0xFF1E; sfr PSW = 0xFF10; sfr SP = 0xFE12; sfr STKOV = 0xFE14; sfr STKUN = 0xFE16; sfr SYSCON = 0xFF12; sfr TFR = 0xFFAC; sfr ZEROS = 0xFF1C; sfr BUSCON0 = 0xFF0C; sfr BUSCON1 = 0xFF14; sfr BUSCON2 = 0xFF16; sfr BUSCON3 = 0xFF18; sfr BUSCON4 = 0xFF1A; sfr ADDRSEL1 = 0xFE18; sfr ADDRSEL2 = 0xFE1A; sfr ADDRSEL3 = 0xFE1C; sfr ADDRSEL4 = 0xFE1E; sbit WRCFG = SYSCON^7; sbit CLKEN = SYSCON^8; sbit BYTDIS = SYSCON^9; sbit ROMEN = SYSCON^10; sbit SGTEN = SYSCON^11; sbit ROMS1 = SYSCON^12; sbit MDRIU = MDC^4; sbit N = PSW^0; sbit C = PSW^1; sbit V = PSW^2; sbit Z = PSW^3; sbit E = PSW^4; sbit MULIP = PSW^5; sbit USR0 = PSW^6; sbit HLDEN = PSW^10; sbit IEN = PSW^11; sbit RWDC0 = BUSCON0^4; sbit MTTC0 = BUSCON0^5; sbit ALECTL0 = BUSCON0^9; sbit BUSACT0 = BUSCON0^10; sbit RDYEN0 = BUSCON0^12; sbit RWDC1 = BUSCON1^4; sbit MTTC1 = BUSCON1^5; sbit ALECTL1 = BUSCON1^9; sbit BUSACT1 = BUSCON1^10; sbit RDYEN1 = BUSCON1^12; sbit CSREN1 = BUSCON1^14; sbit CSWEN1 = BUSCON1^15; sbit RWDC2 = BUSCON2^4; sbit MTTC2 = BUSCON2^5; sbit ALECTL2 = BUSCON2^9; sbit BUSACT2 = BUSCON2^10; sbit RDYEN2 = BUSCON2^12; sbit CSREN2 = BUSCON2^14; sbit CSWEN2 = BUSCON2^15; sbit RWDC3 = BUSCON3^4; sbit MTTC3 = BUSCON3^5; sbit ALECTL3 = BUSCON3^9; sbit BUSACT3 = BUSCON3^10; sbit RDYEN3 = BUSCON3^12; sbit CSREN3 = BUSCON3^14; sbit CSWEN3 = BUSCON3^15; sbit RWDC4 = BUSCON4^4; sbit MTTC4 = BUSCON4^5; sbit ALECTL4 = BUSCON4^9; sbit BUSACT4 = BUSCON4^10; sbit RDYEN4 = BUSCON4^12; sbit CSREN4 = BUSCON4^14; sbit CSWEN4 = BUSCON4^15; sbit ILLBUS = TFR^0; sbit ILLINA = TFR^1; sbit ILLOPA = TFR^2; sbit PRTFLT = TFR^3; sbit UNDOPC = TFR^7; sbit STKUF = TFR^13; sbit STKOF = TFR^14; sbit NMI = TFR^15; sfr EXICON = 0xF1C0; sfr ISNC = 0xF1DE; sbit RTCIE = ISNC^0; sbit RTCIR = ISNC^1; sbit PLLIE = ISNC^2; sbit PLLIR = ISNC^3; sfr PECC0 = 0xFEC0; sfr PECC1 = 0xFEC2; sfr PECC2 = 0xFEC4; sfr PECC3 = 0xFEC6; sfr PECC4 = 0xFEC8; sfr PECC5 = 0xFECA; sfr PECC6 = 0xFECC; sfr PECC7 = 0xFECE; sfr DP0L = 0xF100; sfr DP0H = 0xF102; sfr DP1L = 0xF104; sfr DP1H = 0xF106; sfr DP2 = 0xFFC2; sfr DP3 = 0xFFC6; sfr DP4 = 0xFFCA; sfr DP6 = 0xFFCE; sfr DP7 = 0xFFD2; sfr DP8 = 0xFFD6; sfr P0L = 0xFF00; sfr P0H = 0xFF02; sfr P1L = 0xFF04; sfr P1H = 0xFF06; sfr P2 = 0xFFC0; sfr P3 = 0xFFC4; sfr P4 = 0xFFC8; sfr P5 = 0xFFA2; sfr P6 = 0xFFCC; sfr P7 = 0xFFD0; sfr P8 = 0xFFD4; sfr ODP2 = 0xF1C2; sfr ODP3 = 0xF1C6; sfr ODP6 = 0xF1CE; sfr ODP7 = 0xF1D2; sfr ODP8 = 0xF1D6; sfr RP0H = 0xF108; sfr S0BG = 0xFEB4; sfr S0CON = 0xFFB0; sfr S0EIC = 0xFF70; sfr S0RBUF = 0xFEB2; sfr S0RIC = 0xFF6E; sfr S0TBUF = 0xFEB0; sfr S0TIC = 0xFF6C; sfr S0TBIC = 0xF19C; sbit S0STP = S0CON^3; sbit S0REN = S0CON^4; sbit S0PEN = S0CON^5; sbit S0FEN = S0CON^6; sbit S0OEN = S0CON^7; sbit S0PE = S0CON^8; sbit S0FE = S0CON^9; sbit S0OE = S0CON^10; sbit S0ODD = S0CON^12; sbit S0BRS = S0CON^13; sbit S0LB = S0CON^14; sbit S0R = S0CON^15; sbit S0TIE = S0TIC^6; sbit S0TIR = S0TIC^7; sbit S0TBIE = S0TBIC^6; sbit S0TBIR = S0TBIC^7; sbit S0RIE = S0RIC^6; sbit S0RIR = S0RIC^7; sbit S0EIE = S0EIC^6; sbit S0EIR = S0EIC^7; sfr SSCTIC = 0xFF72; sfr SSCRIC = 0xFF74; sfr SSCEIC = 0xFF76; sfr SSCTB = 0xF0B0; sfr SSCRB = 0xF0B2; sfr SSCBR = 0xF0B4; sfr SSCCON = 0xFFB2; sbit SSCHB = SSCCON^4; sbit SSCPH = SSCCON^5; sbit SSCPO = SSCCON^6; sbit SSCTE = SSCCON^8; sbit SSCTEN = SSCCON^8; sbit SSCRE = SSCCON^9; sbit SSCREN = SSCCON^9; sbit SSCPE = SSCCON^10; sbit SSCPEN = SSCCON^10; sbit SSCBE = SSCCON^11; sbit SSCBEN = SSCCON^11; sbit SSCBSY = SSCCON^12; sbit SSCMS = SSCCON^14; sbit SSCEN = SSCCON^15; sbit SSCTIR = SSCTIC^7; sbit SSCTIE = SSCTIC^6; sbit SSCRIR = SSCRIC^7; sbit SSCRIE = SSCRIC^6; sbit SSCEIR = SSCEIC^7; sbit SSCEIE = SSCEIC^6; sfr CAPREL = 0xFE4A; sfr CRIC = 0xFF6A; sfr T2 = 0xFE40; sfr T2CON = 0xFF40; sfr T2IC = 0xFF60; sfr T3 = 0xFE42; sfr T3CON = 0xFF42; sfr T3IC = 0xFF62; sfr T4 = 0xFE44; sfr T4CON = 0xFF44; sfr T4IC = 0xFF64; sfr T5 = 0xFE46; sfr T5CON = 0xFF46; sfr T5IC = 0xFF66; sfr T6 = 0xFE48; sfr T6CON = 0xFF48; sfr T6IC = 0xFF68; sfr WDT = 0xFEAE; sfr WDTCON = 0xFFAE; sbit CRIE = CRIC^6; sbit CRIR = CRIC^7; sbit T2R = T2CON^6; sbit T2UD = T2CON^7; sbit T2UDE = T2CON^8; sbit T2IE = T2IC^6; sbit T2IR = T2IC^7; sbit T3R = T3CON^6; sbit T3UD = T3CON^7; sbit T3UDE = T3CON^8; sbit T3OE = T3CON^9; sbit T3OTL = T3CON^10; sbit T3IE = T3IC^6; sbit T3IR = T3IC^7; sbit T4R = T4CON^6; sbit T4UD = T4CON^7; sbit T4UDE = T4CON^8; sbit T4IE = T4IC^6; sbit T4IR = T4IC^7; sbit T5R = T5CON^6; sbit T5UD = T5CON^7; sbit T5UDE = T5CON^8; sbit T5CLR = T5CON^14; sbit T5SC = T5CON^15; sbit T5IE = T5IC^6; sbit T5IR = T5IC^7; sbit T6R = T6CON^6; sbit T6UD = T6CON^7; sbit T6UDE = T6CON^8; sbit T6OE = T6CON^9; sbit T6OTL = T6CON^10; sbit T6SR = T6CON^15; sbit T6IE = T6IC^6; sbit T6IR = T6IC^7; sbit T0IN = P3^0; sbit T2IN = P3^7; sbit T3IN = P3^6; sbit T4IN = P3^5; sbit T5IN = P5^13; sbit T6IN = P5^12; sbit T2EUD = P5^15; sbit T3EUD = P3^4; sbit T4EUD = P5^14; sbit T5EUD = P5^11; sbit T6EUD = P5^10; sbit T3OUT = P3^3; sbit CAPIN = P3^2; sbit T6OUT = P3^1; sbit WDTIN = WDTCON^0; sbit WDTR = WDTCON^1; sfr PWMCON0 = 0xFF30; sfr PWMCON1 = 0xFF32; sfr PW0 = 0xFE30; sfr PW1 = 0xFE32; sfr PW2 = 0xFE34; sfr PW3 = 0xFE36; sfr PWMIC = 0xF17E; sfr PT0 = 0xF030; sfr PT1 = 0xF032; sfr PT2 = 0xF034; sfr PT3 = 0xF036; sfr PP0 = 0xF038; sfr PP1 = 0xF03A; sfr PP2 = 0xF03C; sfr PP3 = 0xF03E; sbit PTR0 = PWMCON0^0; sbit PTR1 = PWMCON0^1; sbit PTR2 = PWMCON0^2; sbit PTR3 = PWMCON0^3; sbit PTI0 = PWMCON0^4; sbit PTI1 = PWMCON0^5; sbit PTI2 = PWMCON0^6; sbit PTI3 = PWMCON0^7; sbit PIE0 = PWMCON0^8; sbit PIE1 = PWMCON0^9; sbit PIE2 = PWMCON0^10; sbit PIE3 = PWMCON0^11; sbit PIR0 = PWMCON0^12; sbit PIR1 = PWMCON0^13; sbit PIR2 = PWMCON0^14; sbit PIR3 = PWMCON0^15; sbit PEN0 = PWMCON1^0; sbit PEN1 = PWMCON1^1; sbit PEN2 = PWMCON1^2; sbit PEN3 = PWMCON1^3; sbit PM0 = PWMCON1^4; sbit PM1 = PWMCON1^5; sbit PM2 = PWMCON1^6; sbit PM3 = PWMCON1^7; sbit PB01 = PWMCON1^12; sbit PS2 = PWMCON1^14; sbit PS3 = PWMCON1^15; sbit PWMIR = PWMIC^7; sbit PWMIE = PWMIC^6; sfr XP0IC = 0xF186; sfr XP1IC = 0xF18E; sfr XP2IC = 0xF196; sfr XP3IC = 0xF19E; sbit XP0IR = XP0IC^7; sbit XP0IE = XP0IC^6; sbit XP1IR = XP1IC^7; sbit XP1IE = XP1IC^6; sbit XP2IR = XP2IC^7; sbit XP2IE = XP2IC^6; sbit XP3IR = XP3IC^7; sbit XP3IE = XP3IC^6; #line 8 "util.h" sbit TxD = P3^10; sbit DTxD = DP3^10; sbit DRxD = DP3^11; extern void init_serial( unsigned int baud ); extern void wait_100mues(unsigned char Multiplikator); extern void wait_10ms(unsigned char Multiplikator); extern void init_lcd(void); extern void lcd_off(void); extern void lcd_on(unsigned char n); extern void lcd_clear(void); extern void lcd_setcursor(unsigned char z, unsigned char s); extern void lcd_putchar(unsigned char zeichen); extern void lcd_puts(unsigned char z, unsigned char s, char *a); extern unsigned char testkey( void ); extern unsigned char readkey( void ); extern void setDaysOfMonth( int month, int year ); #line 14 "int.h" #line 1 "astro.h" #line 1 "C:\C166\INC\REG167.H" sfr ADCIC = 0xFF98; sfr ADCON = 0xFFA0; sfr ADDAT = 0xFEA0; sfr ADEIC = 0xFF9A; sfr ADDAT2 = 0xF0A0; sbit ADST = ADCON^7; sbit ADBSY = ADCON^8; sbit ADWR = ADCON^9; sbit ADCIN = ADCON^10; sbit ADCRQ = ADCON^11; sbit ADCIE = ADCIC^6; sbit ADCIR = ADCIC^7; sbit ADEIE = ADEIC^6; sbit ADEIR = ADEIC^7; sfr CC0 = 0xFE80; sfr CC0IC = 0xFF78; sfr CC1 = 0xFE82; sfr CC1IC = 0xFF7A; sfr CC2 = 0xFE84; sfr CC2IC = 0xFF7C; sfr CC3 = 0xFE86; sfr CC3IC = 0xFF7E; sfr CC4 = 0xFE88; sfr CC4IC = 0xFF80; sfr CC5 = 0xFE8A; sfr CC5IC = 0xFF82; sfr CC6 = 0xFE8C; sfr CC6IC = 0xFF84; sfr CC7 = 0xFE8E; sfr CC7IC = 0xFF86; sfr CC8 = 0xFE90; sfr CC8IC = 0xFF88; sfr CC9 = 0xFE92; sfr CC9IC = 0xFF8A; sfr CC10 = 0xFE94; sfr CC10IC = 0xFF8C; sfr CC11 = 0xFE96; sfr CC11IC = 0xFF8E; sfr CC12 = 0xFE98; sfr CC12IC = 0xFF90; sfr CC13 = 0xFE9A; sfr CC13IC = 0xFF92; sfr CC14 = 0xFE9C; sfr CC14IC = 0xFF94; sfr CC15 = 0xFE9E; sfr CC15IC = 0xFF96; sfr CC16 = 0xFE60; sfr CC16IC = 0xF160; sfr CC17 = 0xFE62; sfr CC17IC = 0xF162; sfr CC18 = 0xFE64; sfr CC18IC = 0xF164; sfr CC19 = 0xFE66; sfr CC19IC = 0xF166; sfr CC20 = 0xFE68; sfr CC20IC = 0xF168; sfr CC21 = 0xFE6A; sfr CC21IC = 0xF16A; sfr CC22 = 0xFE6C; sfr CC22IC = 0xF16C; sfr CC23 = 0xFE6E; sfr CC23IC = 0xF16E; sfr CC24 = 0xFE70; sfr CC24IC = 0xF170; sfr CC25 = 0xFE72; sfr CC25IC = 0xF172; sfr CC26 = 0xFE74; sfr CC26IC = 0xF174; sfr CC27 = 0xFE76; sfr CC27IC = 0xF176; sfr CC28 = 0xFE78; sfr CC28IC = 0xF178; sfr CC29 = 0xFE7A; sfr CC29IC = 0xF184; sfr CC30 = 0xFE7C; sfr CC30IC = 0xF18C; sfr CC31 = 0xFE7E; sfr CC31IC = 0xF194; sfr CCM0 = 0xFF52; sfr CCM1 = 0xFF54; sfr CCM2 = 0xFF56; sfr CCM3 = 0xFF58; sfr CCM4 = 0xFF22; sfr CCM5 = 0xFF24; sfr CCM6 = 0xFF26; sfr CCM7 = 0xFF28; sfr T0 = 0xFE50; sfr T01CON = 0xFF50; sfr T0IC = 0xFF9C; sfr T0REL = 0xFE54; sfr T1 = 0xFE52; sfr T1IC = 0xFF9E; sfr T1REL = 0xFE56; sfr T7 = 0xF050; sfr T78CON = 0xFF20; sfr T7IC = 0xF17A; sfr T7REL = 0xF054; sfr T8 = 0xF052; sfr T8IC = 0xF17C; sfr T8REL = 0xF056; sbit CC0IR = CC0IC^7; sbit CC0IE = CC0IC^6; sbit CC1IR = CC1IC^7; sbit CC1IE = CC1IC^6; sbit CC2IR = CC2IC^7; sbit CC2IE = CC2IC^6; sbit CC3IR = CC3IC^7; sbit CC3IE = CC3IC^6; sbit CC4IR = CC4IC^7; sbit CC4IE = CC4IC^6; sbit CC5IR = CC5IC^7; sbit CC5IE = CC5IC^6; sbit CC6IR = CC6IC^7; sbit CC6IE = CC6IC^6; sbit CC7IR = CC7IC^7; sbit CC7IE = CC7IC^6; sbit CC8IR = CC8IC^7; sbit CC8IE = CC8IC^6; sbit CC9IR = CC9IC^7; sbit CC9IE = CC9IC^6; sbit CC10IR = CC10IC^7; sbit CC10IE = CC10IC^6; sbit CC11IR = CC11IC^7; sbit CC11IE = CC11IC^6; sbit CC12IR = CC12IC^7; sbit CC12IE = CC12IC^6; sbit CC13IR = CC13IC^7; sbit CC13IE = CC13IC^6; sbit CC14IR = CC14IC^7; sbit CC14IE = CC14IC^6; sbit CC15IR = CC15IC^7; sbit CC15IE = CC15IC^6; sbit CC16IR = CC16IC^7; sbit CC16IE = CC16IC^6; sbit CC17IR = CC17IC^7; sbit CC17IE = CC17IC^6; sbit CC18IR = CC18IC^7; sbit CC18IE = CC18IC^6; sbit CC19IR = CC19IC^7; sbit CC19IE = CC19IC^6; sbit CC20IR = CC20IC^7; sbit CC20IE = CC20IC^6; sbit CC21IR = CC21IC^7; sbit CC21IE = CC21IC^6; sbit CC22IR = CC22IC^7; sbit CC22IE = CC22IC^6; sbit CC23IR = CC23IC^7; sbit CC23IE = CC23IC^6; sbit CC24IR = CC24IC^7; sbit CC24IE = CC24IC^6; sbit CC25IR = CC25IC^7; sbit CC25IE = CC25IC^6; sbit CC26IR = CC26IC^7; sbit CC26IE = CC26IC^6; sbit CC27IR = CC27IC^7; sbit CC27IE = CC27IC^6; sbit CC28IR = CC28IC^7; sbit CC28IE = CC28IC^6; sbit CC29IR = CC29IC^7; sbit CC29IE = CC29IC^6; sbit CC30IR = CC30IC^7; sbit CC30IE = CC30IC^6; sbit CC31IR = CC31IC^7; sbit CC31IE = CC31IC^6; sbit ACC0 = CCM0^3; sbit ACC1 = CCM0^7; sbit ACC2 = CCM0^11; sbit ACC3 = CCM0^15; sbit ACC4 = CCM1^3; sbit ACC5 = CCM1^7; sbit ACC6 = CCM1^11; sbit ACC7 = CCM1^15; sbit ACC8 = CCM2^3; sbit ACC9 = CCM2^7; sbit ACC10 = CCM2^11; sbit ACC11 = CCM2^15; sbit ACC12 = CCM3^3; sbit ACC13 = CCM3^7; sbit ACC14 = CCM3^11; sbit ACC15 = CCM3^15; sbit ACC16 = CCM4^3; sbit ACC17 = CCM4^7; sbit ACC18 = CCM4^11; sbit ACC19 = CCM4^15; sbit ACC20 = CCM5^3; sbit ACC21 = CCM5^7; sbit ACC22 = CCM5^11; sbit ACC23 = CCM5^15; sbit ACC24 = CCM6^3; sbit ACC25 = CCM6^7; sbit ACC26 = CCM6^11; sbit ACC27 = CCM6^15; sbit ACC28 = CCM7^3; sbit ACC29 = CCM7^7; sbit ACC30 = CCM7^11; sbit ACC31 = CCM7^15; sbit T0IE = T0IC^6; sbit T0IR = T0IC^7; sbit T0M = T01CON^3; sbit T0R = T01CON^6; sbit T1IE = T1IC^6; sbit T1IR = T1IC^7; sbit T1M = T01CON^11; sbit T1R = T01CON^14; sbit T7IE = T7IC^6; sbit T7IR = T7IC^7; sbit T7M = T78CON^3; sbit T7R = T78CON^6; sbit T8IE = T8IC^6; sbit T8IR = T8IC^7; sbit T8M = T78CON^11; sbit T8R = T78CON^14; sfr CP = 0xFE10; sfr CSP = 0xFE08; sfr DPP0 = 0xFE00; sfr DPP1 = 0xFE02; sfr DPP2 = 0xFE04; sfr DPP3 = 0xFE06; sfr MDC = 0xFF0E; sfr MDH = 0xFE0C; sfr MDL = 0xFE0E; sfr ONES = 0xFF1E; sfr PSW = 0xFF10; sfr SP = 0xFE12; sfr STKOV = 0xFE14; sfr STKUN = 0xFE16; sfr SYSCON = 0xFF12; sfr TFR = 0xFFAC; sfr ZEROS = 0xFF1C; sfr BUSCON0 = 0xFF0C; sfr BUSCON1 = 0xFF14; sfr BUSCON2 = 0xFF16; sfr BUSCON3 = 0xFF18; sfr BUSCON4 = 0xFF1A; sfr ADDRSEL1 = 0xFE18; sfr ADDRSEL2 = 0xFE1A; sfr ADDRSEL3 = 0xFE1C; sfr ADDRSEL4 = 0xFE1E; sbit WRCFG = SYSCON^7; sbit CLKEN = SYSCON^8; sbit BYTDIS = SYSCON^9; sbit ROMEN = SYSCON^10; sbit SGTEN = SYSCON^11; sbit ROMS1 = SYSCON^12; sbit MDRIU = MDC^4; sbit N = PSW^0; sbit C = PSW^1; sbit V = PSW^2; sbit Z = PSW^3; sbit E = PSW^4; sbit MULIP = PSW^5; sbit USR0 = PSW^6; sbit HLDEN = PSW^10; sbit IEN = PSW^11; sbit RWDC0 = BUSCON0^4; sbit MTTC0 = BUSCON0^5; sbit ALECTL0 = BUSCON0^9; sbit BUSACT0 = BUSCON0^10; sbit RDYEN0 = BUSCON0^12; sbit RWDC1 = BUSCON1^4; sbit MTTC1 = BUSCON1^5; sbit ALECTL1 = BUSCON1^9; sbit BUSACT1 = BUSCON1^10; sbit RDYEN1 = BUSCON1^12; sbit CSREN1 = BUSCON1^14; sbit CSWEN1 = BUSCON1^15; sbit RWDC2 = BUSCON2^4; sbit MTTC2 = BUSCON2^5; sbit ALECTL2 = BUSCON2^9; sbit BUSACT2 = BUSCON2^10; sbit RDYEN2 = BUSCON2^12; sbit CSREN2 = BUSCON2^14; sbit CSWEN2 = BUSCON2^15; sbit RWDC3 = BUSCON3^4; sbit MTTC3 = BUSCON3^5; sbit ALECTL3 = BUSCON3^9; sbit BUSACT3 = BUSCON3^10; sbit RDYEN3 = BUSCON3^12; sbit CSREN3 = BUSCON3^14; sbit CSWEN3 = BUSCON3^15; sbit RWDC4 = BUSCON4^4; sbit MTTC4 = BUSCON4^5; sbit ALECTL4 = BUSCON4^9; sbit BUSACT4 = BUSCON4^10; sbit RDYEN4 = BUSCON4^12; sbit CSREN4 = BUSCON4^14; sbit CSWEN4 = BUSCON4^15; sbit ILLBUS = TFR^0; sbit ILLINA = TFR^1; sbit ILLOPA = TFR^2; sbit PRTFLT = TFR^3; sbit UNDOPC = TFR^7; sbit STKUF = TFR^13; sbit STKOF = TFR^14; sbit NMI = TFR^15; sfr EXICON = 0xF1C0; sfr ISNC = 0xF1DE; sbit RTCIE = ISNC^0; sbit RTCIR = ISNC^1; sbit PLLIE = ISNC^2; sbit PLLIR = ISNC^3; sfr PECC0 = 0xFEC0; sfr PECC1 = 0xFEC2; sfr PECC2 = 0xFEC4; sfr PECC3 = 0xFEC6; sfr PECC4 = 0xFEC8; sfr PECC5 = 0xFECA; sfr PECC6 = 0xFECC; sfr PECC7 = 0xFECE; sfr DP0L = 0xF100; sfr DP0H = 0xF102; sfr DP1L = 0xF104; sfr DP1H = 0xF106; sfr DP2 = 0xFFC2; sfr DP3 = 0xFFC6; sfr DP4 = 0xFFCA; sfr DP6 = 0xFFCE; sfr DP7 = 0xFFD2; sfr DP8 = 0xFFD6; sfr P0L = 0xFF00; sfr P0H = 0xFF02; sfr P1L = 0xFF04; sfr P1H = 0xFF06; sfr P2 = 0xFFC0; sfr P3 = 0xFFC4; sfr P4 = 0xFFC8; sfr P5 = 0xFFA2; sfr P6 = 0xFFCC; sfr P7 = 0xFFD0; sfr P8 = 0xFFD4; sfr ODP2 = 0xF1C2; sfr ODP3 = 0xF1C6; sfr ODP6 = 0xF1CE; sfr ODP7 = 0xF1D2; sfr ODP8 = 0xF1D6; sfr RP0H = 0xF108; sfr S0BG = 0xFEB4; sfr S0CON = 0xFFB0; sfr S0EIC = 0xFF70; sfr S0RBUF = 0xFEB2; sfr S0RIC = 0xFF6E; sfr S0TBUF = 0xFEB0; sfr S0TIC = 0xFF6C; sfr S0TBIC = 0xF19C; sbit S0STP = S0CON^3; sbit S0REN = S0CON^4; sbit S0PEN = S0CON^5; sbit S0FEN = S0CON^6; sbit S0OEN = S0CON^7; sbit S0PE = S0CON^8; sbit S0FE = S0CON^9; sbit S0OE = S0CON^10; sbit S0ODD = S0CON^12; sbit S0BRS = S0CON^13; sbit S0LB = S0CON^14; sbit S0R = S0CON^15; sbit S0TIE = S0TIC^6; sbit S0TIR = S0TIC^7; sbit S0TBIE = S0TBIC^6; sbit S0TBIR = S0TBIC^7; sbit S0RIE = S0RIC^6; sbit S0RIR = S0RIC^7; sbit S0EIE = S0EIC^6; sbit S0EIR = S0EIC^7; sfr SSCTIC = 0xFF72; sfr SSCRIC = 0xFF74; sfr SSCEIC = 0xFF76; sfr SSCTB = 0xF0B0; sfr SSCRB = 0xF0B2; sfr SSCBR = 0xF0B4; sfr SSCCON = 0xFFB2; sbit SSCHB = SSCCON^4; sbit SSCPH = SSCCON^5; sbit SSCPO = SSCCON^6; sbit SSCTE = SSCCON^8; sbit SSCTEN = SSCCON^8; sbit SSCRE = SSCCON^9; sbit SSCREN = SSCCON^9; sbit SSCPE = SSCCON^10; sbit SSCPEN = SSCCON^10; sbit SSCBE = SSCCON^11; sbit SSCBEN = SSCCON^11; sbit SSCBSY = SSCCON^12; sbit SSCMS = SSCCON^14; sbit SSCEN = SSCCON^15; sbit SSCTIR = SSCTIC^7; sbit SSCTIE = SSCTIC^6; sbit SSCRIR = SSCRIC^7; sbit SSCRIE = SSCRIC^6; sbit SSCEIR = SSCEIC^7; sbit SSCEIE = SSCEIC^6; sfr CAPREL = 0xFE4A; sfr CRIC = 0xFF6A; sfr T2 = 0xFE40; sfr T2CON = 0xFF40; sfr T2IC = 0xFF60; sfr T3 = 0xFE42; sfr T3CON = 0xFF42; sfr T3IC = 0xFF62; sfr T4 = 0xFE44; sfr T4CON = 0xFF44; sfr T4IC = 0xFF64; sfr T5 = 0xFE46; sfr T5CON = 0xFF46; sfr T5IC = 0xFF66; sfr T6 = 0xFE48; sfr T6CON = 0xFF48; sfr T6IC = 0xFF68; sfr WDT = 0xFEAE; sfr WDTCON = 0xFFAE; sbit CRIE = CRIC^6; sbit CRIR = CRIC^7; sbit T2R = T2CON^6; sbit T2UD = T2CON^7; sbit T2UDE = T2CON^8; sbit T2IE = T2IC^6; sbit T2IR = T2IC^7; sbit T3R = T3CON^6; sbit T3UD = T3CON^7; sbit T3UDE = T3CON^8; sbit T3OE = T3CON^9; sbit T3OTL = T3CON^10; sbit T3IE = T3IC^6; sbit T3IR = T3IC^7; sbit T4R = T4CON^6; sbit T4UD = T4CON^7; sbit T4UDE = T4CON^8; sbit T4IE = T4IC^6; sbit T4IR = T4IC^7; sbit T5R = T5CON^6; sbit T5UD = T5CON^7; sbit T5UDE = T5CON^8; sbit T5CLR = T5CON^14; sbit T5SC = T5CON^15; sbit T5IE = T5IC^6; sbit T5IR = T5IC^7; sbit T6R = T6CON^6; sbit T6UD = T6CON^7; sbit T6UDE = T6CON^8; sbit T6OE = T6CON^9; sbit T6OTL = T6CON^10; sbit T6SR = T6CON^15; sbit T6IE = T6IC^6; sbit T6IR = T6IC^7; sbit T0IN = P3^0; sbit T2IN = P3^7; sbit T3IN = P3^6; sbit T4IN = P3^5; sbit T5IN = P5^13; sbit T6IN = P5^12; sbit T2EUD = P5^15; sbit T3EUD = P3^4; sbit T4EUD = P5^14; sbit T5EUD = P5^11; sbit T6EUD = P5^10; sbit T3OUT = P3^3; sbit CAPIN = P3^2; sbit T6OUT = P3^1; sbit WDTIN = WDTCON^0; sbit WDTR = WDTCON^1; sfr PWMCON0 = 0xFF30; sfr PWMCON1 = 0xFF32; sfr PW0 = 0xFE30; sfr PW1 = 0xFE32; sfr PW2 = 0xFE34; sfr PW3 = 0xFE36; sfr PWMIC = 0xF17E; sfr PT0 = 0xF030; sfr PT1 = 0xF032; sfr PT2 = 0xF034; sfr PT3 = 0xF036; sfr PP0 = 0xF038; sfr PP1 = 0xF03A; sfr PP2 = 0xF03C; sfr PP3 = 0xF03E; sbit PTR0 = PWMCON0^0; sbit PTR1 = PWMCON0^1; sbit PTR2 = PWMCON0^2; sbit PTR3 = PWMCON0^3; sbit PTI0 = PWMCON0^4; sbit PTI1 = PWMCON0^5; sbit PTI2 = PWMCON0^6; sbit PTI3 = PWMCON0^7; sbit PIE0 = PWMCON0^8; sbit PIE1 = PWMCON0^9; sbit PIE2 = PWMCON0^10; sbit PIE3 = PWMCON0^11; sbit PIR0 = PWMCON0^12; sbit PIR1 = PWMCON0^13; sbit PIR2 = PWMCON0^14; sbit PIR3 = PWMCON0^15; sbit PEN0 = PWMCON1^0; sbit PEN1 = PWMCON1^1; sbit PEN2 = PWMCON1^2; sbit PEN3 = PWMCON1^3; sbit PM0 = PWMCON1^4; sbit PM1 = PWMCON1^5; sbit PM2 = PWMCON1^6; sbit PM3 = PWMCON1^7; sbit PB01 = PWMCON1^12; sbit PS2 = PWMCON1^14; sbit PS3 = PWMCON1^15; sbit PWMIR = PWMIC^7; sbit PWMIE = PWMIC^6; sfr XP0IC = 0xF186; sfr XP1IC = 0xF18E; sfr XP2IC = 0xF196; sfr XP3IC = 0xF19E; sbit XP0IR = XP0IC^7; sbit XP0IE = XP0IC^6; sbit XP1IR = XP1IC^7; sbit XP1IE = XP1IC^6; sbit XP2IR = XP2IC^7; sbit XP2IE = XP2IC^6; sbit XP3IR = XP3IC^7; sbit XP3IE = XP3IC^6; #line 5 "astro.h" #line 1 "C:\C166\INC\STDARG.H" #line 10 "C:\C166\INC\STDARG.H" #line 6 "astro.h" #line 6 "astro.h" #line 1 "C:\C166\INC\STDLIB.H" #line 10 "C:\C166\INC\STDLIB.H" #line 12 "C:\C166\INC\STDLIB.H" #line 14 "C:\C166\INC\STDLIB.H" #line 17 "C:\C166\INC\STDLIB.H" #line 19 "C:\C166\INC\STDLIB.H" #line 22 "C:\C166\INC\STDLIB.H" #line 24 "C:\C166\INC\STDLIB.H" #line 26 "C:\C166\INC\STDLIB.H" extern int abs (int val); extern long labs (long val); extern double atof (void *s1); extern long atol (void *s1); extern int atoi (void *s1); extern int rand (void); extern void srand (unsigned int); #line 38 "C:\C166\INC\STDLIB.H" #line 44 "C:\C166\INC\STDLIB.H" extern void far *malloc (size_t size); extern void free (void far *p); extern void init_mempool (void far *p, size_t size); extern void far *realloc (void far *p, size_t size); extern void far *calloc (size_t size, size_t len); extern void xhuge *xmalloc (unsigned long size); extern void xhuge *xcalloc (unsigned long size, unsigned long len); extern void xhuge *xrealloc (void xhuge *p, unsigned long size); extern void xinit_mempool (void xhuge *p, unsigned long size); extern void xfree (void xhuge *p); #line 7 "astro.h" #line 1 "C:\C166\INC\STDIO.H" #line 10 "C:\C166\INC\STDIO.H" #line 8 "astro.h" #line 8 "astro.h" #line 1 "C:\C166\INC\STRING.H" #line 10 "C:\C166\INC\STRING.H" #line 13 "C:\C166\INC\STRING.H" #line 15 "C:\C166\INC\STRING.H" #line 17 "C:\C166\INC\STRING.H" extern char *strcat (char *s1, char *s2); extern char *strncat (char *s1, char *s2, unsigned int n); extern int strcmp (char *s1, char *s2); extern int strncmp (char *s1, char *s2, unsigned int n); extern char *strcpy (char *s1, char *s2); extern char *strncpy (char *s1, char *s2, unsigned int n); extern size_t strlen (char *); extern char *strchr (char *s, char c); extern int strpos (char *s, char c); extern char *strrchr (char *s, char c); extern int strrpos (char *s, char c); extern int strspn (char *s, char *set); extern int strcspn (char *s, char *set); extern char *strpbrk (char *s, char *set); extern char *strrpbrk(char *s, char *set); extern int memcmp (void *s1, void *s2, unsigned int n); extern void *memcpy (void *s1, void *s2, unsigned int n); extern void *memchr (void *s, char val, unsigned int n); extern void *memccpy (void *s1, void *s2, char val, unsigned int n); extern void *memmove (void *s1, void *s2, unsigned int n); extern void *memset (void *s, char val, unsigned int n); extern char far *fstrcat (char far *s1, char far *s2); extern char far *fstrncat (char far *s1, char far *s2, unsigned int n); extern int fstrcmp (char far *s1, char far *s2); extern int fstrncmp (char far *s1, char far *s2, unsigned int n); extern char *fstrcpy (char far *s1, char far *s2); extern char *fstrncpy (char far *s1, char far *s2, unsigned int n); extern size_t fstrlen (char far *); extern char far *fstrchr (const char far *s, char c); extern char far *fstrrchr (const char far *s, char c); extern int fstrpos (const char far *s, char c); extern int fstrrpos (const char far *s, char c); extern int fstrspn (char far *s, char far *set); extern int fstrcspn (char far *s, char far *set); extern char *fstrpbrk (char far *s, char far *set); extern char *fstrrpbrk (char far *s, char far *set); extern int fmemcmp (void far *s1, void far *s2, unsigned int n); extern void far *fmemcpy (void far *s1, void far *s2, unsigned int n); extern void far *fmemchr (void far *s, char val, unsigned int n); extern void far *fmemccpy (void far *s1, void far *s2, char val, unsigned int n); extern void far *fmemmove (void far *s1, void far *s2, unsigned int n); extern void far *fmemset (void far *s, char val, unsigned int n); extern int xmemcmp (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemcpy (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemchr (void xhuge *s, char val, unsigned long n); extern void xhuge *xmemccpy (void xhuge *s1, void xhuge *s2, char val, unsigned long n); extern void xhuge *xmemmove (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemset (void xhuge *s, char val, unsigned long n); #line 9 "astro.h" #line 1 "C:\C166\INC\MATH.H" extern int abs (int val); extern long labs (long val); extern double fabs (double val); extern double sqrt (double val); extern double exp (double val); extern double log (double val); extern double log10 (double val); extern double sin (double val); extern double cos (double val); extern double tan (double val); extern double asin (double val); extern double acos (double val); extern double atan (double val); extern double sinh (double val); extern double cosh (double val); extern double tanh (double val); extern double atan2 (double y, double x); extern double ceil (double val); extern double floor (double val); extern double modf (double val, double *n); extern double pow (double x, double y); extern unsigned int _chkfloat_ (float x); extern unsigned int _chkdouble_ (double x); #line 10 "astro.h" #line 1 "global.h" #line 5 "global.h" #line 204 "global.h" #line 11 "astro.h" extern void cCurrentStarTime( void ); extern void cAzAlt( void ); extern void cRaDec( void ); extern long dHourslArc10( double val ); extern long dDegreeslArc10( double val ); extern double lArc10dHours( long val ); extern double lArc10dDegrees( long val ); extern int arc10Sector( long val ); extern int degreesSector( double val ); #line 15 "int.h" extern void initTimerInt( void ); extern void startTimerInt( void ); extern void stopTimerInt( void ); extern void initEncoderInts( void ); extern void startEncoderIntsHo( void ); extern void startEncoderIntsVe( void ); extern void stopEncoderInts( void ); extern unsigned char bdata ENC_FLAGS; extern bit ENCHO_USE; extern bit ENCVE_USE; extern bit ENCHO_COR; extern bit ENCVE_COR; extern bit ENCHO_DIR; extern bit ENCVE_DIR; extern bit ENCHO_CORUSE; extern bit ENCVE_CORUSE; extern unsigned char bdata MOT_FLAGS; extern bit MOTHO_RUN; extern bit MOTVE_RUN; extern bit MOTFR_USE; extern bit MOTHO_DIR; extern bit MOTVE_DIR; extern bit MOTFR_DIR; extern bit MOT_GOTO; extern bit MOT_CORRECTION; extern volatile int idata YEAR; extern volatile int idata MONTH; extern volatile int idata DAY; extern volatile int idata HOUR; extern volatile int idata MINUTE; extern volatile int idata SECOND; extern volatile int idata MSECOND; extern volatile int idata TIMER10; extern volatile int idata THISMDAYS; extern volatile int idata CFG_ENC_HO; extern volatile int idata CFG_ENC_VE; extern volatile int idata ARC10PERENCHO; extern volatile int idata ARC10PERENCVE; extern volatile long idata ENC_ARC10_HO; extern volatile long idata ENC_ARC10_VE; extern volatile long idata HSTEPSHO090; extern volatile long idata HSTEPSHO180; extern volatile long idata HSTEPSHO270; extern volatile long idata HSTEPSHO359; extern volatile long idata CUR_HSTEPS_HO; extern volatile long idata CUR_HSTEPS_VE; extern volatile long idata TRG_HSTEPS_HO; extern volatile long idata TRG_HSTEPS_VE; extern volatile long idata CUR_ARC10_HO; extern volatile long idata CUR_ARC10_VE; extern volatile int idata SPEED_HO; extern volatile int idata SPEED_VE; extern volatile int idata SPEED_FR; extern volatile int idata SPEED_HO_CT; extern volatile int idata SPEED_VE_CT; extern volatile int idata SPEED_FR_CT; extern volatile unsigned char idata hsteps[8]; extern volatile int idata HSTEP_HO; extern volatile int idata HSTEP_VE; extern volatile int idata HSTEP_FR; extern volatile double idata CFG_HSTS_HO; extern volatile double idata CFG_HSTS_VE; extern volatile double idata CFG_HSTS_FR; #line 13 "MAIN.C" #line 1 "ext/MISC.H" #line 33 "ext/MISC.H" #line 35 "ext/MISC.H" extern int BCD2INT( unsigned int BCDValue ); extern unsigned int INT2BCD( int INTValue ); #line 15 "MAIN.C" #line 1 "ext/I2C_HARD.H" #line 14 "ext/I2C_HARD.H" #line 16 "ext/I2C_HARD.H" extern void I2CDelay( void ); extern void I2CPutSCL( unsigned char ); extern unsigned char I2CGetSCL( void ); extern void I2CPutSDA( unsigned char ); extern unsigned char I2CGetSDA( void ); #line 16 "MAIN.C" #line 1 "ext/I2C_BUS.H" #line 27 "ext/I2C_BUS.H" #line 29 "ext/I2C_BUS.H" #line 31 "ext/I2C_BUS.H" #line 33 "ext/I2C_BUS.H" extern void I2CInit( void ); extern unsigned char I2CWrite( unsigned char *, unsigned char, unsigned char, unsigned int ); extern unsigned char I2CRead( unsigned char *, unsigned char, unsigned char, unsigned int ); extern void I2CStart( void ); extern void I2CStop( void ); extern void I2CSendAck( void ); extern unsigned char I2CReceiveAck( void ); extern void I2CSendBit( unsigned char ); extern unsigned char I2CReceiveBit( void ); extern void I2CWriteByte( unsigned char ); extern unsigned char I2CReadByte( void ); #line 17 "MAIN.C" #line 1 "ext/RTC.H" #line 16 "ext/RTC.H" #line 18 "ext/RTC.H" typedef struct REAL_TIME { unsigned char Weekday; unsigned int Year; unsigned char Month; unsigned char Date; unsigned char Hour; unsigned char Minute; unsigned char Second; } REAL_TIME; extern unsigned char RTCPutRAM( unsigned char *SourcePtr, unsigned char DeviceID, unsigned char DestAddr, unsigned int Size ); extern unsigned char RTCGetRAM( unsigned char *DestPtr, unsigned char DeviceID, unsigned char SourceAddr, unsigned int Size ); extern unsigned char RTCSetTime( REAL_TIME *RealTime, unsigned char DeviceID ); extern unsigned char RTCGetTime( REAL_TIME *RealTime, unsigned char DeviceID ); extern unsigned char RTCSetAlarm( REAL_TIME *AlarmTime, unsigned char DeviceID ); extern unsigned char RTCGetAlarm( REAL_TIME *AlarmTime, unsigned char DeviceID ); extern unsigned char RTCGetAlarmStatus( unsigned char *AlarmStatus, unsigned char DeviceID ); #line 18 "MAIN.C" #line 1 "util.c" #line 1 "util.h" #line 3 "util.h" #line 120 "util.h" #line 3 "util.c" void init_serial(unsigned int baud) { TxD = 1; DTxD = 1; DRxD = 0; S0TIC = 0x80; S0RIC = 0x00; S0BG = baud; S0CON = 0x8011; } void wait_100mues(unsigned char Multiplikator) { unsigned char a; unsigned char i; for(a=0;a 850 ){ return( '9' ); } if( val > 750 ){ return( '0' ); } if( val > 650 ){ return( 'C' ); } if( val > 500 ){ return( 'E' ); } if( val > 350 ){ return( 'D' ); } if( val > 150 ){ return( 'L' ); } if( val > 50 ){ return( 'U' ); } return( 'R' ); } ADCON = 129; while( ADCON & 256 ){;} val = ADDAT & 0x03ff; if( val >= 950 ){ return( 0 ); } if( val > 850 ){ return( '1' ); } if( val > 750 ){ return( '2' ); } if( val > 650 ){ return( '3' ); } if( val > 500 ){ return( '4' ); } if( val > 350 ){ return( '8' ); } if( val > 150 ){ return( '7' ); } if( val > 50 ){ return( '6' ); } return( '5' ); } unsigned char readkey( void ) { unsigned char val; val = testkey(); if( val == 0 ){ return( 0 ); } wait_10ms(1); if( (testkey()) != val ){ return( 0 ); } wait_10ms(1); if( (testkey()) != val ){ return( 0 ); } while(testkey() == val){;} return(val); } void setDaysOfMonth( int month, int year ) { switch( month ) { case 1: THISMDAYS = 31; break; case 2: if( year == 2004 ){ THISMDAYS = 29; } else { THISMDAYS = 28; } break; case 3: THISMDAYS = 31; break; case 4: THISMDAYS = 30; break; case 5: THISMDAYS = 31; break; case 6: THISMDAYS = 30; break; case 7: THISMDAYS = 31; break; case 8: THISMDAYS = 31; break; case 9: THISMDAYS = 30; break; case 10: THISMDAYS = 31; break; case 11: THISMDAYS = 30; break; case 12: THISMDAYS = 31; break; } } #line 20 "MAIN.C" #line 1 "astro.c" #line 1 "astro.h" #line 3 "astro.h" #line 171 "astro.h" #line 3 "astro.c" double REST( double val, double t ); void cCurrentStarTime( void ); void cCurrentStarTime( void ) { double TN,TE,Omega,L; double Lst,Depsi,Deps,eps0,eps,Depsicoseps; double GMST0,GMST,LMST; int CAL; double tmpa,tmpb,tmpc,tmpe; double p,j,m,jd,b,JD,d; tmpa = (double)YEAR; tmpb = (double)MONTH / 100; tmpc = (double)DAY / 10000; p = tmpa + tmpb + tmpc; CAL = 2; if( p < 1582.1015 ){ CAL = 1; } if( MONTH > 2 ){ j = (double)YEAR; m = (double)MONTH; } else { j = (double)YEAR - 1; m = (double)MONTH + 12; } jd = floor( 365.25 * j ) + floor( 30.6001 * ( m + 1)) + (double)DAY + 1720994.5; b = 2 - floor( j / 100 ) + floor( floor( j / 100 ) / 4 ); if( CAL < 2 ){ JD = jd; } else { JD = jd + b; } TN = ( JD - 2451545 ) / 36525; GMST0 = 24110.54841 + 8640184.812866 * TN + 0.093104 * TN * TN - 0.0000062 * TN * TN * TN; GMST0 = REST( GMST0 / 3600.0, 24.0 ); if( GMST0 < 0 ){ GMST0 = GMST0 + 24; } tmpa = (double)HOUR; tmpb = (double)MINUTE / 60; tmpc = (double)SECOND / 3600; if( MSECOND > 0 ){ tmpe = ( 1.0 / 3600000.0) * (double)MSECOND; d = tmpa + tmpb + tmpc + tmpe; } else { d = tmpa + tmpb + tmpc; } GMST = REST( GMST0 + ( 1.00273790935 * d ), 24.0); LMST = REST(GMST + ( (*(double volatile sdata *)0x0e000) / 15 ) + 24, 24.0); TE = ( JD + ( d / 24 ) - 2451545.0 ) / 36525; Omega = ((125.04452 - 1934.136261 * TE + 0.0020708 * TE * TE + TE * TE * TE * 1 / 450000)*3.14159265358979323846/180.0); L = ((280.4665 + 36000.7698 * TE)*3.14159265358979323846/180.0); Lst = ((218.3165 + 481267.8813 * TE)*3.14159265358979323846/180.0); Depsi = -17.20 * sin( Omega ) - 1.32 * sin( 2 * L ) - 0.23 * sin( 2 * Lst ) + 0.21 * sin( 2 * Omega ); Deps = 9.20 * cos( Omega ) + 0.57 * cos( 2 * L ) + 0.10 * cos( 2 * Lst ) - 0.09 * cos( 2 * Omega ); eps0 = 23.43929111 + ( -46.815 * TE - 0.00059 * TE * TE + 0.001813 * TE * TE * TE ) / 3600; eps = ((eps0 + Deps / 3600)*3.14159265358979323846/180.0); Depsicoseps = Depsi * cos(eps); (*(double volatile sdata *)0x0e018) = GMST + Depsicoseps / 54000; (*(double volatile sdata *)0x0e010) = LMST + Depsicoseps / 54000; if( (*(double volatile sdata *)0x0e010) < 0 ) { (*(double volatile sdata *)0x0e010) = (*(double volatile sdata *)0x0e010) + 24; } } double REST( double val, double t ) { double x; modf( val / t ,&x); return( val - ( x * t )); } void cAzAlt( void ) { double a,d,Theta,Q,f,Zlr,Nnr,at,altitude,tmpa,tmpb,tmpc; a = (*(double volatile sdata *)0x0e020); d = (*(double volatile sdata *)0x0e028); tmpa = (*(double volatile sdata *)0x0e010) - a + 24.0; tmpb = tmpa / 24.0; modf(tmpb,&tmpc); tmpb = tmpc * 24.0; Theta = tmpa - tmpb; Q = Theta * 15.0; f = (((*(double volatile sdata *)0x0e008))*3.14159265358979323846/180.0); d = ((d)*3.14159265358979323846/180.0); Q = ((Q)*3.14159265358979323846/180.0); altitude = asin( sin(f) * sin(d) + cos(f) * cos(d) * cos(Q)); altitude = ((altitude)*180.0/3.14159265358979323846 ); (*(double volatile sdata *)0x0e038) = altitude; Zlr = sin(Q); Nnr = (cos(Q) * sin(f) - tan(d) * cos(f)); at = ((atan( Zlr / Nnr ))*180.0/3.14159265358979323846 ); (*(double volatile sdata *)0x0e030) = 0; if( ( Nnr < 0.0 ) && ( Zlr < 0.0 )){ (*(double volatile sdata *)0x0e030) = at; return; } if( ( Nnr < 0.0 ) && ( Zlr > 0.0 )){ (*(double volatile sdata *)0x0e030) = ( 360.0 + at ); return; } if( ( Nnr > 0.0 ) && ( Zlr != 0.0 )){ (*(double volatile sdata *)0x0e030) = ( 180.0 + at ); return; } } void cRaDec( void ) { double _lat,_az,_alt,_last,_z,_dec,_ra,_stw,_stw1,_stw2; _lat = (((*(double volatile sdata *)0x0e008))*3.14159265358979323846/180.0); _az = (((*(double volatile sdata *)0x0e030))*3.14159265358979323846/180.0); _alt = (((*(double volatile sdata *)0x0e038))*3.14159265358979323846/180.0); _last = (((*(double volatile sdata *)0x0e010) * 15)*3.14159265358979323846/180.0); _z = ((90.0 - (*(double volatile sdata *)0x0e038))*3.14159265358979323846/180.0); _dec = asin( sin( _alt ) * sin( _lat ) + cos( _alt ) * cos( _lat ) * cos( _az ) ); _stw1 = asin( -sin( _az ) * cos( _alt ) / cos( _dec ) ); _stw2 = cos( _z ) * cos( _lat ) - sin( _z ) * sin( _lat ) * cos( _az ); if( _stw1 >= 0.0 ){ _stw = acos( _stw2 / cos( _dec ) ); } else { _stw = -acos( _stw2 / cos( _dec ) ); } _ra = _last - _stw; (*(double volatile sdata *)0x0e020) = ((_ra)*180.0/3.14159265358979323846 ) / 15; if( (*(double volatile sdata *)0x0e020) < 0.0 ){ (*(double volatile sdata *)0x0e020) = 24.0 + (*(double volatile sdata *)0x0e020); } if( (*(double volatile sdata *)0x0e020) >= 23.999999 ){ (*(double volatile sdata *)0x0e020) = (*(double volatile sdata *)0x0e020) - 24.0; } (*(double volatile sdata *)0x0e028) = ((_dec)*180.0/3.14159265358979323846 ); } long dHourslArc10( double val ) { double x,y; x = val * 15 * 36000; modf( x , &y ); return((long)y); } long dDegreeslArc10( double val ) { double x,y; x = val * 36000; modf( x , &y ); return((long)y); } double lArc10dHours( long val ) { double x; x = (double)val / (double)36000.0 / (double)15.0; return(x); } double lArc10dDegrees( long val ) { double x; x = (double)val / (double)36000.0; return(x); } int arc10Sector( long val ) { if( ( val >= 0 ) && ( val < 3240000 ) ){ return(0); } if( ( val >= 3240000 ) && ( val < 6480000 ) ){ return(1); } if( ( val >= 6480000 ) && ( val < 9720000 ) ){ return(2); } return(3); } int degreesSector( double val ) { if( ( val >= 0.0 ) && ( val < 90.0 ) ){ return(0); } if( ( val >= 90.0 ) && ( val < 180.0 ) ){ return(1); } if( ( val >= 180.0 ) && ( val < 270.0 ) ){ return(2); } return(3); } void testAstro(void) { char tmp[42]; int ct; (*(double volatile sdata *)0x0e008) = 48.766667; (*(double volatile sdata *)0x0e000) = 9.183333; YEAR = 2003; MONTH = 4; DAY = 11; HOUR = 20; MINUTE = 14; SECOND = 2; MSECOND = 10; (*(double volatile sdata *)0x0e020) = 19.132456; (*(double volatile sdata *)0x0e028) = 64.324567; ct = 0; while(ct < 2 ){ cCurrentStarTime(); cAzAlt(); ct++; } cRaDec(); sprintf(tmp,"%016.6f", (*(double volatile sdata *)0x0e020)); lcd_puts(0,0,tmp); sprintf(tmp,"%016.6f",(*(double volatile sdata *)0x0e028)); lcd_puts(1,0,tmp); sprintf(tmp,"%016.6f",(*(double volatile sdata *)0x0e030)); lcd_puts(2,0,tmp); sprintf(tmp,"%016.6f",(*(double volatile sdata *)0x0e038)); lcd_puts(3,0,tmp); } #line 21 "MAIN.C" #line 1 "usr.c" #line 1 "usr.h" #line 1 "C:\C166\INC\REG167.H" sfr ADCIC = 0xFF98; sfr ADCON = 0xFFA0; sfr ADDAT = 0xFEA0; sfr ADEIC = 0xFF9A; sfr ADDAT2 = 0xF0A0; sbit ADST = ADCON^7; sbit ADBSY = ADCON^8; sbit ADWR = ADCON^9; sbit ADCIN = ADCON^10; sbit ADCRQ = ADCON^11; sbit ADCIE = ADCIC^6; sbit ADCIR = ADCIC^7; sbit ADEIE = ADEIC^6; sbit ADEIR = ADEIC^7; sfr CC0 = 0xFE80; sfr CC0IC = 0xFF78; sfr CC1 = 0xFE82; sfr CC1IC = 0xFF7A; sfr CC2 = 0xFE84; sfr CC2IC = 0xFF7C; sfr CC3 = 0xFE86; sfr CC3IC = 0xFF7E; sfr CC4 = 0xFE88; sfr CC4IC = 0xFF80; sfr CC5 = 0xFE8A; sfr CC5IC = 0xFF82; sfr CC6 = 0xFE8C; sfr CC6IC = 0xFF84; sfr CC7 = 0xFE8E; sfr CC7IC = 0xFF86; sfr CC8 = 0xFE90; sfr CC8IC = 0xFF88; sfr CC9 = 0xFE92; sfr CC9IC = 0xFF8A; sfr CC10 = 0xFE94; sfr CC10IC = 0xFF8C; sfr CC11 = 0xFE96; sfr CC11IC = 0xFF8E; sfr CC12 = 0xFE98; sfr CC12IC = 0xFF90; sfr CC13 = 0xFE9A; sfr CC13IC = 0xFF92; sfr CC14 = 0xFE9C; sfr CC14IC = 0xFF94; sfr CC15 = 0xFE9E; sfr CC15IC = 0xFF96; sfr CC16 = 0xFE60; sfr CC16IC = 0xF160; sfr CC17 = 0xFE62; sfr CC17IC = 0xF162; sfr CC18 = 0xFE64; sfr CC18IC = 0xF164; sfr CC19 = 0xFE66; sfr CC19IC = 0xF166; sfr CC20 = 0xFE68; sfr CC20IC = 0xF168; sfr CC21 = 0xFE6A; sfr CC21IC = 0xF16A; sfr CC22 = 0xFE6C; sfr CC22IC = 0xF16C; sfr CC23 = 0xFE6E; sfr CC23IC = 0xF16E; sfr CC24 = 0xFE70; sfr CC24IC = 0xF170; sfr CC25 = 0xFE72; sfr CC25IC = 0xF172; sfr CC26 = 0xFE74; sfr CC26IC = 0xF174; sfr CC27 = 0xFE76; sfr CC27IC = 0xF176; sfr CC28 = 0xFE78; sfr CC28IC = 0xF178; sfr CC29 = 0xFE7A; sfr CC29IC = 0xF184; sfr CC30 = 0xFE7C; sfr CC30IC = 0xF18C; sfr CC31 = 0xFE7E; sfr CC31IC = 0xF194; sfr CCM0 = 0xFF52; sfr CCM1 = 0xFF54; sfr CCM2 = 0xFF56; sfr CCM3 = 0xFF58; sfr CCM4 = 0xFF22; sfr CCM5 = 0xFF24; sfr CCM6 = 0xFF26; sfr CCM7 = 0xFF28; sfr T0 = 0xFE50; sfr T01CON = 0xFF50; sfr T0IC = 0xFF9C; sfr T0REL = 0xFE54; sfr T1 = 0xFE52; sfr T1IC = 0xFF9E; sfr T1REL = 0xFE56; sfr T7 = 0xF050; sfr T78CON = 0xFF20; sfr T7IC = 0xF17A; sfr T7REL = 0xF054; sfr T8 = 0xF052; sfr T8IC = 0xF17C; sfr T8REL = 0xF056; sbit CC0IR = CC0IC^7; sbit CC0IE = CC0IC^6; sbit CC1IR = CC1IC^7; sbit CC1IE = CC1IC^6; sbit CC2IR = CC2IC^7; sbit CC2IE = CC2IC^6; sbit CC3IR = CC3IC^7; sbit CC3IE = CC3IC^6; sbit CC4IR = CC4IC^7; sbit CC4IE = CC4IC^6; sbit CC5IR = CC5IC^7; sbit CC5IE = CC5IC^6; sbit CC6IR = CC6IC^7; sbit CC6IE = CC6IC^6; sbit CC7IR = CC7IC^7; sbit CC7IE = CC7IC^6; sbit CC8IR = CC8IC^7; sbit CC8IE = CC8IC^6; sbit CC9IR = CC9IC^7; sbit CC9IE = CC9IC^6; sbit CC10IR = CC10IC^7; sbit CC10IE = CC10IC^6; sbit CC11IR = CC11IC^7; sbit CC11IE = CC11IC^6; sbit CC12IR = CC12IC^7; sbit CC12IE = CC12IC^6; sbit CC13IR = CC13IC^7; sbit CC13IE = CC13IC^6; sbit CC14IR = CC14IC^7; sbit CC14IE = CC14IC^6; sbit CC15IR = CC15IC^7; sbit CC15IE = CC15IC^6; sbit CC16IR = CC16IC^7; sbit CC16IE = CC16IC^6; sbit CC17IR = CC17IC^7; sbit CC17IE = CC17IC^6; sbit CC18IR = CC18IC^7; sbit CC18IE = CC18IC^6; sbit CC19IR = CC19IC^7; sbit CC19IE = CC19IC^6; sbit CC20IR = CC20IC^7; sbit CC20IE = CC20IC^6; sbit CC21IR = CC21IC^7; sbit CC21IE = CC21IC^6; sbit CC22IR = CC22IC^7; sbit CC22IE = CC22IC^6; sbit CC23IR = CC23IC^7; sbit CC23IE = CC23IC^6; sbit CC24IR = CC24IC^7; sbit CC24IE = CC24IC^6; sbit CC25IR = CC25IC^7; sbit CC25IE = CC25IC^6; sbit CC26IR = CC26IC^7; sbit CC26IE = CC26IC^6; sbit CC27IR = CC27IC^7; sbit CC27IE = CC27IC^6; sbit CC28IR = CC28IC^7; sbit CC28IE = CC28IC^6; sbit CC29IR = CC29IC^7; sbit CC29IE = CC29IC^6; sbit CC30IR = CC30IC^7; sbit CC30IE = CC30IC^6; sbit CC31IR = CC31IC^7; sbit CC31IE = CC31IC^6; sbit ACC0 = CCM0^3; sbit ACC1 = CCM0^7; sbit ACC2 = CCM0^11; sbit ACC3 = CCM0^15; sbit ACC4 = CCM1^3; sbit ACC5 = CCM1^7; sbit ACC6 = CCM1^11; sbit ACC7 = CCM1^15; sbit ACC8 = CCM2^3; sbit ACC9 = CCM2^7; sbit ACC10 = CCM2^11; sbit ACC11 = CCM2^15; sbit ACC12 = CCM3^3; sbit ACC13 = CCM3^7; sbit ACC14 = CCM3^11; sbit ACC15 = CCM3^15; sbit ACC16 = CCM4^3; sbit ACC17 = CCM4^7; sbit ACC18 = CCM4^11; sbit ACC19 = CCM4^15; sbit ACC20 = CCM5^3; sbit ACC21 = CCM5^7; sbit ACC22 = CCM5^11; sbit ACC23 = CCM5^15; sbit ACC24 = CCM6^3; sbit ACC25 = CCM6^7; sbit ACC26 = CCM6^11; sbit ACC27 = CCM6^15; sbit ACC28 = CCM7^3; sbit ACC29 = CCM7^7; sbit ACC30 = CCM7^11; sbit ACC31 = CCM7^15; sbit T0IE = T0IC^6; sbit T0IR = T0IC^7; sbit T0M = T01CON^3; sbit T0R = T01CON^6; sbit T1IE = T1IC^6; sbit T1IR = T1IC^7; sbit T1M = T01CON^11; sbit T1R = T01CON^14; sbit T7IE = T7IC^6; sbit T7IR = T7IC^7; sbit T7M = T78CON^3; sbit T7R = T78CON^6; sbit T8IE = T8IC^6; sbit T8IR = T8IC^7; sbit T8M = T78CON^11; sbit T8R = T78CON^14; sfr CP = 0xFE10; sfr CSP = 0xFE08; sfr DPP0 = 0xFE00; sfr DPP1 = 0xFE02; sfr DPP2 = 0xFE04; sfr DPP3 = 0xFE06; sfr MDC = 0xFF0E; sfr MDH = 0xFE0C; sfr MDL = 0xFE0E; sfr ONES = 0xFF1E; sfr PSW = 0xFF10; sfr SP = 0xFE12; sfr STKOV = 0xFE14; sfr STKUN = 0xFE16; sfr SYSCON = 0xFF12; sfr TFR = 0xFFAC; sfr ZEROS = 0xFF1C; sfr BUSCON0 = 0xFF0C; sfr BUSCON1 = 0xFF14; sfr BUSCON2 = 0xFF16; sfr BUSCON3 = 0xFF18; sfr BUSCON4 = 0xFF1A; sfr ADDRSEL1 = 0xFE18; sfr ADDRSEL2 = 0xFE1A; sfr ADDRSEL3 = 0xFE1C; sfr ADDRSEL4 = 0xFE1E; sbit WRCFG = SYSCON^7; sbit CLKEN = SYSCON^8; sbit BYTDIS = SYSCON^9; sbit ROMEN = SYSCON^10; sbit SGTEN = SYSCON^11; sbit ROMS1 = SYSCON^12; sbit MDRIU = MDC^4; sbit N = PSW^0; sbit C = PSW^1; sbit V = PSW^2; sbit Z = PSW^3; sbit E = PSW^4; sbit MULIP = PSW^5; sbit USR0 = PSW^6; sbit HLDEN = PSW^10; sbit IEN = PSW^11; sbit RWDC0 = BUSCON0^4; sbit MTTC0 = BUSCON0^5; sbit ALECTL0 = BUSCON0^9; sbit BUSACT0 = BUSCON0^10; sbit RDYEN0 = BUSCON0^12; sbit RWDC1 = BUSCON1^4; sbit MTTC1 = BUSCON1^5; sbit ALECTL1 = BUSCON1^9; sbit BUSACT1 = BUSCON1^10; sbit RDYEN1 = BUSCON1^12; sbit CSREN1 = BUSCON1^14; sbit CSWEN1 = BUSCON1^15; sbit RWDC2 = BUSCON2^4; sbit MTTC2 = BUSCON2^5; sbit ALECTL2 = BUSCON2^9; sbit BUSACT2 = BUSCON2^10; sbit RDYEN2 = BUSCON2^12; sbit CSREN2 = BUSCON2^14; sbit CSWEN2 = BUSCON2^15; sbit RWDC3 = BUSCON3^4; sbit MTTC3 = BUSCON3^5; sbit ALECTL3 = BUSCON3^9; sbit BUSACT3 = BUSCON3^10; sbit RDYEN3 = BUSCON3^12; sbit CSREN3 = BUSCON3^14; sbit CSWEN3 = BUSCON3^15; sbit RWDC4 = BUSCON4^4; sbit MTTC4 = BUSCON4^5; sbit ALECTL4 = BUSCON4^9; sbit BUSACT4 = BUSCON4^10; sbit RDYEN4 = BUSCON4^12; sbit CSREN4 = BUSCON4^14; sbit CSWEN4 = BUSCON4^15; sbit ILLBUS = TFR^0; sbit ILLINA = TFR^1; sbit ILLOPA = TFR^2; sbit PRTFLT = TFR^3; sbit UNDOPC = TFR^7; sbit STKUF = TFR^13; sbit STKOF = TFR^14; sbit NMI = TFR^15; sfr EXICON = 0xF1C0; sfr ISNC = 0xF1DE; sbit RTCIE = ISNC^0; sbit RTCIR = ISNC^1; sbit PLLIE = ISNC^2; sbit PLLIR = ISNC^3; sfr PECC0 = 0xFEC0; sfr PECC1 = 0xFEC2; sfr PECC2 = 0xFEC4; sfr PECC3 = 0xFEC6; sfr PECC4 = 0xFEC8; sfr PECC5 = 0xFECA; sfr PECC6 = 0xFECC; sfr PECC7 = 0xFECE; sfr DP0L = 0xF100; sfr DP0H = 0xF102; sfr DP1L = 0xF104; sfr DP1H = 0xF106; sfr DP2 = 0xFFC2; sfr DP3 = 0xFFC6; sfr DP4 = 0xFFCA; sfr DP6 = 0xFFCE; sfr DP7 = 0xFFD2; sfr DP8 = 0xFFD6; sfr P0L = 0xFF00; sfr P0H = 0xFF02; sfr P1L = 0xFF04; sfr P1H = 0xFF06; sfr P2 = 0xFFC0; sfr P3 = 0xFFC4; sfr P4 = 0xFFC8; sfr P5 = 0xFFA2; sfr P6 = 0xFFCC; sfr P7 = 0xFFD0; sfr P8 = 0xFFD4; sfr ODP2 = 0xF1C2; sfr ODP3 = 0xF1C6; sfr ODP6 = 0xF1CE; sfr ODP7 = 0xF1D2; sfr ODP8 = 0xF1D6; sfr RP0H = 0xF108; sfr S0BG = 0xFEB4; sfr S0CON = 0xFFB0; sfr S0EIC = 0xFF70; sfr S0RBUF = 0xFEB2; sfr S0RIC = 0xFF6E; sfr S0TBUF = 0xFEB0; sfr S0TIC = 0xFF6C; sfr S0TBIC = 0xF19C; sbit S0STP = S0CON^3; sbit S0REN = S0CON^4; sbit S0PEN = S0CON^5; sbit S0FEN = S0CON^6; sbit S0OEN = S0CON^7; sbit S0PE = S0CON^8; sbit S0FE = S0CON^9; sbit S0OE = S0CON^10; sbit S0ODD = S0CON^12; sbit S0BRS = S0CON^13; sbit S0LB = S0CON^14; sbit S0R = S0CON^15; sbit S0TIE = S0TIC^6; sbit S0TIR = S0TIC^7; sbit S0TBIE = S0TBIC^6; sbit S0TBIR = S0TBIC^7; sbit S0RIE = S0RIC^6; sbit S0RIR = S0RIC^7; sbit S0EIE = S0EIC^6; sbit S0EIR = S0EIC^7; sfr SSCTIC = 0xFF72; sfr SSCRIC = 0xFF74; sfr SSCEIC = 0xFF76; sfr SSCTB = 0xF0B0; sfr SSCRB = 0xF0B2; sfr SSCBR = 0xF0B4; sfr SSCCON = 0xFFB2; sbit SSCHB = SSCCON^4; sbit SSCPH = SSCCON^5; sbit SSCPO = SSCCON^6; sbit SSCTE = SSCCON^8; sbit SSCTEN = SSCCON^8; sbit SSCRE = SSCCON^9; sbit SSCREN = SSCCON^9; sbit SSCPE = SSCCON^10; sbit SSCPEN = SSCCON^10; sbit SSCBE = SSCCON^11; sbit SSCBEN = SSCCON^11; sbit SSCBSY = SSCCON^12; sbit SSCMS = SSCCON^14; sbit SSCEN = SSCCON^15; sbit SSCTIR = SSCTIC^7; sbit SSCTIE = SSCTIC^6; sbit SSCRIR = SSCRIC^7; sbit SSCRIE = SSCRIC^6; sbit SSCEIR = SSCEIC^7; sbit SSCEIE = SSCEIC^6; sfr CAPREL = 0xFE4A; sfr CRIC = 0xFF6A; sfr T2 = 0xFE40; sfr T2CON = 0xFF40; sfr T2IC = 0xFF60; sfr T3 = 0xFE42; sfr T3CON = 0xFF42; sfr T3IC = 0xFF62; sfr T4 = 0xFE44; sfr T4CON = 0xFF44; sfr T4IC = 0xFF64; sfr T5 = 0xFE46; sfr T5CON = 0xFF46; sfr T5IC = 0xFF66; sfr T6 = 0xFE48; sfr T6CON = 0xFF48; sfr T6IC = 0xFF68; sfr WDT = 0xFEAE; sfr WDTCON = 0xFFAE; sbit CRIE = CRIC^6; sbit CRIR = CRIC^7; sbit T2R = T2CON^6; sbit T2UD = T2CON^7; sbit T2UDE = T2CON^8; sbit T2IE = T2IC^6; sbit T2IR = T2IC^7; sbit T3R = T3CON^6; sbit T3UD = T3CON^7; sbit T3UDE = T3CON^8; sbit T3OE = T3CON^9; sbit T3OTL = T3CON^10; sbit T3IE = T3IC^6; sbit T3IR = T3IC^7; sbit T4R = T4CON^6; sbit T4UD = T4CON^7; sbit T4UDE = T4CON^8; sbit T4IE = T4IC^6; sbit T4IR = T4IC^7; sbit T5R = T5CON^6; sbit T5UD = T5CON^7; sbit T5UDE = T5CON^8; sbit T5CLR = T5CON^14; sbit T5SC = T5CON^15; sbit T5IE = T5IC^6; sbit T5IR = T5IC^7; sbit T6R = T6CON^6; sbit T6UD = T6CON^7; sbit T6UDE = T6CON^8; sbit T6OE = T6CON^9; sbit T6OTL = T6CON^10; sbit T6SR = T6CON^15; sbit T6IE = T6IC^6; sbit T6IR = T6IC^7; sbit T0IN = P3^0; sbit T2IN = P3^7; sbit T3IN = P3^6; sbit T4IN = P3^5; sbit T5IN = P5^13; sbit T6IN = P5^12; sbit T2EUD = P5^15; sbit T3EUD = P3^4; sbit T4EUD = P5^14; sbit T5EUD = P5^11; sbit T6EUD = P5^10; sbit T3OUT = P3^3; sbit CAPIN = P3^2; sbit T6OUT = P3^1; sbit WDTIN = WDTCON^0; sbit WDTR = WDTCON^1; sfr PWMCON0 = 0xFF30; sfr PWMCON1 = 0xFF32; sfr PW0 = 0xFE30; sfr PW1 = 0xFE32; sfr PW2 = 0xFE34; sfr PW3 = 0xFE36; sfr PWMIC = 0xF17E; sfr PT0 = 0xF030; sfr PT1 = 0xF032; sfr PT2 = 0xF034; sfr PT3 = 0xF036; sfr PP0 = 0xF038; sfr PP1 = 0xF03A; sfr PP2 = 0xF03C; sfr PP3 = 0xF03E; sbit PTR0 = PWMCON0^0; sbit PTR1 = PWMCON0^1; sbit PTR2 = PWMCON0^2; sbit PTR3 = PWMCON0^3; sbit PTI0 = PWMCON0^4; sbit PTI1 = PWMCON0^5; sbit PTI2 = PWMCON0^6; sbit PTI3 = PWMCON0^7; sbit PIE0 = PWMCON0^8; sbit PIE1 = PWMCON0^9; sbit PIE2 = PWMCON0^10; sbit PIE3 = PWMCON0^11; sbit PIR0 = PWMCON0^12; sbit PIR1 = PWMCON0^13; sbit PIR2 = PWMCON0^14; sbit PIR3 = PWMCON0^15; sbit PEN0 = PWMCON1^0; sbit PEN1 = PWMCON1^1; sbit PEN2 = PWMCON1^2; sbit PEN3 = PWMCON1^3; sbit PM0 = PWMCON1^4; sbit PM1 = PWMCON1^5; sbit PM2 = PWMCON1^6; sbit PM3 = PWMCON1^7; sbit PB01 = PWMCON1^12; sbit PS2 = PWMCON1^14; sbit PS3 = PWMCON1^15; sbit PWMIR = PWMIC^7; sbit PWMIE = PWMIC^6; sfr XP0IC = 0xF186; sfr XP1IC = 0xF18E; sfr XP2IC = 0xF196; sfr XP3IC = 0xF19E; sbit XP0IR = XP0IC^7; sbit XP0IE = XP0IC^6; sbit XP1IR = XP1IC^7; sbit XP1IE = XP1IC^6; sbit XP2IR = XP2IC^7; sbit XP2IE = XP2IC^6; sbit XP3IR = XP3IC^7; sbit XP3IE = XP3IC^6; #line 6 "usr.h" #line 1 "C:\C166\INC\ABSACC.H" #line 10 "C:\C166\INC\ABSACC.H" #line 13 "C:\C166\INC\ABSACC.H" #line 7 "usr.h" #line 1 "C:\C166\INC\STDARG.H" #line 10 "C:\C166\INC\STDARG.H" #line 8 "usr.h" #line 8 "usr.h" #line 1 "C:\C166\INC\STDLIB.H" #line 10 "C:\C166\INC\STDLIB.H" #line 12 "C:\C166\INC\STDLIB.H" #line 14 "C:\C166\INC\STDLIB.H" #line 17 "C:\C166\INC\STDLIB.H" #line 19 "C:\C166\INC\STDLIB.H" #line 22 "C:\C166\INC\STDLIB.H" #line 24 "C:\C166\INC\STDLIB.H" #line 26 "C:\C166\INC\STDLIB.H" extern int abs (int val); extern long labs (long val); extern double atof (void *s1); extern long atol (void *s1); extern int atoi (void *s1); extern int rand (void); extern void srand (unsigned int); #line 38 "C:\C166\INC\STDLIB.H" #line 44 "C:\C166\INC\STDLIB.H" extern void far *malloc (size_t size); extern void free (void far *p); extern void init_mempool (void far *p, size_t size); extern void far *realloc (void far *p, size_t size); extern void far *calloc (size_t size, size_t len); extern void xhuge *xmalloc (unsigned long size); extern void xhuge *xcalloc (unsigned long size, unsigned long len); extern void xhuge *xrealloc (void xhuge *p, unsigned long size); extern void xinit_mempool (void xhuge *p, unsigned long size); extern void xfree (void xhuge *p); #line 9 "usr.h" #line 1 "C:\C166\INC\STDIO.H" #line 10 "C:\C166\INC\STDIO.H" #line 10 "usr.h" #line 10 "usr.h" #line 1 "C:\C166\INC\STRING.H" #line 10 "C:\C166\INC\STRING.H" #line 13 "C:\C166\INC\STRING.H" #line 15 "C:\C166\INC\STRING.H" #line 17 "C:\C166\INC\STRING.H" extern char *strcat (char *s1, char *s2); extern char *strncat (char *s1, char *s2, unsigned int n); extern int strcmp (char *s1, char *s2); extern int strncmp (char *s1, char *s2, unsigned int n); extern char *strcpy (char *s1, char *s2); extern char *strncpy (char *s1, char *s2, unsigned int n); extern size_t strlen (char *); extern char *strchr (char *s, char c); extern int strpos (char *s, char c); extern char *strrchr (char *s, char c); extern int strrpos (char *s, char c); extern int strspn (char *s, char *set); extern int strcspn (char *s, char *set); extern char *strpbrk (char *s, char *set); extern char *strrpbrk(char *s, char *set); extern int memcmp (void *s1, void *s2, unsigned int n); extern void *memcpy (void *s1, void *s2, unsigned int n); extern void *memchr (void *s, char val, unsigned int n); extern void *memccpy (void *s1, void *s2, char val, unsigned int n); extern void *memmove (void *s1, void *s2, unsigned int n); extern void *memset (void *s, char val, unsigned int n); extern char far *fstrcat (char far *s1, char far *s2); extern char far *fstrncat (char far *s1, char far *s2, unsigned int n); extern int fstrcmp (char far *s1, char far *s2); extern int fstrncmp (char far *s1, char far *s2, unsigned int n); extern char *fstrcpy (char far *s1, char far *s2); extern char *fstrncpy (char far *s1, char far *s2, unsigned int n); extern size_t fstrlen (char far *); extern char far *fstrchr (const char far *s, char c); extern char far *fstrrchr (const char far *s, char c); extern int fstrpos (const char far *s, char c); extern int fstrrpos (const char far *s, char c); extern int fstrspn (char far *s, char far *set); extern int fstrcspn (char far *s, char far *set); extern char *fstrpbrk (char far *s, char far *set); extern char *fstrrpbrk (char far *s, char far *set); extern int fmemcmp (void far *s1, void far *s2, unsigned int n); extern void far *fmemcpy (void far *s1, void far *s2, unsigned int n); extern void far *fmemchr (void far *s, char val, unsigned int n); extern void far *fmemccpy (void far *s1, void far *s2, char val, unsigned int n); extern void far *fmemmove (void far *s1, void far *s2, unsigned int n); extern void far *fmemset (void far *s, char val, unsigned int n); extern int xmemcmp (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemcpy (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemchr (void xhuge *s, char val, unsigned long n); extern void xhuge *xmemccpy (void xhuge *s1, void xhuge *s2, char val, unsigned long n); extern void xhuge *xmemmove (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemset (void xhuge *s, char val, unsigned long n); #line 11 "usr.h" #line 1 "C:\C166\INC\MATH.H" extern int abs (int val); extern long labs (long val); extern double fabs (double val); extern double sqrt (double val); extern double exp (double val); extern double log (double val); extern double log10 (double val); extern double sin (double val); extern double cos (double val); extern double tan (double val); extern double asin (double val); extern double acos (double val); extern double atan (double val); extern double sinh (double val); extern double cosh (double val); extern double tanh (double val); extern double atan2 (double y, double x); extern double ceil (double val); extern double floor (double val); extern double modf (double val, double *n); extern double pow (double x, double y); extern unsigned int _chkfloat_ (float x); extern unsigned int _chkdouble_ (double x); #line 12 "usr.h" #line 1 "global.h" #line 5 "global.h" #line 204 "global.h" #line 13 "usr.h" #line 1 "int.h" #line 3 "int.h" #line 400 "int.h" #line 14 "usr.h" #line 1 "util.h" #line 3 "util.h" #line 120 "util.h" #line 15 "usr.h" #line 1 "astro.h" #line 3 "astro.h" #line 171 "astro.h" #line 16 "usr.h" extern int usrGetOnOff( char *txt, int current ); extern int usrGetDateTime( void ); extern int usrGetKoor( int azalt, double defho, double defve ); extern double usrGetDouble( unsigned char row, double defdouble ); extern long usrGetLong( unsigned char row, long deflong ); extern int usrGetInt( unsigned char row, int defint ); extern void printArc10Degrees(unsigned char row, long val ); extern void printDegrees(unsigned char row, double val ); extern void sprintArc10Degrees( char *ptr, long val ); extern void sprintDegrees( char *ptr, double val ); extern void printDouble( unsigned char row, double val ); extern void printLong( unsigned char row, long val ); extern void printDateTime( unsigned char row ); extern int usrGetAck( char *txt ); #line 2 "usr.c" int usrGetOnOff( char *txt, int current ) { int val; unsigned char KEY; char tmp1[20]; val = current; lcd_clear(); sprintf(tmp1,"%s",txt); lcd_puts(0,0,tmp1); sprintf(tmp1,"USE 1=ON, 0=OFF"); lcd_puts(1,0,tmp1); sprintf(tmp1,"E=SET, C=CANCEL"); lcd_puts(2,0,tmp1); KEY = 0; while( KEY != 'E' ){ if( val ){ sprintf(tmp1,"ON "); } else { sprintf(tmp1,"OFF"); } lcd_puts(3,0,tmp1); if( KEY == 'C' ){ return( current ); } KEY = 0; while(! KEY ) { KEY = readkey(); } if( KEY == '0' ){ val = 0; continue; } if( KEY == '1' ){ val = 1; continue; } } return(val); } int usrGetDateTime( void ) { char tmp1[20]; char tmp2[20]; unsigned char KEY,x,y; int ret,newday,newmonth,newyear,newhour,newminute,newsecond; ret = 0; lcd_on(2); lcd_clear(); lcd_puts(0,0,"Date"); lcd_puts(2,0,"Time"); sprintf(tmp1,"%02d.%02d.%04d",(int)DAY,(int)MONTH,(int)YEAR); sprintf(tmp2,"%02d:%02d:%02d",(int)HOUR,(int)MINUTE,(int)SECOND); KEY = 0; x = 0; y = 1; while(KEY != 'E' ){ if(KEY == 'C' ){ lcd_on(0); lcd_clear(); return(ret); } KEY = 0; lcd_puts(1,0,tmp1); lcd_puts(3,0,tmp2); lcd_setcursor(y,x); while(! KEY ) { KEY = readkey(); } if(KEY == 'U' ){ if(y == 3){ y = 1; x = 0; } continue; } if(KEY == 'D' ){ if(y == 1){ y = 3; x = 0; } continue; } if(KEY == 'L' ){ if(x > 0 ){ x--; } if(x == 5 ){ x--; } if(x == 2){ x--; } continue; } if( ( KEY >= '0' ) && ( KEY <= '9' ) ){ if( y == 1 ) { tmp1[x] = KEY; } else { tmp2[x] = KEY; } KEY = 'R'; } if(KEY == 'R' );{ x++; if(x == 5 ){ x++; } if(x == 2){ x++; } if(x > 9){ x--; } if( y == 3 ) { if(x > 7){ x--; } } continue; } } tmp1[2] = 0; tmp1[5] = 0; tmp2[2] = 0; tmp2[5] = 0; newday = atoi(&tmp1[0]); newmonth = atoi(&tmp1[3]); newyear = atoi(&tmp1[6]); newhour = atoi(&tmp2[0]); newminute = atoi(&tmp2[3]); newsecond = atoi(&tmp2[6]); if( ( newday > 0 ) && ( newday < 32 ) ){ if( ( newmonth > 0 ) && ( newmonth < 13 ) ) { if( newhour < 24 ) { if( newminute < 60 ) { if( newsecond < 60 ) { DAY = newday; MONTH = newmonth; YEAR = newyear; HOUR = newhour; MINUTE = newminute; SECOND = newsecond; ret = 1; } } } } } lcd_on(0); lcd_clear(); return( ret ); } int usrGetKoor( int azalt, double defho, double defve ) { char tmp1[20]; char tmp2[20]; unsigned char KEY,x,y; int ret; long l1,l2,l3,l4,l5,l6; ret = 0; lcd_on(2); lcd_clear(); if(azalt){ lcd_puts(0,0,"AZ"); lcd_puts(2,0,"ALT"); } else { lcd_puts(0,0,"RA"); lcd_puts(2,0,"DEC"); } sprintDegrees( tmp1, defho ); sprintDegrees( tmp2, defve ); KEY = 0; x = 1; y = 1; while(KEY != 'E' ){ if(KEY == 'C' ){ lcd_on(0); lcd_clear(); return(ret); } KEY = 0; lcd_puts(1,0,tmp1); lcd_puts(3,0,tmp2); lcd_setcursor(y,x); while(! KEY ) { KEY = readkey(); } if(KEY == 'U' ){ if(y == 3){ y = 1; } continue; } if(KEY == 'D' ){ if(y == 1){ y = 3; } continue; } if(KEY == 'L'){ if(x > 0 ){ x--; } if(x == 4 ){ x--; } if(x == 7){ x--; } continue; } if(x == 0){ if( ( KEY >= '0' ) || ( KEY <= '9' ) ){ if( y == 1 ) { if(tmp1[x] == '+'){ tmp1[x] = '-'; } else { tmp1[x] = '+'; } } else { if(tmp2[x] == '+'){ tmp2[x] = '-'; } else { tmp2[x] = '+'; } } KEY = 'R'; } } else { if( ( KEY >= '0' ) && ( KEY <= '9') ){ if( y == 1 ) { tmp1[x] = (unsigned char)KEY; } else { tmp2[x] = (unsigned char)KEY; } KEY = 'R'; } } if(KEY == 'R');{ x++; if(x == 4 ){ x++; } if(x == 7){ x++; } if(x > 9){ x--; } continue; } } ret = 1; tmp1[4] = 0; tmp1[7] = 0; tmp2[4] = 0; tmp2[7] = 0; l1 = atol(&tmp1[1]); l2 = atol(&tmp1[5]); l3 = atol(&tmp1[8]); l4 = atol(&tmp2[1]); l5 = atol(&tmp2[5]); l6 = atol(&tmp2[8]); l1 = l1 * 3600; if(! azalt){ l1 = l1 * 15; } l2 = l2 * 60; l1 = l1 + l2 + l3; l1 = l1 * 10; if(tmp1[0] == '-'){ l1 = l1 * -1; } l4 = l4 * 3600; l5 = l5 * 60; l4 = l4 + l5 + l6; l4 = l4 * 10; if(tmp2[0] == '-'){ l4 = l4 * -1; } (*(long volatile sdata *)0x0e040) = l1; (*(long volatile sdata *)0x0e044) = l4; if(azalt){ (*(double volatile sdata *)0x0e048) = lArc10dDegrees( l1 ); (*(double volatile sdata *)0x0e050) = lArc10dDegrees( l4 ); } else { (*(double volatile sdata *)0x0e058) = lArc10dHours( l1 ); (*(double volatile sdata *)0x0e060) = lArc10dDegrees( l4 ); } lcd_on(0); lcd_clear(); return( ret ); } double usrGetDouble( unsigned char row, double defval ) { char tmp1[20]; unsigned char KEY,x; double d; lcd_on(2); lcd_clear(); sprintf(tmp1,"%016.6f",defval); if(defval >= 0.0){ tmp1[0] = '+'; } else { tmp1[0] = '-'; } KEY = 0; x = 1; while(KEY != 'E' ){ KEY = 0; lcd_puts(row,0,tmp1); lcd_setcursor(row,x); while(! KEY ) { KEY = readkey(); } if(KEY == 'L'){ if(x > 0 ){ x--; } if(x == 9 ){ x--; } continue; } if(x == 0){ if( ( KEY >= '0' ) || ( KEY <= '9' ) ){ if(tmp1[x] == '+'){ tmp1[x] = '-'; } else { tmp1[x] = '+'; } KEY = 'R'; } } else { if( ( KEY >= '0' ) && ( KEY <= '9' ) ){ tmp1[x] = (unsigned char)KEY; KEY = 'R'; } } if(KEY == 'R');{ x++; if(x == 9 ){ x++; } if(x > 15){ x--; } continue; } } d = atof(tmp1); lcd_on(0); lcd_clear(); return( d ); } long usrGetLong( unsigned char row, long deflong ) { char tmp1[20]; unsigned char KEY,x; long l; lcd_on(2); lcd_clear(); sprintf(tmp1,"%010ld",deflong); if(deflong >= 0){ tmp1[0] = '+'; } else { tmp1[0] = '-'; } KEY = 0; x = 1; while(KEY != 'E'){ KEY = 0; lcd_puts(row,0,tmp1); lcd_setcursor(row,x); while(! KEY ) { KEY = readkey(); } if(KEY == 'L'){ if(x > 0 ){ x--; } continue; } if(x == 0){ if( ( KEY >= '0' ) || ( KEY <= '9') ){ if(tmp1[x] == '+'){ tmp1[x] = '-'; } else { tmp1[x] = '+'; } KEY = 'R'; } } else { if( ( KEY >= '0' ) && ( KEY <= '9') ){ tmp1[x] = (unsigned char)KEY; KEY = 'R'; } } if(KEY == 'R');{ x++; if(x > 9){ x--; } continue; } } l = atol(tmp1); lcd_on(0); lcd_clear(); return( l ); } int usrGetInt( unsigned char row, int defint ) { char tmp1[20]; unsigned char KEY,x; int i; lcd_on(2); lcd_clear(); sprintf(tmp1,"%06d",defint); if(defint >= 0){ tmp1[0] = '+'; } else { tmp1[0] = '-'; } KEY = 0; x = 1; while(KEY != 'E'){ KEY = 0; lcd_puts(row,0,tmp1); lcd_setcursor(row,x); while(! KEY ) { KEY = readkey(); } if(KEY == 'L'){ if(x > 0 ){ x--; } continue; } if(x == 0){ if( ( KEY >= '0' ) || ( KEY <= '9') ){ if(tmp1[x] == '+'){ tmp1[x] = '-'; } else { tmp1[x] = '+'; } KEY = 'R'; } } else { if( ( KEY >= '0' ) && ( KEY <= '9') ){ tmp1[x] = (unsigned char)KEY; KEY = 'R'; } } if(KEY == 'R');{ x++; if(x > 5){ x--; } continue; } } i = atoi(tmp1); lcd_on(0); lcd_clear(); return( i ); } void printArc10Degrees(unsigned char row, long val ) { char tmp1[20]; long l1,l2,l3,tmp,rest; int sign; sign = 0; rest = val / 10; if(rest < 0 ){ sign = 1; rest = rest * -1; } l1 = rest / 3600; tmp = l1 * 3600; rest = rest - tmp; l2 = rest / 60; tmp = l2 * 60; rest = rest - tmp; l3 = rest; sprintf(tmp1," %03ld:%02ld:%02ld",l1,l2,l3); if(sign){ tmp1[0] = '-'; } else { tmp1[0] = '+'; } lcd_puts(row,0,tmp1); } void printDegrees(unsigned char row, double val ) { long lo; lo = dDegreeslArc10( val ); printArc10Degrees(row, lo ); } void sprintArc10Degrees( char *ptr, long val ) { long l1,l2,l3,tmp,rest; int sign; sign = 0; rest = val / 10; if(rest < 0 ){ sign = 1; rest = rest * -1; } l1 = rest / 3600; tmp = l1 * 3600; rest = rest - tmp; l2 = rest / 60; tmp = l2 * 60; rest = rest - tmp; l3 = rest; sprintf(ptr," %03ld:%02ld:%02ld",l1,l2,l3); if(sign){ ptr[0] = '-'; } else { ptr[0] = '+'; } } void sprintDegrees(char *ptr, double val ) { long lo; lo = dDegreeslArc10( val ); sprintArc10Degrees( ptr , lo ); } void printDouble( unsigned char row, double val ) { char tmp1[42]; sprintf(tmp1,"%016.6f",val); lcd_puts(row,0,tmp1); } void printLong( unsigned char row, long val ) { char tmp1[42]; sprintf(tmp1,"%010ld",val); lcd_puts(row,0,tmp1); } void printDateTime( unsigned char row ) { char tmp1[20]; sprintf(tmp1,"%02d.%02d.%04d %02d:%02d", (int)DAY, (int)MONTH, (int)YEAR, (int)HOUR, (int)MINUTE); lcd_puts(row,0,tmp1); } int usrGetAck( char *txt ) { unsigned char KEY; char tmp1[20]; lcd_clear(); sprintf(tmp1,"%s",txt); lcd_puts(0,0,tmp1); sprintf(tmp1,"USE 1 = YES"); lcd_puts(1,0,tmp1); sprintf(tmp1,"OTHERS = CANCEL"); lcd_puts(2,0,tmp1); KEY = 0; while( ! KEY ){ KEY = readkey(); } if( KEY == '1' ){ return( 1 ); } return( 0 ); } #line 22 "MAIN.C" #line 1 "scope.c" #line 1 "scope.h" #line 1 "C:\C166\INC\REG167.H" sfr ADCIC = 0xFF98; sfr ADCON = 0xFFA0; sfr ADDAT = 0xFEA0; sfr ADEIC = 0xFF9A; sfr ADDAT2 = 0xF0A0; sbit ADST = ADCON^7; sbit ADBSY = ADCON^8; sbit ADWR = ADCON^9; sbit ADCIN = ADCON^10; sbit ADCRQ = ADCON^11; sbit ADCIE = ADCIC^6; sbit ADCIR = ADCIC^7; sbit ADEIE = ADEIC^6; sbit ADEIR = ADEIC^7; sfr CC0 = 0xFE80; sfr CC0IC = 0xFF78; sfr CC1 = 0xFE82; sfr CC1IC = 0xFF7A; sfr CC2 = 0xFE84; sfr CC2IC = 0xFF7C; sfr CC3 = 0xFE86; sfr CC3IC = 0xFF7E; sfr CC4 = 0xFE88; sfr CC4IC = 0xFF80; sfr CC5 = 0xFE8A; sfr CC5IC = 0xFF82; sfr CC6 = 0xFE8C; sfr CC6IC = 0xFF84; sfr CC7 = 0xFE8E; sfr CC7IC = 0xFF86; sfr CC8 = 0xFE90; sfr CC8IC = 0xFF88; sfr CC9 = 0xFE92; sfr CC9IC = 0xFF8A; sfr CC10 = 0xFE94; sfr CC10IC = 0xFF8C; sfr CC11 = 0xFE96; sfr CC11IC = 0xFF8E; sfr CC12 = 0xFE98; sfr CC12IC = 0xFF90; sfr CC13 = 0xFE9A; sfr CC13IC = 0xFF92; sfr CC14 = 0xFE9C; sfr CC14IC = 0xFF94; sfr CC15 = 0xFE9E; sfr CC15IC = 0xFF96; sfr CC16 = 0xFE60; sfr CC16IC = 0xF160; sfr CC17 = 0xFE62; sfr CC17IC = 0xF162; sfr CC18 = 0xFE64; sfr CC18IC = 0xF164; sfr CC19 = 0xFE66; sfr CC19IC = 0xF166; sfr CC20 = 0xFE68; sfr CC20IC = 0xF168; sfr CC21 = 0xFE6A; sfr CC21IC = 0xF16A; sfr CC22 = 0xFE6C; sfr CC22IC = 0xF16C; sfr CC23 = 0xFE6E; sfr CC23IC = 0xF16E; sfr CC24 = 0xFE70; sfr CC24IC = 0xF170; sfr CC25 = 0xFE72; sfr CC25IC = 0xF172; sfr CC26 = 0xFE74; sfr CC26IC = 0xF174; sfr CC27 = 0xFE76; sfr CC27IC = 0xF176; sfr CC28 = 0xFE78; sfr CC28IC = 0xF178; sfr CC29 = 0xFE7A; sfr CC29IC = 0xF184; sfr CC30 = 0xFE7C; sfr CC30IC = 0xF18C; sfr CC31 = 0xFE7E; sfr CC31IC = 0xF194; sfr CCM0 = 0xFF52; sfr CCM1 = 0xFF54; sfr CCM2 = 0xFF56; sfr CCM3 = 0xFF58; sfr CCM4 = 0xFF22; sfr CCM5 = 0xFF24; sfr CCM6 = 0xFF26; sfr CCM7 = 0xFF28; sfr T0 = 0xFE50; sfr T01CON = 0xFF50; sfr T0IC = 0xFF9C; sfr T0REL = 0xFE54; sfr T1 = 0xFE52; sfr T1IC = 0xFF9E; sfr T1REL = 0xFE56; sfr T7 = 0xF050; sfr T78CON = 0xFF20; sfr T7IC = 0xF17A; sfr T7REL = 0xF054; sfr T8 = 0xF052; sfr T8IC = 0xF17C; sfr T8REL = 0xF056; sbit CC0IR = CC0IC^7; sbit CC0IE = CC0IC^6; sbit CC1IR = CC1IC^7; sbit CC1IE = CC1IC^6; sbit CC2IR = CC2IC^7; sbit CC2IE = CC2IC^6; sbit CC3IR = CC3IC^7; sbit CC3IE = CC3IC^6; sbit CC4IR = CC4IC^7; sbit CC4IE = CC4IC^6; sbit CC5IR = CC5IC^7; sbit CC5IE = CC5IC^6; sbit CC6IR = CC6IC^7; sbit CC6IE = CC6IC^6; sbit CC7IR = CC7IC^7; sbit CC7IE = CC7IC^6; sbit CC8IR = CC8IC^7; sbit CC8IE = CC8IC^6; sbit CC9IR = CC9IC^7; sbit CC9IE = CC9IC^6; sbit CC10IR = CC10IC^7; sbit CC10IE = CC10IC^6; sbit CC11IR = CC11IC^7; sbit CC11IE = CC11IC^6; sbit CC12IR = CC12IC^7; sbit CC12IE = CC12IC^6; sbit CC13IR = CC13IC^7; sbit CC13IE = CC13IC^6; sbit CC14IR = CC14IC^7; sbit CC14IE = CC14IC^6; sbit CC15IR = CC15IC^7; sbit CC15IE = CC15IC^6; sbit CC16IR = CC16IC^7; sbit CC16IE = CC16IC^6; sbit CC17IR = CC17IC^7; sbit CC17IE = CC17IC^6; sbit CC18IR = CC18IC^7; sbit CC18IE = CC18IC^6; sbit CC19IR = CC19IC^7; sbit CC19IE = CC19IC^6; sbit CC20IR = CC20IC^7; sbit CC20IE = CC20IC^6; sbit CC21IR = CC21IC^7; sbit CC21IE = CC21IC^6; sbit CC22IR = CC22IC^7; sbit CC22IE = CC22IC^6; sbit CC23IR = CC23IC^7; sbit CC23IE = CC23IC^6; sbit CC24IR = CC24IC^7; sbit CC24IE = CC24IC^6; sbit CC25IR = CC25IC^7; sbit CC25IE = CC25IC^6; sbit CC26IR = CC26IC^7; sbit CC26IE = CC26IC^6; sbit CC27IR = CC27IC^7; sbit CC27IE = CC27IC^6; sbit CC28IR = CC28IC^7; sbit CC28IE = CC28IC^6; sbit CC29IR = CC29IC^7; sbit CC29IE = CC29IC^6; sbit CC30IR = CC30IC^7; sbit CC30IE = CC30IC^6; sbit CC31IR = CC31IC^7; sbit CC31IE = CC31IC^6; sbit ACC0 = CCM0^3; sbit ACC1 = CCM0^7; sbit ACC2 = CCM0^11; sbit ACC3 = CCM0^15; sbit ACC4 = CCM1^3; sbit ACC5 = CCM1^7; sbit ACC6 = CCM1^11; sbit ACC7 = CCM1^15; sbit ACC8 = CCM2^3; sbit ACC9 = CCM2^7; sbit ACC10 = CCM2^11; sbit ACC11 = CCM2^15; sbit ACC12 = CCM3^3; sbit ACC13 = CCM3^7; sbit ACC14 = CCM3^11; sbit ACC15 = CCM3^15; sbit ACC16 = CCM4^3; sbit ACC17 = CCM4^7; sbit ACC18 = CCM4^11; sbit ACC19 = CCM4^15; sbit ACC20 = CCM5^3; sbit ACC21 = CCM5^7; sbit ACC22 = CCM5^11; sbit ACC23 = CCM5^15; sbit ACC24 = CCM6^3; sbit ACC25 = CCM6^7; sbit ACC26 = CCM6^11; sbit ACC27 = CCM6^15; sbit ACC28 = CCM7^3; sbit ACC29 = CCM7^7; sbit ACC30 = CCM7^11; sbit ACC31 = CCM7^15; sbit T0IE = T0IC^6; sbit T0IR = T0IC^7; sbit T0M = T01CON^3; sbit T0R = T01CON^6; sbit T1IE = T1IC^6; sbit T1IR = T1IC^7; sbit T1M = T01CON^11; sbit T1R = T01CON^14; sbit T7IE = T7IC^6; sbit T7IR = T7IC^7; sbit T7M = T78CON^3; sbit T7R = T78CON^6; sbit T8IE = T8IC^6; sbit T8IR = T8IC^7; sbit T8M = T78CON^11; sbit T8R = T78CON^14; sfr CP = 0xFE10; sfr CSP = 0xFE08; sfr DPP0 = 0xFE00; sfr DPP1 = 0xFE02; sfr DPP2 = 0xFE04; sfr DPP3 = 0xFE06; sfr MDC = 0xFF0E; sfr MDH = 0xFE0C; sfr MDL = 0xFE0E; sfr ONES = 0xFF1E; sfr PSW = 0xFF10; sfr SP = 0xFE12; sfr STKOV = 0xFE14; sfr STKUN = 0xFE16; sfr SYSCON = 0xFF12; sfr TFR = 0xFFAC; sfr ZEROS = 0xFF1C; sfr BUSCON0 = 0xFF0C; sfr BUSCON1 = 0xFF14; sfr BUSCON2 = 0xFF16; sfr BUSCON3 = 0xFF18; sfr BUSCON4 = 0xFF1A; sfr ADDRSEL1 = 0xFE18; sfr ADDRSEL2 = 0xFE1A; sfr ADDRSEL3 = 0xFE1C; sfr ADDRSEL4 = 0xFE1E; sbit WRCFG = SYSCON^7; sbit CLKEN = SYSCON^8; sbit BYTDIS = SYSCON^9; sbit ROMEN = SYSCON^10; sbit SGTEN = SYSCON^11; sbit ROMS1 = SYSCON^12; sbit MDRIU = MDC^4; sbit N = PSW^0; sbit C = PSW^1; sbit V = PSW^2; sbit Z = PSW^3; sbit E = PSW^4; sbit MULIP = PSW^5; sbit USR0 = PSW^6; sbit HLDEN = PSW^10; sbit IEN = PSW^11; sbit RWDC0 = BUSCON0^4; sbit MTTC0 = BUSCON0^5; sbit ALECTL0 = BUSCON0^9; sbit BUSACT0 = BUSCON0^10; sbit RDYEN0 = BUSCON0^12; sbit RWDC1 = BUSCON1^4; sbit MTTC1 = BUSCON1^5; sbit ALECTL1 = BUSCON1^9; sbit BUSACT1 = BUSCON1^10; sbit RDYEN1 = BUSCON1^12; sbit CSREN1 = BUSCON1^14; sbit CSWEN1 = BUSCON1^15; sbit RWDC2 = BUSCON2^4; sbit MTTC2 = BUSCON2^5; sbit ALECTL2 = BUSCON2^9; sbit BUSACT2 = BUSCON2^10; sbit RDYEN2 = BUSCON2^12; sbit CSREN2 = BUSCON2^14; sbit CSWEN2 = BUSCON2^15; sbit RWDC3 = BUSCON3^4; sbit MTTC3 = BUSCON3^5; sbit ALECTL3 = BUSCON3^9; sbit BUSACT3 = BUSCON3^10; sbit RDYEN3 = BUSCON3^12; sbit CSREN3 = BUSCON3^14; sbit CSWEN3 = BUSCON3^15; sbit RWDC4 = BUSCON4^4; sbit MTTC4 = BUSCON4^5; sbit ALECTL4 = BUSCON4^9; sbit BUSACT4 = BUSCON4^10; sbit RDYEN4 = BUSCON4^12; sbit CSREN4 = BUSCON4^14; sbit CSWEN4 = BUSCON4^15; sbit ILLBUS = TFR^0; sbit ILLINA = TFR^1; sbit ILLOPA = TFR^2; sbit PRTFLT = TFR^3; sbit UNDOPC = TFR^7; sbit STKUF = TFR^13; sbit STKOF = TFR^14; sbit NMI = TFR^15; sfr EXICON = 0xF1C0; sfr ISNC = 0xF1DE; sbit RTCIE = ISNC^0; sbit RTCIR = ISNC^1; sbit PLLIE = ISNC^2; sbit PLLIR = ISNC^3; sfr PECC0 = 0xFEC0; sfr PECC1 = 0xFEC2; sfr PECC2 = 0xFEC4; sfr PECC3 = 0xFEC6; sfr PECC4 = 0xFEC8; sfr PECC5 = 0xFECA; sfr PECC6 = 0xFECC; sfr PECC7 = 0xFECE; sfr DP0L = 0xF100; sfr DP0H = 0xF102; sfr DP1L = 0xF104; sfr DP1H = 0xF106; sfr DP2 = 0xFFC2; sfr DP3 = 0xFFC6; sfr DP4 = 0xFFCA; sfr DP6 = 0xFFCE; sfr DP7 = 0xFFD2; sfr DP8 = 0xFFD6; sfr P0L = 0xFF00; sfr P0H = 0xFF02; sfr P1L = 0xFF04; sfr P1H = 0xFF06; sfr P2 = 0xFFC0; sfr P3 = 0xFFC4; sfr P4 = 0xFFC8; sfr P5 = 0xFFA2; sfr P6 = 0xFFCC; sfr P7 = 0xFFD0; sfr P8 = 0xFFD4; sfr ODP2 = 0xF1C2; sfr ODP3 = 0xF1C6; sfr ODP6 = 0xF1CE; sfr ODP7 = 0xF1D2; sfr ODP8 = 0xF1D6; sfr RP0H = 0xF108; sfr S0BG = 0xFEB4; sfr S0CON = 0xFFB0; sfr S0EIC = 0xFF70; sfr S0RBUF = 0xFEB2; sfr S0RIC = 0xFF6E; sfr S0TBUF = 0xFEB0; sfr S0TIC = 0xFF6C; sfr S0TBIC = 0xF19C; sbit S0STP = S0CON^3; sbit S0REN = S0CON^4; sbit S0PEN = S0CON^5; sbit S0FEN = S0CON^6; sbit S0OEN = S0CON^7; sbit S0PE = S0CON^8; sbit S0FE = S0CON^9; sbit S0OE = S0CON^10; sbit S0ODD = S0CON^12; sbit S0BRS = S0CON^13; sbit S0LB = S0CON^14; sbit S0R = S0CON^15; sbit S0TIE = S0TIC^6; sbit S0TIR = S0TIC^7; sbit S0TBIE = S0TBIC^6; sbit S0TBIR = S0TBIC^7; sbit S0RIE = S0RIC^6; sbit S0RIR = S0RIC^7; sbit S0EIE = S0EIC^6; sbit S0EIR = S0EIC^7; sfr SSCTIC = 0xFF72; sfr SSCRIC = 0xFF74; sfr SSCEIC = 0xFF76; sfr SSCTB = 0xF0B0; sfr SSCRB = 0xF0B2; sfr SSCBR = 0xF0B4; sfr SSCCON = 0xFFB2; sbit SSCHB = SSCCON^4; sbit SSCPH = SSCCON^5; sbit SSCPO = SSCCON^6; sbit SSCTE = SSCCON^8; sbit SSCTEN = SSCCON^8; sbit SSCRE = SSCCON^9; sbit SSCREN = SSCCON^9; sbit SSCPE = SSCCON^10; sbit SSCPEN = SSCCON^10; sbit SSCBE = SSCCON^11; sbit SSCBEN = SSCCON^11; sbit SSCBSY = SSCCON^12; sbit SSCMS = SSCCON^14; sbit SSCEN = SSCCON^15; sbit SSCTIR = SSCTIC^7; sbit SSCTIE = SSCTIC^6; sbit SSCRIR = SSCRIC^7; sbit SSCRIE = SSCRIC^6; sbit SSCEIR = SSCEIC^7; sbit SSCEIE = SSCEIC^6; sfr CAPREL = 0xFE4A; sfr CRIC = 0xFF6A; sfr T2 = 0xFE40; sfr T2CON = 0xFF40; sfr T2IC = 0xFF60; sfr T3 = 0xFE42; sfr T3CON = 0xFF42; sfr T3IC = 0xFF62; sfr T4 = 0xFE44; sfr T4CON = 0xFF44; sfr T4IC = 0xFF64; sfr T5 = 0xFE46; sfr T5CON = 0xFF46; sfr T5IC = 0xFF66; sfr T6 = 0xFE48; sfr T6CON = 0xFF48; sfr T6IC = 0xFF68; sfr WDT = 0xFEAE; sfr WDTCON = 0xFFAE; sbit CRIE = CRIC^6; sbit CRIR = CRIC^7; sbit T2R = T2CON^6; sbit T2UD = T2CON^7; sbit T2UDE = T2CON^8; sbit T2IE = T2IC^6; sbit T2IR = T2IC^7; sbit T3R = T3CON^6; sbit T3UD = T3CON^7; sbit T3UDE = T3CON^8; sbit T3OE = T3CON^9; sbit T3OTL = T3CON^10; sbit T3IE = T3IC^6; sbit T3IR = T3IC^7; sbit T4R = T4CON^6; sbit T4UD = T4CON^7; sbit T4UDE = T4CON^8; sbit T4IE = T4IC^6; sbit T4IR = T4IC^7; sbit T5R = T5CON^6; sbit T5UD = T5CON^7; sbit T5UDE = T5CON^8; sbit T5CLR = T5CON^14; sbit T5SC = T5CON^15; sbit T5IE = T5IC^6; sbit T5IR = T5IC^7; sbit T6R = T6CON^6; sbit T6UD = T6CON^7; sbit T6UDE = T6CON^8; sbit T6OE = T6CON^9; sbit T6OTL = T6CON^10; sbit T6SR = T6CON^15; sbit T6IE = T6IC^6; sbit T6IR = T6IC^7; sbit T0IN = P3^0; sbit T2IN = P3^7; sbit T3IN = P3^6; sbit T4IN = P3^5; sbit T5IN = P5^13; sbit T6IN = P5^12; sbit T2EUD = P5^15; sbit T3EUD = P3^4; sbit T4EUD = P5^14; sbit T5EUD = P5^11; sbit T6EUD = P5^10; sbit T3OUT = P3^3; sbit CAPIN = P3^2; sbit T6OUT = P3^1; sbit WDTIN = WDTCON^0; sbit WDTR = WDTCON^1; sfr PWMCON0 = 0xFF30; sfr PWMCON1 = 0xFF32; sfr PW0 = 0xFE30; sfr PW1 = 0xFE32; sfr PW2 = 0xFE34; sfr PW3 = 0xFE36; sfr PWMIC = 0xF17E; sfr PT0 = 0xF030; sfr PT1 = 0xF032; sfr PT2 = 0xF034; sfr PT3 = 0xF036; sfr PP0 = 0xF038; sfr PP1 = 0xF03A; sfr PP2 = 0xF03C; sfr PP3 = 0xF03E; sbit PTR0 = PWMCON0^0; sbit PTR1 = PWMCON0^1; sbit PTR2 = PWMCON0^2; sbit PTR3 = PWMCON0^3; sbit PTI0 = PWMCON0^4; sbit PTI1 = PWMCON0^5; sbit PTI2 = PWMCON0^6; sbit PTI3 = PWMCON0^7; sbit PIE0 = PWMCON0^8; sbit PIE1 = PWMCON0^9; sbit PIE2 = PWMCON0^10; sbit PIE3 = PWMCON0^11; sbit PIR0 = PWMCON0^12; sbit PIR1 = PWMCON0^13; sbit PIR2 = PWMCON0^14; sbit PIR3 = PWMCON0^15; sbit PEN0 = PWMCON1^0; sbit PEN1 = PWMCON1^1; sbit PEN2 = PWMCON1^2; sbit PEN3 = PWMCON1^3; sbit PM0 = PWMCON1^4; sbit PM1 = PWMCON1^5; sbit PM2 = PWMCON1^6; sbit PM3 = PWMCON1^7; sbit PB01 = PWMCON1^12; sbit PS2 = PWMCON1^14; sbit PS3 = PWMCON1^15; sbit PWMIR = PWMIC^7; sbit PWMIE = PWMIC^6; sfr XP0IC = 0xF186; sfr XP1IC = 0xF18E; sfr XP2IC = 0xF196; sfr XP3IC = 0xF19E; sbit XP0IR = XP0IC^7; sbit XP0IE = XP0IC^6; sbit XP1IR = XP1IC^7; sbit XP1IE = XP1IC^6; sbit XP2IR = XP2IC^7; sbit XP2IE = XP2IC^6; sbit XP3IR = XP3IC^7; sbit XP3IE = XP3IC^6; #line 5 "scope.h" #line 1 "C:\C166\INC\STDARG.H" #line 10 "C:\C166\INC\STDARG.H" #line 6 "scope.h" #line 6 "scope.h" #line 1 "C:\C166\INC\STDLIB.H" #line 10 "C:\C166\INC\STDLIB.H" #line 12 "C:\C166\INC\STDLIB.H" #line 14 "C:\C166\INC\STDLIB.H" #line 17 "C:\C166\INC\STDLIB.H" #line 19 "C:\C166\INC\STDLIB.H" #line 22 "C:\C166\INC\STDLIB.H" #line 24 "C:\C166\INC\STDLIB.H" #line 26 "C:\C166\INC\STDLIB.H" extern int abs (int val); extern long labs (long val); extern double atof (void *s1); extern long atol (void *s1); extern int atoi (void *s1); extern int rand (void); extern void srand (unsigned int); #line 38 "C:\C166\INC\STDLIB.H" #line 44 "C:\C166\INC\STDLIB.H" extern void far *malloc (size_t size); extern void free (void far *p); extern void init_mempool (void far *p, size_t size); extern void far *realloc (void far *p, size_t size); extern void far *calloc (size_t size, size_t len); extern void xhuge *xmalloc (unsigned long size); extern void xhuge *xcalloc (unsigned long size, unsigned long len); extern void xhuge *xrealloc (void xhuge *p, unsigned long size); extern void xinit_mempool (void xhuge *p, unsigned long size); extern void xfree (void xhuge *p); #line 7 "scope.h" #line 1 "C:\C166\INC\STDIO.H" #line 10 "C:\C166\INC\STDIO.H" #line 8 "scope.h" #line 8 "scope.h" #line 1 "C:\C166\INC\STRING.H" #line 10 "C:\C166\INC\STRING.H" #line 13 "C:\C166\INC\STRING.H" #line 15 "C:\C166\INC\STRING.H" #line 17 "C:\C166\INC\STRING.H" extern char *strcat (char *s1, char *s2); extern char *strncat (char *s1, char *s2, unsigned int n); extern int strcmp (char *s1, char *s2); extern int strncmp (char *s1, char *s2, unsigned int n); extern char *strcpy (char *s1, char *s2); extern char *strncpy (char *s1, char *s2, unsigned int n); extern size_t strlen (char *); extern char *strchr (char *s, char c); extern int strpos (char *s, char c); extern char *strrchr (char *s, char c); extern int strrpos (char *s, char c); extern int strspn (char *s, char *set); extern int strcspn (char *s, char *set); extern char *strpbrk (char *s, char *set); extern char *strrpbrk(char *s, char *set); extern int memcmp (void *s1, void *s2, unsigned int n); extern void *memcpy (void *s1, void *s2, unsigned int n); extern void *memchr (void *s, char val, unsigned int n); extern void *memccpy (void *s1, void *s2, char val, unsigned int n); extern void *memmove (void *s1, void *s2, unsigned int n); extern void *memset (void *s, char val, unsigned int n); extern char far *fstrcat (char far *s1, char far *s2); extern char far *fstrncat (char far *s1, char far *s2, unsigned int n); extern int fstrcmp (char far *s1, char far *s2); extern int fstrncmp (char far *s1, char far *s2, unsigned int n); extern char *fstrcpy (char far *s1, char far *s2); extern char *fstrncpy (char far *s1, char far *s2, unsigned int n); extern size_t fstrlen (char far *); extern char far *fstrchr (const char far *s, char c); extern char far *fstrrchr (const char far *s, char c); extern int fstrpos (const char far *s, char c); extern int fstrrpos (const char far *s, char c); extern int fstrspn (char far *s, char far *set); extern int fstrcspn (char far *s, char far *set); extern char *fstrpbrk (char far *s, char far *set); extern char *fstrrpbrk (char far *s, char far *set); extern int fmemcmp (void far *s1, void far *s2, unsigned int n); extern void far *fmemcpy (void far *s1, void far *s2, unsigned int n); extern void far *fmemchr (void far *s, char val, unsigned int n); extern void far *fmemccpy (void far *s1, void far *s2, char val, unsigned int n); extern void far *fmemmove (void far *s1, void far *s2, unsigned int n); extern void far *fmemset (void far *s, char val, unsigned int n); extern int xmemcmp (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemcpy (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemchr (void xhuge *s, char val, unsigned long n); extern void xhuge *xmemccpy (void xhuge *s1, void xhuge *s2, char val, unsigned long n); extern void xhuge *xmemmove (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemset (void xhuge *s, char val, unsigned long n); #line 9 "scope.h" #line 1 "C:\C166\INC\MATH.H" extern int abs (int val); extern long labs (long val); extern double fabs (double val); extern double sqrt (double val); extern double exp (double val); extern double log (double val); extern double log10 (double val); extern double sin (double val); extern double cos (double val); extern double tan (double val); extern double asin (double val); extern double acos (double val); extern double atan (double val); extern double sinh (double val); extern double cosh (double val); extern double tanh (double val); extern double atan2 (double y, double x); extern double ceil (double val); extern double floor (double val); extern double modf (double val, double *n); extern double pow (double x, double y); extern unsigned int _chkfloat_ (float x); extern unsigned int _chkdouble_ (double x); #line 10 "scope.h" #line 1 "C:\C166\INC\ABSACC.H" #line 10 "C:\C166\INC\ABSACC.H" #line 13 "C:\C166\INC\ABSACC.H" #line 11 "scope.h" #line 1 "C:\C166\INC\INTRINS.H" void _nop_ (void); void _idle_ (void); void _srvwdt_ (void); void _pwrdn_ (void); void _diswdt_ (void); void _einit_ (void); void _bfld_ (unsigned int sfr_, unsigned mask1, unsigned mask2); void _trap_ (int intno); void _atomic_ (int n_instr); void _endatomic_ (void); unsigned int _sof_ (void huge *); #line 22 "C:\C166\INC\INTRINS.H" #line 24 "C:\C166\INC\INTRINS.H" bit _testclear_ (bit); bit _testset_ (bit); extern unsigned char _crol_ (unsigned char, int); extern unsigned int _irol_ (unsigned int, int); extern unsigned long _lrol_ (unsigned long, int); extern unsigned char _cror_ (unsigned char, int); extern unsigned int _iror_ (unsigned int, int); extern unsigned long _lror_ (unsigned long, int); #line 12 "scope.h" #line 1 "global.h" #line 5 "global.h" #line 204 "global.h" #line 14 "scope.h" #line 1 "util.h" #line 3 "util.h" #line 120 "util.h" #line 17 "scope.h" #line 1 "astro.h" #line 3 "astro.h" #line 171 "astro.h" #line 18 "scope.h" #line 1 "usr.h" #line 3 "usr.h" #line 52 "usr.h" #line 19 "scope.h" #line 1 "int.h" #line 3 "int.h" #line 400 "int.h" #line 20 "scope.h" #line 1 "scope.h" #line 3 "scope.h" #line 48 "scope.h" #line 21 "scope.h" #line 1 "obj.h" #line 1 "C:\C166\INC\REG167.H" sfr ADCIC = 0xFF98; sfr ADCON = 0xFFA0; sfr ADDAT = 0xFEA0; sfr ADEIC = 0xFF9A; sfr ADDAT2 = 0xF0A0; sbit ADST = ADCON^7; sbit ADBSY = ADCON^8; sbit ADWR = ADCON^9; sbit ADCIN = ADCON^10; sbit ADCRQ = ADCON^11; sbit ADCIE = ADCIC^6; sbit ADCIR = ADCIC^7; sbit ADEIE = ADEIC^6; sbit ADEIR = ADEIC^7; sfr CC0 = 0xFE80; sfr CC0IC = 0xFF78; sfr CC1 = 0xFE82; sfr CC1IC = 0xFF7A; sfr CC2 = 0xFE84; sfr CC2IC = 0xFF7C; sfr CC3 = 0xFE86; sfr CC3IC = 0xFF7E; sfr CC4 = 0xFE88; sfr CC4IC = 0xFF80; sfr CC5 = 0xFE8A; sfr CC5IC = 0xFF82; sfr CC6 = 0xFE8C; sfr CC6IC = 0xFF84; sfr CC7 = 0xFE8E; sfr CC7IC = 0xFF86; sfr CC8 = 0xFE90; sfr CC8IC = 0xFF88; sfr CC9 = 0xFE92; sfr CC9IC = 0xFF8A; sfr CC10 = 0xFE94; sfr CC10IC = 0xFF8C; sfr CC11 = 0xFE96; sfr CC11IC = 0xFF8E; sfr CC12 = 0xFE98; sfr CC12IC = 0xFF90; sfr CC13 = 0xFE9A; sfr CC13IC = 0xFF92; sfr CC14 = 0xFE9C; sfr CC14IC = 0xFF94; sfr CC15 = 0xFE9E; sfr CC15IC = 0xFF96; sfr CC16 = 0xFE60; sfr CC16IC = 0xF160; sfr CC17 = 0xFE62; sfr CC17IC = 0xF162; sfr CC18 = 0xFE64; sfr CC18IC = 0xF164; sfr CC19 = 0xFE66; sfr CC19IC = 0xF166; sfr CC20 = 0xFE68; sfr CC20IC = 0xF168; sfr CC21 = 0xFE6A; sfr CC21IC = 0xF16A; sfr CC22 = 0xFE6C; sfr CC22IC = 0xF16C; sfr CC23 = 0xFE6E; sfr CC23IC = 0xF16E; sfr CC24 = 0xFE70; sfr CC24IC = 0xF170; sfr CC25 = 0xFE72; sfr CC25IC = 0xF172; sfr CC26 = 0xFE74; sfr CC26IC = 0xF174; sfr CC27 = 0xFE76; sfr CC27IC = 0xF176; sfr CC28 = 0xFE78; sfr CC28IC = 0xF178; sfr CC29 = 0xFE7A; sfr CC29IC = 0xF184; sfr CC30 = 0xFE7C; sfr CC30IC = 0xF18C; sfr CC31 = 0xFE7E; sfr CC31IC = 0xF194; sfr CCM0 = 0xFF52; sfr CCM1 = 0xFF54; sfr CCM2 = 0xFF56; sfr CCM3 = 0xFF58; sfr CCM4 = 0xFF22; sfr CCM5 = 0xFF24; sfr CCM6 = 0xFF26; sfr CCM7 = 0xFF28; sfr T0 = 0xFE50; sfr T01CON = 0xFF50; sfr T0IC = 0xFF9C; sfr T0REL = 0xFE54; sfr T1 = 0xFE52; sfr T1IC = 0xFF9E; sfr T1REL = 0xFE56; sfr T7 = 0xF050; sfr T78CON = 0xFF20; sfr T7IC = 0xF17A; sfr T7REL = 0xF054; sfr T8 = 0xF052; sfr T8IC = 0xF17C; sfr T8REL = 0xF056; sbit CC0IR = CC0IC^7; sbit CC0IE = CC0IC^6; sbit CC1IR = CC1IC^7; sbit CC1IE = CC1IC^6; sbit CC2IR = CC2IC^7; sbit CC2IE = CC2IC^6; sbit CC3IR = CC3IC^7; sbit CC3IE = CC3IC^6; sbit CC4IR = CC4IC^7; sbit CC4IE = CC4IC^6; sbit CC5IR = CC5IC^7; sbit CC5IE = CC5IC^6; sbit CC6IR = CC6IC^7; sbit CC6IE = CC6IC^6; sbit CC7IR = CC7IC^7; sbit CC7IE = CC7IC^6; sbit CC8IR = CC8IC^7; sbit CC8IE = CC8IC^6; sbit CC9IR = CC9IC^7; sbit CC9IE = CC9IC^6; sbit CC10IR = CC10IC^7; sbit CC10IE = CC10IC^6; sbit CC11IR = CC11IC^7; sbit CC11IE = CC11IC^6; sbit CC12IR = CC12IC^7; sbit CC12IE = CC12IC^6; sbit CC13IR = CC13IC^7; sbit CC13IE = CC13IC^6; sbit CC14IR = CC14IC^7; sbit CC14IE = CC14IC^6; sbit CC15IR = CC15IC^7; sbit CC15IE = CC15IC^6; sbit CC16IR = CC16IC^7; sbit CC16IE = CC16IC^6; sbit CC17IR = CC17IC^7; sbit CC17IE = CC17IC^6; sbit CC18IR = CC18IC^7; sbit CC18IE = CC18IC^6; sbit CC19IR = CC19IC^7; sbit CC19IE = CC19IC^6; sbit CC20IR = CC20IC^7; sbit CC20IE = CC20IC^6; sbit CC21IR = CC21IC^7; sbit CC21IE = CC21IC^6; sbit CC22IR = CC22IC^7; sbit CC22IE = CC22IC^6; sbit CC23IR = CC23IC^7; sbit CC23IE = CC23IC^6; sbit CC24IR = CC24IC^7; sbit CC24IE = CC24IC^6; sbit CC25IR = CC25IC^7; sbit CC25IE = CC25IC^6; sbit CC26IR = CC26IC^7; sbit CC26IE = CC26IC^6; sbit CC27IR = CC27IC^7; sbit CC27IE = CC27IC^6; sbit CC28IR = CC28IC^7; sbit CC28IE = CC28IC^6; sbit CC29IR = CC29IC^7; sbit CC29IE = CC29IC^6; sbit CC30IR = CC30IC^7; sbit CC30IE = CC30IC^6; sbit CC31IR = CC31IC^7; sbit CC31IE = CC31IC^6; sbit ACC0 = CCM0^3; sbit ACC1 = CCM0^7; sbit ACC2 = CCM0^11; sbit ACC3 = CCM0^15; sbit ACC4 = CCM1^3; sbit ACC5 = CCM1^7; sbit ACC6 = CCM1^11; sbit ACC7 = CCM1^15; sbit ACC8 = CCM2^3; sbit ACC9 = CCM2^7; sbit ACC10 = CCM2^11; sbit ACC11 = CCM2^15; sbit ACC12 = CCM3^3; sbit ACC13 = CCM3^7; sbit ACC14 = CCM3^11; sbit ACC15 = CCM3^15; sbit ACC16 = CCM4^3; sbit ACC17 = CCM4^7; sbit ACC18 = CCM4^11; sbit ACC19 = CCM4^15; sbit ACC20 = CCM5^3; sbit ACC21 = CCM5^7; sbit ACC22 = CCM5^11; sbit ACC23 = CCM5^15; sbit ACC24 = CCM6^3; sbit ACC25 = CCM6^7; sbit ACC26 = CCM6^11; sbit ACC27 = CCM6^15; sbit ACC28 = CCM7^3; sbit ACC29 = CCM7^7; sbit ACC30 = CCM7^11; sbit ACC31 = CCM7^15; sbit T0IE = T0IC^6; sbit T0IR = T0IC^7; sbit T0M = T01CON^3; sbit T0R = T01CON^6; sbit T1IE = T1IC^6; sbit T1IR = T1IC^7; sbit T1M = T01CON^11; sbit T1R = T01CON^14; sbit T7IE = T7IC^6; sbit T7IR = T7IC^7; sbit T7M = T78CON^3; sbit T7R = T78CON^6; sbit T8IE = T8IC^6; sbit T8IR = T8IC^7; sbit T8M = T78CON^11; sbit T8R = T78CON^14; sfr CP = 0xFE10; sfr CSP = 0xFE08; sfr DPP0 = 0xFE00; sfr DPP1 = 0xFE02; sfr DPP2 = 0xFE04; sfr DPP3 = 0xFE06; sfr MDC = 0xFF0E; sfr MDH = 0xFE0C; sfr MDL = 0xFE0E; sfr ONES = 0xFF1E; sfr PSW = 0xFF10; sfr SP = 0xFE12; sfr STKOV = 0xFE14; sfr STKUN = 0xFE16; sfr SYSCON = 0xFF12; sfr TFR = 0xFFAC; sfr ZEROS = 0xFF1C; sfr BUSCON0 = 0xFF0C; sfr BUSCON1 = 0xFF14; sfr BUSCON2 = 0xFF16; sfr BUSCON3 = 0xFF18; sfr BUSCON4 = 0xFF1A; sfr ADDRSEL1 = 0xFE18; sfr ADDRSEL2 = 0xFE1A; sfr ADDRSEL3 = 0xFE1C; sfr ADDRSEL4 = 0xFE1E; sbit WRCFG = SYSCON^7; sbit CLKEN = SYSCON^8; sbit BYTDIS = SYSCON^9; sbit ROMEN = SYSCON^10; sbit SGTEN = SYSCON^11; sbit ROMS1 = SYSCON^12; sbit MDRIU = MDC^4; sbit N = PSW^0; sbit C = PSW^1; sbit V = PSW^2; sbit Z = PSW^3; sbit E = PSW^4; sbit MULIP = PSW^5; sbit USR0 = PSW^6; sbit HLDEN = PSW^10; sbit IEN = PSW^11; sbit RWDC0 = BUSCON0^4; sbit MTTC0 = BUSCON0^5; sbit ALECTL0 = BUSCON0^9; sbit BUSACT0 = BUSCON0^10; sbit RDYEN0 = BUSCON0^12; sbit RWDC1 = BUSCON1^4; sbit MTTC1 = BUSCON1^5; sbit ALECTL1 = BUSCON1^9; sbit BUSACT1 = BUSCON1^10; sbit RDYEN1 = BUSCON1^12; sbit CSREN1 = BUSCON1^14; sbit CSWEN1 = BUSCON1^15; sbit RWDC2 = BUSCON2^4; sbit MTTC2 = BUSCON2^5; sbit ALECTL2 = BUSCON2^9; sbit BUSACT2 = BUSCON2^10; sbit RDYEN2 = BUSCON2^12; sbit CSREN2 = BUSCON2^14; sbit CSWEN2 = BUSCON2^15; sbit RWDC3 = BUSCON3^4; sbit MTTC3 = BUSCON3^5; sbit ALECTL3 = BUSCON3^9; sbit BUSACT3 = BUSCON3^10; sbit RDYEN3 = BUSCON3^12; sbit CSREN3 = BUSCON3^14; sbit CSWEN3 = BUSCON3^15; sbit RWDC4 = BUSCON4^4; sbit MTTC4 = BUSCON4^5; sbit ALECTL4 = BUSCON4^9; sbit BUSACT4 = BUSCON4^10; sbit RDYEN4 = BUSCON4^12; sbit CSREN4 = BUSCON4^14; sbit CSWEN4 = BUSCON4^15; sbit ILLBUS = TFR^0; sbit ILLINA = TFR^1; sbit ILLOPA = TFR^2; sbit PRTFLT = TFR^3; sbit UNDOPC = TFR^7; sbit STKUF = TFR^13; sbit STKOF = TFR^14; sbit NMI = TFR^15; sfr EXICON = 0xF1C0; sfr ISNC = 0xF1DE; sbit RTCIE = ISNC^0; sbit RTCIR = ISNC^1; sbit PLLIE = ISNC^2; sbit PLLIR = ISNC^3; sfr PECC0 = 0xFEC0; sfr PECC1 = 0xFEC2; sfr PECC2 = 0xFEC4; sfr PECC3 = 0xFEC6; sfr PECC4 = 0xFEC8; sfr PECC5 = 0xFECA; sfr PECC6 = 0xFECC; sfr PECC7 = 0xFECE; sfr DP0L = 0xF100; sfr DP0H = 0xF102; sfr DP1L = 0xF104; sfr DP1H = 0xF106; sfr DP2 = 0xFFC2; sfr DP3 = 0xFFC6; sfr DP4 = 0xFFCA; sfr DP6 = 0xFFCE; sfr DP7 = 0xFFD2; sfr DP8 = 0xFFD6; sfr P0L = 0xFF00; sfr P0H = 0xFF02; sfr P1L = 0xFF04; sfr P1H = 0xFF06; sfr P2 = 0xFFC0; sfr P3 = 0xFFC4; sfr P4 = 0xFFC8; sfr P5 = 0xFFA2; sfr P6 = 0xFFCC; sfr P7 = 0xFFD0; sfr P8 = 0xFFD4; sfr ODP2 = 0xF1C2; sfr ODP3 = 0xF1C6; sfr ODP6 = 0xF1CE; sfr ODP7 = 0xF1D2; sfr ODP8 = 0xF1D6; sfr RP0H = 0xF108; sfr S0BG = 0xFEB4; sfr S0CON = 0xFFB0; sfr S0EIC = 0xFF70; sfr S0RBUF = 0xFEB2; sfr S0RIC = 0xFF6E; sfr S0TBUF = 0xFEB0; sfr S0TIC = 0xFF6C; sfr S0TBIC = 0xF19C; sbit S0STP = S0CON^3; sbit S0REN = S0CON^4; sbit S0PEN = S0CON^5; sbit S0FEN = S0CON^6; sbit S0OEN = S0CON^7; sbit S0PE = S0CON^8; sbit S0FE = S0CON^9; sbit S0OE = S0CON^10; sbit S0ODD = S0CON^12; sbit S0BRS = S0CON^13; sbit S0LB = S0CON^14; sbit S0R = S0CON^15; sbit S0TIE = S0TIC^6; sbit S0TIR = S0TIC^7; sbit S0TBIE = S0TBIC^6; sbit S0TBIR = S0TBIC^7; sbit S0RIE = S0RIC^6; sbit S0RIR = S0RIC^7; sbit S0EIE = S0EIC^6; sbit S0EIR = S0EIC^7; sfr SSCTIC = 0xFF72; sfr SSCRIC = 0xFF74; sfr SSCEIC = 0xFF76; sfr SSCTB = 0xF0B0; sfr SSCRB = 0xF0B2; sfr SSCBR = 0xF0B4; sfr SSCCON = 0xFFB2; sbit SSCHB = SSCCON^4; sbit SSCPH = SSCCON^5; sbit SSCPO = SSCCON^6; sbit SSCTE = SSCCON^8; sbit SSCTEN = SSCCON^8; sbit SSCRE = SSCCON^9; sbit SSCREN = SSCCON^9; sbit SSCPE = SSCCON^10; sbit SSCPEN = SSCCON^10; sbit SSCBE = SSCCON^11; sbit SSCBEN = SSCCON^11; sbit SSCBSY = SSCCON^12; sbit SSCMS = SSCCON^14; sbit SSCEN = SSCCON^15; sbit SSCTIR = SSCTIC^7; sbit SSCTIE = SSCTIC^6; sbit SSCRIR = SSCRIC^7; sbit SSCRIE = SSCRIC^6; sbit SSCEIR = SSCEIC^7; sbit SSCEIE = SSCEIC^6; sfr CAPREL = 0xFE4A; sfr CRIC = 0xFF6A; sfr T2 = 0xFE40; sfr T2CON = 0xFF40; sfr T2IC = 0xFF60; sfr T3 = 0xFE42; sfr T3CON = 0xFF42; sfr T3IC = 0xFF62; sfr T4 = 0xFE44; sfr T4CON = 0xFF44; sfr T4IC = 0xFF64; sfr T5 = 0xFE46; sfr T5CON = 0xFF46; sfr T5IC = 0xFF66; sfr T6 = 0xFE48; sfr T6CON = 0xFF48; sfr T6IC = 0xFF68; sfr WDT = 0xFEAE; sfr WDTCON = 0xFFAE; sbit CRIE = CRIC^6; sbit CRIR = CRIC^7; sbit T2R = T2CON^6; sbit T2UD = T2CON^7; sbit T2UDE = T2CON^8; sbit T2IE = T2IC^6; sbit T2IR = T2IC^7; sbit T3R = T3CON^6; sbit T3UD = T3CON^7; sbit T3UDE = T3CON^8; sbit T3OE = T3CON^9; sbit T3OTL = T3CON^10; sbit T3IE = T3IC^6; sbit T3IR = T3IC^7; sbit T4R = T4CON^6; sbit T4UD = T4CON^7; sbit T4UDE = T4CON^8; sbit T4IE = T4IC^6; sbit T4IR = T4IC^7; sbit T5R = T5CON^6; sbit T5UD = T5CON^7; sbit T5UDE = T5CON^8; sbit T5CLR = T5CON^14; sbit T5SC = T5CON^15; sbit T5IE = T5IC^6; sbit T5IR = T5IC^7; sbit T6R = T6CON^6; sbit T6UD = T6CON^7; sbit T6UDE = T6CON^8; sbit T6OE = T6CON^9; sbit T6OTL = T6CON^10; sbit T6SR = T6CON^15; sbit T6IE = T6IC^6; sbit T6IR = T6IC^7; sbit T0IN = P3^0; sbit T2IN = P3^7; sbit T3IN = P3^6; sbit T4IN = P3^5; sbit T5IN = P5^13; sbit T6IN = P5^12; sbit T2EUD = P5^15; sbit T3EUD = P3^4; sbit T4EUD = P5^14; sbit T5EUD = P5^11; sbit T6EUD = P5^10; sbit T3OUT = P3^3; sbit CAPIN = P3^2; sbit T6OUT = P3^1; sbit WDTIN = WDTCON^0; sbit WDTR = WDTCON^1; sfr PWMCON0 = 0xFF30; sfr PWMCON1 = 0xFF32; sfr PW0 = 0xFE30; sfr PW1 = 0xFE32; sfr PW2 = 0xFE34; sfr PW3 = 0xFE36; sfr PWMIC = 0xF17E; sfr PT0 = 0xF030; sfr PT1 = 0xF032; sfr PT2 = 0xF034; sfr PT3 = 0xF036; sfr PP0 = 0xF038; sfr PP1 = 0xF03A; sfr PP2 = 0xF03C; sfr PP3 = 0xF03E; sbit PTR0 = PWMCON0^0; sbit PTR1 = PWMCON0^1; sbit PTR2 = PWMCON0^2; sbit PTR3 = PWMCON0^3; sbit PTI0 = PWMCON0^4; sbit PTI1 = PWMCON0^5; sbit PTI2 = PWMCON0^6; sbit PTI3 = PWMCON0^7; sbit PIE0 = PWMCON0^8; sbit PIE1 = PWMCON0^9; sbit PIE2 = PWMCON0^10; sbit PIE3 = PWMCON0^11; sbit PIR0 = PWMCON0^12; sbit PIR1 = PWMCON0^13; sbit PIR2 = PWMCON0^14; sbit PIR3 = PWMCON0^15; sbit PEN0 = PWMCON1^0; sbit PEN1 = PWMCON1^1; sbit PEN2 = PWMCON1^2; sbit PEN3 = PWMCON1^3; sbit PM0 = PWMCON1^4; sbit PM1 = PWMCON1^5; sbit PM2 = PWMCON1^6; sbit PM3 = PWMCON1^7; sbit PB01 = PWMCON1^12; sbit PS2 = PWMCON1^14; sbit PS3 = PWMCON1^15; sbit PWMIR = PWMIC^7; sbit PWMIE = PWMIC^6; sfr XP0IC = 0xF186; sfr XP1IC = 0xF18E; sfr XP2IC = 0xF196; sfr XP3IC = 0xF19E; sbit XP0IR = XP0IC^7; sbit XP0IE = XP0IC^6; sbit XP1IR = XP1IC^7; sbit XP1IE = XP1IC^6; sbit XP2IR = XP2IC^7; sbit XP2IE = XP2IC^6; sbit XP3IR = XP3IC^7; sbit XP3IE = XP3IC^6; #line 5 "obj.h" #line 1 "C:\C166\INC\STDARG.H" #line 10 "C:\C166\INC\STDARG.H" #line 6 "obj.h" #line 6 "obj.h" #line 1 "C:\C166\INC\STDLIB.H" #line 10 "C:\C166\INC\STDLIB.H" #line 12 "C:\C166\INC\STDLIB.H" #line 14 "C:\C166\INC\STDLIB.H" #line 17 "C:\C166\INC\STDLIB.H" #line 19 "C:\C166\INC\STDLIB.H" #line 22 "C:\C166\INC\STDLIB.H" #line 24 "C:\C166\INC\STDLIB.H" #line 26 "C:\C166\INC\STDLIB.H" extern int abs (int val); extern long labs (long val); extern double atof (void *s1); extern long atol (void *s1); extern int atoi (void *s1); extern int rand (void); extern void srand (unsigned int); #line 38 "C:\C166\INC\STDLIB.H" #line 44 "C:\C166\INC\STDLIB.H" extern void far *malloc (size_t size); extern void free (void far *p); extern void init_mempool (void far *p, size_t size); extern void far *realloc (void far *p, size_t size); extern void far *calloc (size_t size, size_t len); extern void xhuge *xmalloc (unsigned long size); extern void xhuge *xcalloc (unsigned long size, unsigned long len); extern void xhuge *xrealloc (void xhuge *p, unsigned long size); extern void xinit_mempool (void xhuge *p, unsigned long size); extern void xfree (void xhuge *p); #line 7 "obj.h" #line 1 "C:\C166\INC\STDIO.H" #line 10 "C:\C166\INC\STDIO.H" #line 8 "obj.h" #line 8 "obj.h" #line 1 "C:\C166\INC\STRING.H" #line 10 "C:\C166\INC\STRING.H" #line 13 "C:\C166\INC\STRING.H" #line 15 "C:\C166\INC\STRING.H" #line 17 "C:\C166\INC\STRING.H" extern char *strcat (char *s1, char *s2); extern char *strncat (char *s1, char *s2, unsigned int n); extern int strcmp (char *s1, char *s2); extern int strncmp (char *s1, char *s2, unsigned int n); extern char *strcpy (char *s1, char *s2); extern char *strncpy (char *s1, char *s2, unsigned int n); extern size_t strlen (char *); extern char *strchr (char *s, char c); extern int strpos (char *s, char c); extern char *strrchr (char *s, char c); extern int strrpos (char *s, char c); extern int strspn (char *s, char *set); extern int strcspn (char *s, char *set); extern char *strpbrk (char *s, char *set); extern char *strrpbrk(char *s, char *set); extern int memcmp (void *s1, void *s2, unsigned int n); extern void *memcpy (void *s1, void *s2, unsigned int n); extern void *memchr (void *s, char val, unsigned int n); extern void *memccpy (void *s1, void *s2, char val, unsigned int n); extern void *memmove (void *s1, void *s2, unsigned int n); extern void *memset (void *s, char val, unsigned int n); extern char far *fstrcat (char far *s1, char far *s2); extern char far *fstrncat (char far *s1, char far *s2, unsigned int n); extern int fstrcmp (char far *s1, char far *s2); extern int fstrncmp (char far *s1, char far *s2, unsigned int n); extern char *fstrcpy (char far *s1, char far *s2); extern char *fstrncpy (char far *s1, char far *s2, unsigned int n); extern size_t fstrlen (char far *); extern char far *fstrchr (const char far *s, char c); extern char far *fstrrchr (const char far *s, char c); extern int fstrpos (const char far *s, char c); extern int fstrrpos (const char far *s, char c); extern int fstrspn (char far *s, char far *set); extern int fstrcspn (char far *s, char far *set); extern char *fstrpbrk (char far *s, char far *set); extern char *fstrrpbrk (char far *s, char far *set); extern int fmemcmp (void far *s1, void far *s2, unsigned int n); extern void far *fmemcpy (void far *s1, void far *s2, unsigned int n); extern void far *fmemchr (void far *s, char val, unsigned int n); extern void far *fmemccpy (void far *s1, void far *s2, char val, unsigned int n); extern void far *fmemmove (void far *s1, void far *s2, unsigned int n); extern void far *fmemset (void far *s, char val, unsigned int n); extern int xmemcmp (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemcpy (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemchr (void xhuge *s, char val, unsigned long n); extern void xhuge *xmemccpy (void xhuge *s1, void xhuge *s2, char val, unsigned long n); extern void xhuge *xmemmove (void xhuge *s1, void xhuge *s2, unsigned long n); extern void xhuge *xmemset (void xhuge *s, char val, unsigned long n); #line 9 "obj.h" #line 1 "C:\C166\INC\MATH.H" extern int abs (int val); extern long labs (long val); extern double fabs (double val); extern double sqrt (double val); extern double exp (double val); extern double log (double val); extern double log10 (double val); extern double sin (double val); extern double cos (double val); extern double tan (double val); extern double asin (double val); extern double acos (double val); extern double atan (double val); extern double sinh (double val); extern double cosh (double val); extern double tanh (double val); extern double atan2 (double y, double x); extern double ceil (double val); extern double floor (double val); extern double modf (double val, double *n); extern double pow (double x, double y); extern unsigned int _chkfloat_ (float x); extern unsigned int _chkdouble_ (double x); #line 10 "obj.h" #line 1 "C:\C166\INC\ABSACC.H" #line 10 "C:\C166\INC\ABSACC.H" #line 13 "C:\C166\INC\ABSACC.H" #line 11 "obj.h" #line 1 "C:\C166\INC\INTRINS.H" void _nop_ (void); void _idle_ (void); void _srvwdt_ (void); void _pwrdn_ (void); void _diswdt_ (void); void _einit_ (void); void _bfld_ (unsigned int sfr_, unsigned mask1, unsigned mask2); void _trap_ (int intno); void _atomic_ (int n_instr); void _endatomic_ (void); unsigned int _sof_ (void huge *); #line 22 "C:\C166\INC\INTRINS.H" #line 24 "C:\C166\INC\INTRINS.H" bit _testclear_ (bit); bit _testset_ (bit); extern unsigned char _crol_ (unsigned char, int); extern unsigned int _irol_ (unsigned int, int); extern unsigned long _lrol_ (unsigned long, int); extern unsigned char _cror_ (unsigned char, int); extern unsigned int _iror_ (unsigned int, int); extern unsigned long _lror_ (unsigned long, int); #line 12 "obj.h" #line 1 "global.h" #line 5 "global.h" #line 204 "global.h" #line 14 "obj.h" #line 1 "util.h" #line 3 "util.h" #line 120 "util.h" #line 17 "obj.h" #line 1 "astro.h" #line 3 "astro.h" #line 171 "astro.h" #line 18 "obj.h" #line 1 "usr.h" #line 3 "usr.h" #line 52 "usr.h" #line 19 "obj.h" #line 1 "int.h" #line 3 "int.h" #line 400 "int.h" #line 20 "obj.h" #line 1 "scope.h" #line 3 "scope.h" #line 48 "scope.h" #line 21 "obj.h" typedef struct objectstruct { char name[18]; char ra[12]; char dec[12]; } objectstruct; extern objectstruct objlist[ 100 + 1]; extern void getListObj( void ); extern void setListObj( void ); extern void clearObjList( void ); extern void serialObjListDownload( void ); #line 22 "scope.h" extern void scope(void); extern void encode(void); extern void showEncoders(int mode); extern void encAutoTestHo( void ); extern void encAutoTestVe( void ); #line 3 "scope.c" void initEncoderValues( void ) { ARC10PERENCHO = 12960000 / CFG_ENC_HO; ARC10PERENCVE = 12960000 / CFG_ENC_VE; } void initScopeValues( void ) { double abs,v; v = (double)1296000 / (double)CFG_HSTS_HO; v = v - (double)CFG_HSTS_HO; modf( v, &abs ); HSTEPSHO359 = (long)abs; v = (double)324000 / (double)CFG_HSTS_HO; modf( v, &abs ); HSTEPSHO090 = (long)abs; v = (double)648000 / (double)CFG_HSTS_HO; modf( v, &abs ); HSTEPSHO180 = (long)abs; v = (double)972000 / (double)CFG_HSTS_HO; modf( v, &abs ); HSTEPSHO270 = (long)abs; } int hstepsSector( long val ) { if( ( val >= 0 ) && ( val < HSTEPSHO090 ) ){ return(0); } if( ( val >= HSTEPSHO090 ) && ( val < HSTEPSHO180 ) ){ return(1); } if( ( val >= HSTEPSHO180 ) && ( val < HSTEPSHO270 ) ){ return(2); } return(3); } void origin( void ) { double abs,v; (*(double volatile sdata *)0x0e020) = (*(double volatile sdata *)0x0e058); (*(double volatile sdata *)0x0e028) = (*(double volatile sdata *)0x0e060); cCurrentStarTime(); cAzAlt(); v = ( (double)(*(double volatile sdata *)0x0e030) * (double)3600 ) / (double)CFG_HSTS_HO; modf( v, &abs ); CUR_HSTEPS_HO = (long)abs; v = ( (double)(*(double volatile sdata *)0x0e038) * (double)3600 ) / (double)CFG_HSTS_VE; modf( v, &abs ); CUR_HSTEPS_VE = (long)abs; v = (double)CUR_HSTEPS_HO * (double)CFG_HSTS_HO * (double)10; modf( v , &abs); CUR_ARC10_HO = (long)abs; v = (double)CUR_HSTEPS_VE * (double)CFG_HSTS_VE * (double)10; modf( v , &abs); CUR_ARC10_VE = (long)abs; ENC_ARC10_HO = CUR_ARC10_HO; ENC_ARC10_VE = CUR_ARC10_VE; ENCHO_COR = 0; ENCVE_COR = 0; } int calcTarget( void ) { double abs,v; int cursector,trgsector,flag; long curho,curve,trgho,trgve; cCurrentStarTime(); cAzAlt(); v = ( (double)(*(double volatile sdata *)0x0e030) * (double)3600 ) / (double)CFG_HSTS_HO; modf( v, &abs ); trgho = (long)abs; v = ( (double)(*(double volatile sdata *)0x0e038) * (double)3600 ) / (double)CFG_HSTS_VE; modf( v, &abs ); trgve = (long)abs; TRG_HSTEPS_HO = trgho; TRG_HSTEPS_VE = trgve; curho = CUR_HSTEPS_HO; curve = CUR_HSTEPS_VE; v = (double)curho * (double)CFG_HSTS_HO * (double)10; modf( v , &abs); CUR_ARC10_HO = (long)abs; v = (double)curve * (double)CFG_HSTS_VE * (double)10; modf( v , &abs); CUR_ARC10_VE = (long)abs; cursector = hstepsSector( curho ); trgsector = hstepsSector( trgho ); flag = 0; if( trgve == curve ) { flag++; MOTVE_RUN = 0; } else { if( trgve < curve ){ MOTVE_DIR = 1; } else { MOTVE_DIR = 0; } MOTVE_RUN = 1; } if( trgho == curho ) { flag++; MOTHO_RUN = 0; } else { switch( cursector ) { case 0: switch( trgsector ) { case 0: if( trgho < curho ){ MOTHO_DIR = 1; } else { MOTHO_DIR = 0; } break; case 3: MOTHO_DIR = 1; break; case 1: MOTHO_DIR = 0; break; case 2: MOTHO_DIR = 0; break; } break; case 3: switch( trgsector ) { case 0: MOTHO_DIR = 0; break; case 3: if( trgho < curho ){ MOTHO_DIR = 1; } else { MOTHO_DIR = 0; } break; case 1: MOTHO_DIR = 1; break; case 2: MOTHO_DIR = 1; break; } break; case 1: switch( trgsector ) { case 0: MOTHO_DIR = 1; break; case 3: MOTHO_DIR = 0; break; case 1: if( trgho < curho ){ MOTHO_DIR = 1; } else { MOTHO_DIR = 0; } break; case 2: MOTHO_DIR = 0; break; } break; case 2: switch( trgsector ) { case 0: MOTHO_DIR = 1; break; case 3: MOTHO_DIR = 0; break; case 1: MOTHO_DIR = 1; break; case 2: if( trgho < curho ){ MOTHO_DIR = 1; } else { MOTHO_DIR = 0; } break; } break; } MOTHO_RUN = 1; } if( MOTFR_USE == 1 ) { ; } if( flag == 2 ) { return(1); } return(0); } int correction ( unsigned char KEY, char speedflag ) { int speed,speedct; unsigned char mflags,_key; double v,abs; if( ( KEY == 'L' ) || ( KEY == 'R' ) ) { _key = KEY; speed = SPEED_HO; speedct = SPEED_HO_CT; mflags = MOT_FLAGS; MOT_FLAGS = 0; if( speedflag == '1' ){ SPEED_HO = (*(int volatile sdata *)0x0e068); } else { SPEED_HO = (*(int volatile sdata *)0x0e06c); } MOT_CORRECTION = 1; SPEED_HO_CT = 0; if( KEY == 'L' ) { MOTHO_DIR = 1; } MOTHO_RUN = 1; while( testkey() == _key ) {;} MOTHO_RUN = 0; SPEED_HO = speed; SPEED_HO_CT = speedct; MOT_FLAGS = mflags; v = (double)CUR_HSTEPS_HO * (double)CFG_HSTS_HO * (double)10; modf( v , &abs); CUR_ARC10_HO = (long)abs; return(1); } if( ( KEY == 'U' ) || ( KEY == 'D' ) ) { _key = KEY; speed = SPEED_VE; speedct = SPEED_VE_CT; mflags = MOT_FLAGS; MOT_FLAGS = 0; if( speedflag == '1' ){ SPEED_VE = (*(int volatile sdata *)0x0e06a); } else { SPEED_VE = (*(int volatile sdata *)0x0e06e); } MOT_CORRECTION = 1; SPEED_VE_CT = 0; if( KEY == 'D' ) { MOTVE_DIR = 1; } MOTVE_RUN = 1; while( testkey() == _key ) {;} MOTVE_RUN = 0; SPEED_VE = speed; SPEED_VE_CT = speedct; MOT_FLAGS = mflags; v = (double)CUR_HSTEPS_VE * (double)CFG_HSTS_VE * (double)10; modf( v , &abs); CUR_ARC10_VE = (long)abs; return(1); } return(0); } void scope( void ) { unsigned char KEY; char status2[20]; int mode,upd; double ho,ve; long test; MOT_FLAGS = 0; lcd_clear(); initEncoderValues(); initScopeValues(); KEY = 0; mode = 0; upd = 1; strcpy( status2,"a1 s1 f0 m0 e0"); MOTORSWITCH=0; if( ENCHO_USE ){ startEncoderIntsHo(); } if( ENCVE_USE ) { startEncoderIntsVe(); } while( KEY != 'C' ) { if(upd){ lcd_clear(); switch( mode ) { case 0: status2[10] = '0'; status2[7] = '0'; status2[13] = '0'; if( MOT_GOTO == 1 ){ status2[10] = '1'; } if( MOTFR_USE == 1 ){ status2[7] = '1'; } if( ( ENCHO_CORUSE == 1 ) || ( ENCVE_CORUSE == 1 )){ status2[13] = '1'; } lcd_puts(3,0,status2); break; case 1: printDegrees(2,(*(double volatile sdata *)0x0e058)); printDegrees(3,(*(double volatile sdata *)0x0e060)); break; } upd = 0; } printArc10Degrees(0,CUR_ARC10_HO); printArc10Degrees(1,CUR_ARC10_VE); KEY = testkey(); if( ! KEY ) { if( MOT_GOTO == 1 ) { if( calcTarget() ) { if( status2[1] == '0' ){ MOT_GOTO = 0; MOTHO_RUN = 0; MOTVE_RUN = 0; upd = 1; } } test++; } continue; } if( correction( KEY, status2[4] ) ) { upd = 1; continue; } KEY = readkey(); if( ! KEY ) { continue; } if( KEY == '7' ){ if( MOTFR_USE == 0 ){ MOTFR_USE = 1; } else { MOTFR_USE = 0; } upd = 1; continue; } if( KEY == '6' ){ if( status2[1] == '0' ){ status2[1] = '1'; } else { status2[1] = '0'; } upd = 1; continue; } if( KEY == '8' ){ if( ENCHO_USE == 1 ) { if( ENCHO_CORUSE == 1 ) { ENCHO_CORUSE = 0; } else { ENCHO_CORUSE = 1; } } if( ENCVE_USE == 1 ) { if( ENCVE_CORUSE == 1 ) { ENCVE_CORUSE = 0; } else { ENCVE_CORUSE = 1; } } upd = 1; continue; } if( KEY == '9' ){ if( status2[4] == '1' ){ status2[4] = '2'; } else { status2[4] = '1'; } upd = 1; continue; } if( KEY == '5' ){ mode++; if(mode > 1){ mode = 0; } upd = 1; continue; } MOT_GOTO = 0; MOT_CORRECTION = 0; MOTHO_RUN = 0; MOTVE_RUN = 0; ENCHO_COR = 0; ENCVE_COR = 0; upd = 1; if( KEY == '4' ) { SPEED_HO = (*(int volatile sdata *)0x0e070); SPEED_VE = (*(int volatile sdata *)0x0e072); SPEED_FR = (*(int volatile sdata *)0x0e074); SPEED_HO_CT = 0; SPEED_VE_CT = 0; SPEED_FR_CT = 0; (*(double volatile sdata *)0x0e020) = (*(double volatile sdata *)0x0e058); (*(double volatile sdata *)0x0e028) = (*(double volatile sdata *)0x0e060); if( status2[1] == '1' ) { test = 0; calcTarget(); MOT_GOTO = 1; } else { if( ! calcTarget() ) { test = 0; MOT_GOTO = 1; } } continue; } if( KEY == 'E' ) { SPEED_HO = (*(int volatile sdata *)0x0e070); SPEED_VE = (*(int volatile sdata *)0x0e072); SPEED_FR = (*(int volatile sdata *)0x0e074); SPEED_HO_CT = 0; SPEED_VE_CT = 0; SPEED_FR_CT = 0; (*(double volatile sdata *)0x0e030) = ( (double)CUR_HSTEPS_HO * (double)CFG_HSTS_HO ) / (double)3600; (*(double volatile sdata *)0x0e038) = ( (double)CUR_HSTEPS_VE * (double)CFG_HSTS_VE ) / (double)3600; cCurrentStarTime(); cRaDec(); status2[1] = '1'; test = 0; calcTarget(); MOT_GOTO = 1; continue; } if( KEY == '1' ){ ho = (*(double volatile sdata *)0x0e020); ve = (*(double volatile sdata *)0x0e028); (*(double volatile sdata *)0x0e030) = ( (double)CUR_HSTEPS_HO * (double)CFG_HSTS_HO ) / (double)3600; (*(double volatile sdata *)0x0e038) = ( (double)CUR_HSTEPS_VE * (double)CFG_HSTS_VE ) / (double)3600; cCurrentStarTime(); cRaDec(); usrGetKoor(0, (*(double volatile sdata *)0x0e020), (*(double volatile sdata *)0x0e028) ); (*(double volatile sdata *)0x0e020) = ho; (*(double volatile sdata *)0x0e028) = ve; continue; } if( KEY == '2' ){ getListObj(); continue; } if( KEY == '3' ){ origin(); continue; } } MOT_FLAGS = 0; MOTORSWITCH=1; stopEncoderInts(); sprintf(status2,"%10ld",test); lcd_puts(3,0,status2); while( readkey() == 0 ){;} } void encode( void ) { unsigned char KEY; char tmp1[20]; char tmp2[20]; int mode,upd; lcd_clear(); ENCHO_CORUSE = 0; ENCVE_CORUSE = 0; initEncoderValues(); if( ENCHO_USE ){ startEncoderIntsHo(); } if( ENCVE_USE ) { startEncoderIntsVe(); } KEY = 0; mode = 0; upd = 1; while( KEY != 'C' ) { switch( mode ) { case 0: printArc10Degrees(0,ENC_ARC10_HO); printArc10Degrees(1,ENC_ARC10_VE); break; case 1: (*(double volatile sdata *)0x0e030) = lArc10dDegrees( ENC_ARC10_HO ); (*(double volatile sdata *)0x0e038) = lArc10dDegrees( ENC_ARC10_VE ); cCurrentStarTime(); cRaDec(); printDegrees(0,(*(double volatile sdata *)0x0e020)); printDegrees(1,(*(double volatile sdata *)0x0e028)); break; } if(upd){ switch( mode ) { case 0: strcpy(tmp1,"AZ K"); strcpy(tmp2,"ALT K"); lcd_puts(0,11,tmp1); lcd_puts(1,11,tmp2); printArc10Degrees(2,(*(long volatile sdata *)0x0e040)); printArc10Degrees(3,(*(long volatile sdata *)0x0e044)); strcpy(tmp1,"AZ O"); strcpy(tmp2,"ALT O"); lcd_puts(2,11,tmp1); lcd_puts(3,11,tmp2); break; case 1: strcpy(tmp1,"RA K"); strcpy(tmp2,"DEC K"); lcd_puts(0,11,tmp1); lcd_puts(1,11,tmp2); printDegrees(2,(*(double volatile sdata *)0x0e058)); printDegrees(3,(*(double volatile sdata *)0x0e060)); strcpy(tmp1,"RA O"); strcpy(tmp2,"DEC O"); lcd_puts(2,11,tmp1); lcd_puts(3,11,tmp2); break; } upd = 0; } KEY = 0; KEY = readkey(); if( KEY ){ if( KEY == '5' ){ if( mode == 0 ) { mode = 1; } else { mode = 0; } upd = 1; continue; } if( KEY == '1' ){ mode = 1; usrGetKoor(0, 0, 0); upd = 1; continue; } if( KEY == '2' ){ mode = 1; getListObj(); upd = 1; continue; } if( KEY == '3' ){ origin(); upd = 1; continue; } } } stopEncoderInts(); } void showEncoders( int mode ) { unsigned char KEY; char tmp1[20]; char tmp2[20]; lcd_clear(); ENCHO_CORUSE = 0; ENCVE_CORUSE = 0; initEncoderValues(); switch( mode ){ case 0: sprintf(tmp1,"ENC HORIZONTAL"); sprintf(tmp2,"ENC VERTICAL"); break; case 1: sprintf(tmp1,"ARC10 HORIZONTAL"); sprintf(tmp2,"ARC10 VERTICAL"); break; case 2: sprintf(tmp1,"AZ"); sprintf(tmp2,"ALT"); break; case 3: sprintf(tmp1,"RA"); sprintf(tmp2,"DEC"); break; } lcd_puts(0,0,tmp1); lcd_puts(2,0,tmp2); if( ENCHO_USE ){ startEncoderIntsHo(); } if( ENCVE_USE ) { startEncoderIntsVe(); } KEY = 0; while(! KEY ) { KEY = readkey(); switch( mode ) { case 0: sprintf(tmp1,"%010ld",ENC_ARC10_HO); sprintf(tmp2,"%010ld",ENC_ARC10_VE); lcd_puts(1,0,tmp1); lcd_puts(3,0,tmp2); break; case 1: printArc10Degrees(1,ENC_ARC10_HO); printArc10Degrees(3,ENC_ARC10_VE); break; case 2: (*(double volatile sdata *)0x0e030) = lArc10dDegrees( ENC_ARC10_HO ); (*(double volatile sdata *)0x0e038) = lArc10dDegrees( ENC_ARC10_VE ); cCurrentStarTime(); cRaDec(); printDegrees(1,(*(double volatile sdata *)0x0e020)); printDegrees(3,(*(double volatile sdata *)0x0e028)); break; } } stopEncoderInts(); } void encAutoTestHo( void ) { char tmp[20]; int signr,ct; long l,enc; double d; lcd_clear(); sprintf(tmp,"TYPE NR ENCSIGS."); lcd_puts(0,0,tmp); while( readkey() == 0 ){;} signr = usrGetInt( 0 , 10 ); if( signr <= 0){ return; } lcd_clear(); sprintf(tmp,"PLEASE WAIT"); lcd_puts(0,0,tmp); initEncoderValues(); initScopeValues(); MOT_FLAGS = 0; stopEncoderInts(); MOTORSWITCH=0; ENCHO_COR = 0; ENCHO_CORUSE = 0; startEncoderIntsHo(); SPEED_HO = (*(int volatile sdata *)0x0e070); SPEED_HO_CT = 0; CUR_HSTEPS_HO = 0; MOTHO_DIR = 0; MOT_CORRECTION = 1; ENC_ARC10_HO = (long)0; MOTHO_RUN = 1; while( ENC_ARC10_HO == (long)0 ) {;} MOTHO_RUN = 0; ENC_ARC10_HO = (long)0; MOTHO_RUN = 1; while( ENC_ARC10_HO == (long)0 ) {;} MOTHO_RUN = 0; CUR_HSTEPS_HO = 0; ENC_ARC10_HO = 0; enc = (long)signr * (long)ARC10PERENCHO; ct = 0; MOTHO_RUN = 1; while( ENC_ARC10_HO < enc ) {;} MOT_FLAGS = 0; MOTORSWITCH=1; stopEncoderInts(); lcd_clear(); sprintf(tmp,"HALFSTEPS:"); lcd_puts(0,0,tmp); sprintf(tmp,"%10ld",CUR_HSTEPS_HO); lcd_puts(1,0,tmp); sprintf(tmp,"HALFSTEPSIZE:"); lcd_puts(2,0,tmp); l = (long)ENC_ARC10_HO; d = (double)l / (double) CUR_HSTEPS_HO; d = (double)d / (double)10; sprintf(tmp,"%016.6f",d); lcd_puts(3,0,tmp); while( readkey() == 0 ){;} CFG_HSTS_HO = d; } void encAutoTestVe( void ) { char tmp[20]; int signr,ct; long l,enc; double d; lcd_clear(); sprintf(tmp,"TYPE NR ENCSIGS."); lcd_puts(0,0,tmp); while( readkey() == 0 ){;} signr = usrGetInt( 0 , 10 ); if( signr <= 0){ return; } lcd_clear(); sprintf(tmp,"PLEASE WAIT"); lcd_puts(0,0,tmp); initEncoderValues(); initScopeValues(); MOT_FLAGS = 0; stopEncoderInts(); MOTORSWITCH=0; ENCVE_COR = 0; ENCVE_CORUSE = 0; startEncoderIntsVe(); SPEED_VE = (*(int volatile sdata *)0x0e072); SPEED_VE_CT = 0; CUR_HSTEPS_VE = 0; MOTVE_DIR = 0; MOT_CORRECTION = 1; ENC_ARC10_VE = (long)0; MOTVE_RUN = 1; while( ENC_ARC10_VE == (long)0 ) {;} MOTVE_RUN = 0; ENC_ARC10_VE = (long)0; MOTVE_RUN = 1; while( ENC_ARC10_VE == (long)0 ) {;} MOTVE_RUN = 0; CUR_HSTEPS_VE = 0; ENC_ARC10_VE = 0; enc = (long)signr * (long)ARC10PERENCVE; ct = 0; MOTVE_RUN = 1; while( ENC_ARC10_VE < enc ) {;} MOT_FLAGS = 0; MOTORSWITCH=1; stopEncoderInts(); lcd_clear(); sprintf(tmp,"HALFSTEPS:"); lcd_puts(0,0,tmp); sprintf(tmp,"%10ld",CUR_HSTEPS_VE); lcd_puts(1,0,tmp); sprintf(tmp,"HALFSTEPSIZE:"); lcd_puts(2,0,tmp); l = (long)ENC_ARC10_VE; d = (double)l / (double) CUR_HSTEPS_VE; d = (double)d / (double)10; sprintf(tmp,"%016.6f",d); lcd_puts(3,0,tmp); while( readkey() == 0 ){;} CFG_HSTS_VE = d; } #line 24 "MAIN.C" typedef struct configstruct { int __initid; double __LATITUDE; double __LONGITUDE; double __CFG_HSTS_HO; double __CFG_HSTS_VE; double __CFG_HSTS_FR; int __CFG_SP1_HO; int __CFG_SP1_VE; int __CFG_SP2_HO; int __CFG_SP2_VE; int __CFG_SP3_HO; int __CFG_SP3_VE; int __CFG_SP_FR; int __CFG_ENC_HO; int __CFG_ENC_VE; unsigned char __ENC_FLAGS; unsigned char __RESERVE; } configstruct; configstruct cfg[4]; int curconfig; const char main_txt0[18] = " C167 ELTEL\0"; const char main_txt1[18] = " VERSION 1.00\0"; const char main_txt2[18] = " E. Benninghaus\0"; const char main_txt3[18] = " Rottweil 2003\0"; const char menu_txt[3][18] = { " ELTEL MOTORS\0", " ELTEL ENCODE\0", " ELTEL CONFIG\0" }; const char cfg_txt[29][18] = { " DATE-TIME\0", " LATITUDE\0", " LONGITUDE\0", " ENCODER HO\0", " ENCODER VE\0", " HSTEPSIZE HO\0", " HSTEPSIZE VE\0", " HSTEPSIZE FR\0", " SPEED COR.1 HO\0", " SPEED COR.1 VE\0", " SPEED COR.2 HO\0", " SPEED COR.2 VE\0", " SPEED GOTO HO\0", " SPEED GOTO VE\0", " SPEED GOTO FR\0", " ON/OFF ENC HO\0", " ON/OFF ENC VE\0", " SHOW ENC ARCS\0", " SHOW ENC AZALT\0", " SHOW ENC RADEC\0", " AUTOTEST ENCHO\0", " AUTOTEST ENCVE\0", " SAVE CONFIG\0", " SET CONFIG 1\0", " SET CONFIG 2\0", " SET CONFIG 3\0", " SET CONFIG 4\0", " EDIT OBJLIST\0", " SERIAL OBJLOAD\0" }; void getConfiguration( void ) { if( cfg[curconfig].__initid != 12345 ) { return; } (*(double volatile sdata *)0x0e008) = cfg[curconfig].__LATITUDE; (*(double volatile sdata *)0x0e000) = cfg[curconfig].__LONGITUDE; CFG_HSTS_HO = cfg[curconfig].__CFG_HSTS_HO; CFG_HSTS_VE = cfg[curconfig].__CFG_HSTS_VE; CFG_HSTS_FR = cfg[curconfig].__CFG_HSTS_FR; (*(int volatile sdata *)0x0e068) = cfg[curconfig].__CFG_SP1_HO; (*(int volatile sdata *)0x0e06a) = cfg[curconfig].__CFG_SP1_VE; (*(int volatile sdata *)0x0e06c) = cfg[curconfig].__CFG_SP2_HO; (*(int volatile sdata *)0x0e06e) = cfg[curconfig].__CFG_SP2_VE; (*(int volatile sdata *)0x0e070) = cfg[curconfig].__CFG_SP3_HO; (*(int volatile sdata *)0x0e072) = cfg[curconfig].__CFG_SP3_VE; (*(int volatile sdata *)0x0e074) = cfg[curconfig].__CFG_SP_FR; CFG_ENC_HO = cfg[curconfig].__CFG_ENC_HO; CFG_ENC_VE = cfg[curconfig].__CFG_ENC_VE; ENC_FLAGS = cfg[curconfig].__ENC_FLAGS & 3; } void setConfiguration( void ) { cfg[curconfig].__LATITUDE = (*(double volatile sdata *)0x0e008); cfg[curconfig].__LONGITUDE = (*(double volatile sdata *)0x0e000); cfg[curconfig].__CFG_HSTS_HO = CFG_HSTS_HO; cfg[curconfig].__CFG_HSTS_VE = CFG_HSTS_VE; cfg[curconfig].__CFG_HSTS_FR = CFG_HSTS_FR; cfg[curconfig].__CFG_SP1_HO = (*(int volatile sdata *)0x0e068); cfg[curconfig].__CFG_SP1_VE = (*(int volatile sdata *)0x0e06a); cfg[curconfig].__CFG_SP2_HO = (*(int volatile sdata *)0x0e06c); cfg[curconfig].__CFG_SP2_VE = (*(int volatile sdata *)0x0e06e); cfg[curconfig].__CFG_SP3_HO = (*(int volatile sdata *)0x0e070); cfg[curconfig].__CFG_SP3_VE = (*(int volatile sdata *)0x0e072); cfg[curconfig].__CFG_SP_FR = (*(int volatile sdata *)0x0e074); cfg[curconfig].__CFG_ENC_HO = CFG_ENC_HO; cfg[curconfig].__CFG_ENC_VE = CFG_ENC_VE; cfg[curconfig].__ENC_FLAGS = ENC_FLAGS; cfg[curconfig].__initid = 12345; } void config_reset( void ) { CFG_ENC_HO = 4000; CFG_ENC_VE = 4000; ARC10PERENCHO = 12960000 / 4000; ARC10PERENCVE = 12960000 / 4000; (*(double volatile sdata *)0x0e008) = 48.766667; (*(double volatile sdata *)0x0e000) = 9.183333; CUR_ARC10_HO = 0; CUR_ARC10_VE = 0; (*(long volatile sdata *)0x0e040) = 0; (*(long volatile sdata *)0x0e044) = 0; ENC_ARC10_HO = 0; ENC_ARC10_VE = 0; CUR_HSTEPS_HO = 0; CUR_HSTEPS_VE = 0; TRG_HSTEPS_HO = 0; TRG_HSTEPS_VE = 0; HSTEPSHO090 = 324000; HSTEPSHO180 = 648000; HSTEPSHO270 = 972000; HSTEPSHO359 = 1295999; CFG_HSTS_HO = 1.0; CFG_HSTS_VE = 1.0; CFG_HSTS_FR = 1.0; (*(int volatile sdata *)0x0e068) = 600; (*(int volatile sdata *)0x0e06a) = 600; (*(int volatile sdata *)0x0e06c) = 5; (*(int volatile sdata *)0x0e06e) = 5; (*(int volatile sdata *)0x0e070) = 5; (*(int volatile sdata *)0x0e072) = 5; (*(double volatile sdata *)0x0e048) = 0; (*(double volatile sdata *)0x0e050) = 0; (*(double volatile sdata *)0x0e058) = 0; (*(double volatile sdata *)0x0e060) = 0; if( ( curconfig < 0 ) || ( curconfig > 3 ) ){ curconfig = 0; } getConfiguration(); } void config( void ) { REAL_TIME Time; unsigned char KEY,_y,cf; int y,upd,cmd,v1; lcd_clear(); wait_10ms(1); y = 0; _y = 0; upd = 1; KEY = 0; while( KEY != 'C' ){ if( upd ) { switch( curconfig ){ case 0: cf = '1';break; case 1: cf = '2';break; case 2: cf = '3';break; case 3: cf = '4';break; } lcd_clear(); lcd_puts(0,0,cfg_txt[ y + 0 ]); lcd_puts(1,0,cfg_txt[ y + 1 ]); lcd_puts(2,0,cfg_txt[ y + 2 ]); lcd_puts(3,0,cfg_txt[ y + 3 ]); upd = 0; } lcd_setcursor(_y,0); lcd_putchar( cf ); KEY = readkey(); if(KEY == 'D' ){ lcd_setcursor(_y,0); lcd_putchar(' '); _y++; if(_y > 3 ){ if( y < 25 ) { y++; upd = 1; } _y = 3; } continue; } if(KEY == 'U' ){ lcd_setcursor(_y,0); lcd_putchar(' '); if(_y > 0 ){ _y--; } else { if( y > 0 ){ y--; upd = 1; } _y = 0; } continue; } if(KEY == 'E' ){ cmd = y + _y; switch( cmd ) { case 0: stopTimerInt(); if( usrGetDateTime() ){ Time.Date = INT2BCD(DAY); Time.Month = INT2BCD(MONTH); Time.Year = INT2BCD(YEAR); Time.Hour = INT2BCD(HOUR); Time.Minute = INT2BCD(MINUTE); Time.Second = INT2BCD(SECOND); if (RTCSetTime(&Time, 0xA2 ) == 0x00) { setDaysOfMonth( MONTH, YEAR ); startTimerInt(); } } else { startTimerInt(); } break; case 1: (*(double volatile sdata *)0x0e008) = usrGetDouble( 0 , (*(double volatile sdata *)0x0e008) ); break; case 2: (*(double volatile sdata *)0x0e000) = usrGetDouble( 0 , (*(double volatile sdata *)0x0e000) ); break; case 3: CFG_ENC_HO = usrGetInt( 0 , CFG_ENC_HO ); ARC10PERENCHO = 12960000 / CFG_ENC_HO; break; case 4: CFG_ENC_VE = usrGetInt( 0 , CFG_ENC_VE ); ARC10PERENCVE = 12960000 / CFG_ENC_VE; break; case 5: CFG_HSTS_HO = usrGetDouble( 0 , CFG_HSTS_HO ); break; case 6: CFG_HSTS_VE = usrGetDouble( 0 , CFG_HSTS_VE ); break; case 7: CFG_HSTS_FR = usrGetDouble( 0 , CFG_HSTS_FR ); break; case 8: (*(int volatile sdata *)0x0e068) = usrGetInt( 0 , (*(int volatile sdata *)0x0e068) ); break; case 9: (*(int volatile sdata *)0x0e06a) = usrGetInt( 0 , (*(int volatile sdata *)0x0e06a) ); break; case 10: (*(int volatile sdata *)0x0e06c) = usrGetInt( 0 , (*(int volatile sdata *)0x0e06c) ); break; case 11: (*(int volatile sdata *)0x0e06e) = usrGetInt( 0 , (*(int volatile sdata *)0x0e06e) ); break; case 12: (*(int volatile sdata *)0x0e070) = usrGetInt( 0 , (*(int volatile sdata *)0x0e070) ); break; case 13: (*(int volatile sdata *)0x0e072) = usrGetInt( 0 , (*(int volatile sdata *)0x0e072) ); break; case 14: (*(int volatile sdata *)0x0e074) = usrGetInt( 0 , (*(int volatile sdata *)0x0e074) ); break; case 15: v1 = 0; if( ENCHO_USE ){ v1 = 1; } v1 = usrGetOnOff("ENCODER HO", v1); ENCHO_USE = 0; if(v1){ ENCHO_USE = 1; } break; case 16: v1 = 0; if( ENCVE_USE ){ v1 = 1; } v1 = usrGetOnOff("ENCODER VE", v1); ENCVE_USE = 0; if(v1){ ENCVE_USE = 1; } break; case 17: showEncoders( 1 ); break; case 18: showEncoders( 2 ); break; case 19: showEncoders( 3 ); break; case 20: if( ENCHO_USE == 1 ) { encAutoTestHo(); } break; case 21: if( ENCVE_USE == 1 ) { encAutoTestVe(); } break; case 22: setConfiguration(); break; case 23: curconfig = 0; getConfiguration(); break; case 24: curconfig = 1; getConfiguration(); break; case 25: curconfig = 2; getConfiguration(); break; case 26: curconfig = 3; getConfiguration(); break; case 27: setListObj(); break; case 28: if( usrGetAck("START DOWNLOAD ?") ){ serialObjListDownload(); } break; } upd = 1; } } } void main( void ) { REAL_TIME Time; unsigned char KEY; unsigned char y,upd,cf; ADDRSEL1 = 0x0406; BUSCON1 = 0x04AE; ADDRSEL2 = 0x0806; BUSCON2 = 0xc40b; ADDRSEL3 = 0x0C06; BUSCON3 = 0x04AE; ADDRSEL4 = 0x1000; BUSCON4 = 0x060D; DP2_8 = 0; DP2_9 = 0; DP2_10 = 0; DP2_11 = 0; DP7_0 = 1; DP7_1 = 1; DP7_2 = 1; DP7_3 = 1; DP7_4 = 1; DP7_5 = 1; DP7_6 = 1; DP7_7 = 1; DP8_0 = 1; DP8_1 = 1; DP8_2 = 1; DP8_3 = 1; DP8_4 = 1; ENC_FLAGS = 0; MOT_FLAGS = 0; MOTORSWITCH=1; P7 = hsteps[0]; P8 = hsteps[0] & 0x0f; MOTORSWITCH=1; init_lcd(); lcd_on(0); lcd_clear(); YEAR = 2003; MONTH = 1; DAY = 1; HOUR = 0; MINUTE = 0; SECOND = 0; MSECOND = 0; TIMER10 = 0; THISMDAYS = 31; config_reset(); HSTEP_HO = 0; HSTEP_VE = 0; HSTEP_FR = 0; lcd_puts(0,0,main_txt0); lcd_puts(1,0,main_txt1); lcd_puts(2,0,main_txt2); lcd_puts(3,0,main_txt3); IEN = 1; initTimerInt(); if (RTCGetTime(&Time, 0xA2 ) == 0x00) { DAY = BCD2INT( Time.Date ); MONTH = BCD2INT( Time.Month ); YEAR = BCD2INT( Time.Year ); HOUR = BCD2INT( Time.Hour ); MINUTE = BCD2INT( Time.Minute ); SECOND = BCD2INT( Time.Second ); setDaysOfMonth( MONTH, YEAR ); startTimerInt(); } initEncoderInts(); wait_10ms(100); wait_10ms(100); wait_10ms(100); lcd_clear(); wait_10ms(1); y = 0; upd = 1; while(1){ if( upd ) { switch( curconfig ){ case 0: cf = '1';break; case 1: cf = '2';break; case 2: cf = '3';break; case 3: cf = '4';break; } lcd_clear(); lcd_puts(0,0,menu_txt[ 0 ]); lcd_puts(1,0,menu_txt[ 1 ]); lcd_puts(2,0,menu_txt[ 2 ]); upd = 0; } printDateTime(3); lcd_setcursor(y,0); lcd_putchar( cf ); KEY = readkey(); if(KEY == 'D' ){ lcd_setcursor(y,0); lcd_putchar(' '); if(y < 2 ){ y++; } continue; } if(KEY == 'U' ){ lcd_setcursor(y,0); lcd_putchar(' '); if( y > 0 ){ y--; } continue; } if(KEY == 'E' ){ switch( y ) { case 0: scope(); break; case 1: encode(); break; case 2: config(); break; } upd = 1; } } }