CCS PCM C Compiler, Version 3.210, 25417               27-Oct-04 12:26

               Filename: freq_gen.LST

               ROM used: 970 words (24%)
                         Largest free fragment is 2048
               RAM used: 29 (15%) at main() level
                         33 (17%) worst case
               Stack:    4 worst case (3 in main + 1 for interrupts)

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   235
0003:  NOP
0004:  MOVWF  7F
0005:  SWAPF  03,W
0006:  CLRF   03
0007:  MOVWF  26
0008:  MOVF   7F,W
0009:  MOVWF  25
000A:  MOVF   0A,W
000B:  MOVWF  2D
000C:  CLRF   0A
000D:  SWAPF  25,F
000E:  MOVF   04,W
000F:  MOVWF  27
0010:  MOVF   20,W
0011:  MOVWF  28
0012:  MOVF   21,W
0013:  MOVWF  29
0014:  MOVF   22,W
0015:  MOVWF  2A
0016:  MOVF   23,W
0017:  MOVWF  2B
0018:  MOVF   24,W
0019:  MOVWF  2C
001A:  BCF    03.7
001B:  BCF    03.5
001C:  BTFSS  0B.5
001D:  GOTO   020
001E:  BTFSC  0B.2
001F:  GOTO   033
0020:  MOVF   27,W
0021:  MOVWF  04
0022:  MOVF   28,W
0023:  MOVWF  20
0024:  MOVF   29,W
0025:  MOVWF  21
0026:  MOVF   2A,W
0027:  MOVWF  22
0028:  MOVF   2B,W
0029:  MOVWF  23
002A:  MOVF   2C,W
002B:  MOVWF  24
002C:  MOVF   2D,W
002D:  MOVWF  0A
002E:  SWAPF  26,W
002F:  MOVWF  03
0030:  SWAPF  7F,F
0031:  SWAPF  7F,W
0032:  RETFIE
0033:  BCF    0A.3
0034:  GOTO   0FB
....................  /****************************************************************************/  
.................... // Copyright 2004 MBARI.                                                      
.................... // Monterey Bay Aquarium Research Institute Proprietary Information.          
.................... // All rights reserved.                                                       
.................... /****************************************************************************/  
.................... #if defined(__PCM__)  
.................... #include <16f873.h> 
....................  //////// Standard Header file for the PIC16F873 device ////////////////  
.................... #device PIC16F873  
.................... #list  
....................  
.................... #fuses XT,NOWDT,NOPROTECT,PUT,NOBROWNOUT,NOLVP  
.................... #use delay(clock=3580000)  
0170:  MOVLW  3B
0171:  MOVWF  04
0172:  MOVF   00,W
0173:  BTFSC  03.2
0174:  GOTO   184
0175:  MOVLW  01
0176:  MOVWF  21
0177:  CLRF   20
0178:  DECFSZ 20,F
0179:  GOTO   178
017A:  DECFSZ 21,F
017B:  GOTO   177
017C:  MOVLW  27
017D:  MOVWF  20
017E:  DECFSZ 20,F
017F:  GOTO   17E
0180:  NOP
0181:  NOP
0182:  DECFSZ 00,F
0183:  GOTO   175
0184:  RETLW  00
*
0222:  MOVLW  14
0223:  SUBWF  3C,F
0224:  BTFSS  03.0
0225:  GOTO   234
0226:  MOVLW  3C
0227:  MOVWF  04
0228:  MOVLW  FC
0229:  ANDWF  00,F
022A:  BCF    03.0
022B:  RRF    00,F
022C:  RRF    00,F
022D:  MOVF   00,W
022E:  BTFSC  03.2
022F:  GOTO   234
0230:  GOTO   232
0231:  NOP
0232:  DECFSZ 00,F
0233:  GOTO   231
0234:  RETLW  00
.................... #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)  
*
01A4:  BTFSS  0C.5
01A5:  GOTO   1A4
01A6:  MOVF   18,W
01A7:  MOVWF  2E
01A8:  MOVF   1A,W
01A9:  MOVWF  21
01AA:  BTFSS  2E.1
01AB:  GOTO   1AE
01AC:  BCF    18.4
01AD:  BSF    18.4
01AE:  NOP
01AF:  BCF    0A.3
01B0:  GOTO   1D2 (RETURN)
*
0244:  CLRF   2E
.................... #use fast_io(C)  
.................... #endif  
....................   
.................... #include <stdlib.h> 
....................  ///////////////////////////////////////////////////////////////////////////  
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
.................... //// This source code may only be used by licensed users of the CCS C  ////  
.................... //// compiler.  This source code may only be distributed to other      ////  
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
.................... //// or distribution is permitted without written permission.          ////  
.................... //// Derivative programs created using this software in object code    ////  
.................... //// form are not restricted in any way.                               ////  
.................... ///////////////////////////////////////////////////////////////////////////  
....................   
.................... #ifndef _STDLIB  
.................... #define _STDLIB  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Definitions and types  
.................... //---------------------------------------------------------------------------  
....................   
.................... #ifndef RAND_MAX  
.................... #define RAND_MAX  32767    // The value of which is the maximum value  
....................                            // ... returned by the rand function  
.................... #endif  
....................   
.................... typedef struct {  
....................    signed int quot;  
....................    signed int rem;  
.................... } div_t;  
....................   
.................... typedef struct {  
....................    signed long quot;  
....................    signed long rem;  
.................... } ldiv_t;  
....................   
.................... #include <stddef.h> 
....................  ///////////////////////////////////////////////////////////////////////////  
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
.................... //// This source code may only be used by licensed users of the CCS C  ////  
.................... //// compiler.  This source code may only be distributed to other      ////  
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
.................... //// or distribution is permitted without written permission.          ////  
.................... //// Derivative programs created using this software in object code    ////  
.................... //// form are not restricted in any way.                               ////  
.................... ///////////////////////////////////////////////////////////////////////////  
....................   
.................... #ifndef _STDDEF  
....................   
.................... #define _STDDEF  
....................   
.................... #if sizeof(int *)==1  
.................... #define ptrdiff_t int  
.................... #else  
.................... #define ptrdiff_t long  
.................... #endif  
....................   
.................... #define size_t int  
.................... #define wchar_t char  
.................... #define NULL 0  
....................   
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)  
....................   
.................... #endif  
....................  
....................   
.................... //---------------------------------------------------------------------------  
.................... // String conversion functions  
.................... //---------------------------------------------------------------------------  
....................   
.................... /* Standard template: float atof(char * s)  
....................  * converts the initial portion of the string s to a float.  
....................  * returns the converted value if any, 0 otherwise  
....................  */  
.................... float atof(char * s);  
....................   
.................... /* Standard template: signed int  atoi(char * s)  
....................  * converts the initial portion of the string s to a signed int  
....................  * returns the converted value if any, 0 otherwise  
....................  */  
.................... signed int atoi(char *s);  
....................   
.................... /* Syntax: signed int32  atoi32(char * s)  
....................    converts the initial portion of the string s to a signed int32  
....................    returns the converted value if any, 0 otherwise*/  
.................... signed int32 atoi32(char *s);  
....................   
.................... /* Standard template: signed long  atol(char * s)  
....................  * converts the initial portion of the string s to a signed long  
....................  * returns the converted value if any, 0 otherwise  
....................  */  
.................... signed long atol(char *s);  
....................   
.................... /* Standard template: float strtol(char * s,char *endptr)  
....................  * converts the initial portion of the string s to a float  
....................  * returns the converted value if any, 0 otherwise  
....................  * the final string is returned in the endptr, if endptr is not null  
....................  */  
.................... float strtod(char *s,char *endptr);  
....................   
.................... /* Standard template: long strtoul(char * s,char *endptr,signed int base)  
....................  * converts the initial portion of the string s, represented as an  
....................  * integral value of radix base  to a signed long.  
....................  * Returns the converted value if any, 0 otherwise  
....................  * the final string is returned in the endptr, if endptr is not null  
....................  */  
.................... signed long strtol(char *s,char *endptr,signed int base);  
....................   
.................... /* Standard template: long strtoul(char * s,char *endptr,signed int base)  
....................  * converts the initial portion of the string s, represented as an  
....................  * integral value of radix base to a unsigned long.  
....................  * returns the converted value if any, 0 otherwise  
....................  * the final string is returned in the endptr, if endptr is not null  
....................  */  
.................... long strtoul(char *s,char *endptr,signed int base);  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Pseudo-random sequence generation functions  
.................... //---------------------------------------------------------------------------  
....................   
.................... /* The rand function computes a sequence of pseudo-random integers in  
....................  * the range 0 to RAND_MAX  
....................  *  
....................  * Parameters:  
....................  *       (none)  
....................  *  
....................  * Returns:  
....................  *       The pseudo-random integer  
....................  */  
.................... long rand(void);  
....................   
.................... /* The srand function uses the argument as a seed for a new sequence of  
....................  * pseudo-random numbers to be returned by subsequent calls to rand.  
....................  *  
....................  * Parameters:  
....................  *       [in] seed: The seed value to start from. You might need to pass  
....................  *  
....................  * Returns:  
....................  *       (none)  
....................  *  
....................  * Remarks  
....................  *          The srand function sets the starting point for generating  
....................  *       a series of pseudorandom integers. To reinitialize the  
....................  *       generator, use 1 as the seed argument. Any other value for  
....................  *       seed sets the generator to a random starting point. rand  
....................  *       retrieves the pseudorandom numbers that are generated.  
....................  *       Calling rand before any call to srand generates the same  
....................  *       sequence as calling srand with seed passed as 1.  
....................  *          Usually, you need to pass a time here from outer source  
....................  *       so that the numbers will be different every time you run.  
....................  */  
.................... void srand(unsigned int32 seed);  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Memory management functions  
.................... //---------------------------------------------------------------------------  
....................   
.................... // Comming soon  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Communication with the environment  
.................... //---------------------------------------------------------------------------  
....................   
.................... /* The function returns 0 always  
....................  */  
.................... signed int system(char *string);  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Searching and sorting utilities  
.................... //---------------------------------------------------------------------------  
....................   
.................... /* Performs a binary search of a sorted array..  
....................  *  
....................  * Parameters:  
....................  *       [in] key: Object to search for  
....................  *       [in] base: Pointer to base of search data  
....................  *       [in] num: Number of elements  
....................  *       [in] width: Width of elements  
....................  *       [in] compare: Function that compares two elements  
....................  *  
....................  * Returns:  
....................  *       bsearch returns a pointer to an occurrence of key in the array pointed  
....................  *       to by base. If key is not found, the function returns NULL. If the  
....................  *       array is not in order or contains duplicate records with identical keys,  
....................  *       the result is unpredictable.  
....................  */  
.................... //void *bsearch(const void *key, const void *base, size_t num, size_t width,  
.................... //              int (*compare)(const void *, const void *));  
....................   
.................... /* Performs the shell-metzner sort (not the quick sort algorithm). The contents  
....................  * of the array are sorted into ascending order according to a comparison  
....................  * function pointed to by compar.  
....................  *  
....................  * Parameters:  
....................  *       [in] base: Pointer to base of search data  
....................  *       [in] num: Number of elements  
....................  *       [in] width: Width of elements  
....................  *       [in] compare: Function that compares two elements  
....................  *  
....................  * Returns:  
....................  *       (none)  
....................  */  
.................... //void *qsort(const void *base, size_t num, size_t width,  
.................... //              int (*compare)(const void *, const void *));  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Integer arithmetic functions  
.................... //---------------------------------------------------------------------------  
....................   
.................... #define labs abs  
....................   
.................... div_t div(signed int numer,signed int denom);  
.................... ldiv_t ldiv(signed long numer,signed long denom);  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Multibyte character functions  
.................... //---------------------------------------------------------------------------  
....................   
.................... // Not supported  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Multibyte string functions  
.................... //---------------------------------------------------------------------------  
....................   
.................... // Not supported  
....................   
....................   
.................... //---------------------------------------------------------------------------  
.................... // Internal implementation  
.................... //---------------------------------------------------------------------------  
....................   
.................... #include <stddef.h> 
....................  ///////////////////////////////////////////////////////////////////////////  
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
.................... //// This source code may only be used by licensed users of the CCS C  ////  
.................... //// compiler.  This source code may only be distributed to other      ////  
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
.................... //// or distribution is permitted without written permission.          ////  
.................... //// Derivative programs created using this software in object code    ////  
.................... //// form are not restricted in any way.                               ////  
.................... ///////////////////////////////////////////////////////////////////////////  
....................   
.................... #ifndef _STDDEF  
....................   
.................... #define _STDDEF  
....................   
.................... #if sizeof(int *)==1  
.................... #define ptrdiff_t int  
.................... #else  
.................... #define ptrdiff_t long  
.................... #endif  
....................   
.................... #define size_t int  
.................... #define wchar_t char  
.................... #define NULL 0  
....................   
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)  
....................   
.................... #endif  
....................  
.................... #include <string.h> 
....................  ////////////////////////////////////////////////////////////////////////////  
.................... ////        (C) Copyright 1996,2003 Custom Computer Services            ////  
.................... //// This source code may only be used by licensed users of the CCS C   ////  
.................... //// compiler.  This source code may only be distributed to other       ////  
.................... //// licensed users of the CCS C compiler.  No other use, reproduction  ////  
.................... //// or distribution is permitted without written permission.           ////  
.................... //// Derivative programs created using this software in object code     ////  
.................... //// form are not restricted in any way.                                ////  
.................... ////////////////////////////////////////////////////////////////////////////  
....................   
.................... #ifndef _STRING  
.................... #define _STRING  
.................... #include <stddef.h> 
....................  ///////////////////////////////////////////////////////////////////////////  
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
.................... //// This source code may only be used by licensed users of the CCS C  ////  
.................... //// compiler.  This source code may only be distributed to other      ////  
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
.................... //// or distribution is permitted without written permission.          ////  
.................... //// Derivative programs created using this software in object code    ////  
.................... //// form are not restricted in any way.                               ////  
.................... ///////////////////////////////////////////////////////////////////////////  
....................   
.................... #ifndef _STDDEF  
....................   
.................... #define _STDDEF  
....................   
.................... #if sizeof(int *)==1  
.................... #define ptrdiff_t int  
.................... #else  
.................... #define ptrdiff_t long  
.................... #endif  
....................   
.................... #define size_t int  
.................... #define wchar_t char  
.................... #define NULL 0  
....................   
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)  
....................   
.................... #endif  
....................  
.................... #include <ctype.h> 
....................  ////////////////////////////////////////////////////////////////////////////  
.................... ////        (C) Copyright 1996,2003 Custom Computer Services            ////  
.................... //// This source code may only be used by licensed users of the CCS C   ////  
.................... //// compiler.  This source code may only be distributed to other       ////  
.................... //// licensed users of the CCS C compiler.  No other use, reproduction  ////  
.................... //// or distribution is permitted without written permission.           ////  
.................... //// Derivative programs created using this software in object code     ////  
.................... //// form are not restricted in any way.                                ////  
.................... ////////////////////////////////////////////////////////////////////////////  
....................   
.................... #ifndef _CTYPE  
.................... #define _CTYPE  
....................   
.................... #define islower(x)  isamong(x,"abcdefghijklmnopqrstuvwxyz")  
.................... #define isupper(x)  isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")  
.................... #define isalnum(x)  isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")  
.................... #define isalpha(x)  isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")  
.................... #define isdigit(x)  isamong(x,"0123456789")  
.................... #define isspace(x)  (x==' ')  
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef")  
.................... #define iscntrl(x)  (x<' ')  
.................... #define isprint(x)  (x>=' ')  
.................... #define isgraph(x)  (x>' ')  
.................... #define ispunct(x)  ((x>' ')&&!isalnum(x))  
....................   
.................... #endif  
....................   
....................  
....................   
....................   
....................   
.................... //////////////////////////////////////////////  
.................... //// Uncomment the following define to    ////  
.................... //// allow some functions to use a        ////  
.................... //// quicker algorithm, but use more ROM  ////  
.................... ////                                      ////  
.................... //// #define FASTER_BUT_MORE_ROM          ////  
.................... //////////////////////////////////////////////  
....................   
....................   
....................   
.................... /*Copying functions*/  
.................... /* standard template:  
....................    void *memmove(void *s1, void *s2, size_t n).  
....................    Copies max of n characters safely (not following ending '\0')  
....................    from s2 in s1; if s2 has less than n characters, appends 0 */  
....................   
.................... char *memmove(void *s1,char *s2,size_t n)  
.................... {  
....................    char *sc1;  
....................    char *sc2;  
....................    sc1=s1;  
....................    sc2=s2;  
....................    if(sc2<sc1 && sc1 <sc2 +n)  
....................       for(sc1+=n,sc2+=n;0<n;--n)  
....................          *--sc1=*--sc2;  
....................    else  
....................       for(;0<n;--n)  
....................          *sc1++=*sc2++;  
....................   return s1;  
....................   }  
....................   
.................... /* compiler ignored the name 'strcpy()'; perhaps, it's reserved? 
....................    Standard template: char *strcpy(char *s1, const char *s2)  
....................    copies the string s2 including the null character to s1*/  
....................   
.................... char *strcopy(char *s1, char *s2)  
.................... {  
....................   char *s;  
....................   
....................   for (s = s1; *s2 != 0; s++, s2++) {  
.................... 	  *s = *s2;  
....................   }  
....................   *s = *s2;  
....................   return(s1);  
.................... }  
....................   
.................... /* standard template:  
....................    char *strncpy(char *s1, const char *s2, size_t n).  
....................    Copies max of n characters (not following ending '\0')  
....................    from s2 in s1; if s2 has less than n characters, appends 0 */  
....................   
.................... char *strncpy(char *s1, char *s2, size_t n)  
.................... {  
....................   char *s;  
....................   
....................   for (s = s1; n > 0 && *s2 != '\0'; n--)  
....................      *s++ = *s2++;  
....................   for (; n > 0; n--)  
....................      *s++ = '\0';  
....................   
....................   return(s1);  
.................... }  
.................... /***********************************************************/  
....................   
.................... /*concatenation functions*/  
.................... /* standard template: char *strcat(char *s1, const char *s2)  
.................... appends s2 to s1*/  
....................   
.................... char *strcat(char *s1, char *s2)  
.................... {  
....................    char *s;  
....................   
....................    for (s = s1; *s != '\0'; ++s);  
....................    while(*s2 != '\0')  
....................    {  
....................       *s = *s2;  
....................       ++s;  
....................       ++s2;  
....................    }  
....................   
....................    *s = '\0';  
....................    return(s1);  
.................... }  
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n)  
.................... appends not more than n characters from s2 to s1*/  
....................   
.................... char *strncat(char *s1, char *s2, size_t n)  
.................... {  
....................    char *s;  
....................   
....................    for (s = s1; *s != '\0'; ++s);  
....................    while(*s2 != '\0' && 0<n)  
....................    {  
....................       *s = *s2;  
....................       ++s;  
....................       ++s2;  
....................       --n;  
....................    }  
....................   
....................    *s = '\0';  
....................    return(s1);  
.................... }  
....................   
.................... /***********************************************************/  
....................   
....................   
.................... /*comparison functions*/  
.................... /* standard template: signed int memcmp(void *s1, void *s2).  
....................    Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */  
....................   
.................... signed int memcmp(void * s1,char *s2,size_t n)  
.................... {  
.................... char *su1, *su2;  
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)  
.................... {  
....................    if(*su1!=*su2)  
....................       return ((*su1<*su2)?1:+1);  
.................... }  
.................... return 0;  
.................... }  
....................   
.................... /* standard template: int strcmp(const char *s1, const char *s2).  
....................    Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */  
....................   
.................... signed int strcmp(char *s1, char *s2)  
.................... {  
....................    for (; *s1 == *s2; s1++, s2++)  
....................       if (*s1 == '\0')  
....................          return(0);  
....................    return((*s1 < *s2) ?-1: 1);  
.................... }  
.................... /* standard template: int strcoll(const char *s1, const char *s2).  
....................    Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */  
....................   
.................... signed int strcoll(char *s1, char *s2)  
.................... {  
....................    for (; *s1 == *s2; s1++, s2++)  
....................       if (*s1 == '\0')  
....................          return(0);  
....................    return((*s1 < *s2) ?-1: 1);  
.................... }  
....................   
.................... /* standard template:  
....................    int strncmp(const char *s1, const char *s2, size_t n).  
....................    Compares max of n characters (not following 0) from s1 to s2;  
....................    returns same as strcmp */  
....................   
.................... signed int strncmp(char *s1, char *s2, size_t n)  
.................... {  
....................    for (; n > 0; s1++, s2++, n--)  
....................       if (*s1 != *s2)  
....................          return((*s1 <*s2) ?-1: 1);  
....................       else if (*s1 == '\0')  
....................          return(0);  
....................    return(0);  
.................... }  
.................... /* standard template:  
....................    int strxfrm(const char *s1, const char *s2, size_t n).  
....................    transforms maximum of n characters from s2 and places them into s1*/  
.................... size_t strxfrm(char *s1, char *s2, size_t n)  
.................... {  
....................   char *s;  
....................   int n1;  
....................   n1=n;  
....................   for (s = s1; n > 0 && *s2 != '\0'; n--)  
....................      *s++ = *s2++;  
....................   for (; n > 0; n--)  
....................      *s++ = '\0';  
....................   
....................   return(n1);  
.................... }  
....................   
....................   
....................   
....................   
....................   
.................... /***********************************************************/  
.................... /*Search functions*/  
.................... /* standard template: void *memchr(const char *s, int c).  
....................    Finds first occurrence of c in n characters of s */  
....................   
.................... char *memchr(void *s,int c,size_t n)  
.................... {  
....................    char uc;  
....................    char *su;  
....................    uc=c;  
....................    for(su=s;0<n;++su,--n)  
....................       if(*su==uc)  
....................       return su;  
....................    return NULL;  
.................... }  
....................   
.................... /* standard template: char *strchr(const char *s, int c).  
....................    Finds first occurrence of c in s */  
....................   
.................... char *strchr(char *s, int c)  
.................... {  
....................    for (; *s != c; s++)  
....................       if (*s == '\0')  
....................          return(0);  
....................    return(s);  
.................... }  
.................... /* standard template:  
....................    size_t strcspn(const char *s1, const char *s2).  
....................    Computes length of max initial segment of s1 that  
....................    consists entirely of characters NOT from s2*/  
....................   
.................... int *strcspn(char *s1, char *s2)  
.................... {  
....................    char *sc1, *sc2;  
....................   
....................    for (sc1 = s1; *sc1 != 0; sc1++)  
....................       for (sc2 = s2; *sc2 != 0; sc2++)  
....................          if (*sc1 == *sc2)  
....................             return(sc1 - s1);  
....................    return(sc1 - s1);  
.................... }  
.................... /* standard template:  
....................    char *strpbrk(const char *s1, const char *s2).  
....................    Locates first occurence of any character from s2 in s1;  
....................    returns s1 if s2 is empty string */  
....................   
.................... char *strpbrk(char *s1, char *s2)  
.................... {  
....................    char *sc1, *sc2;  
....................   
....................    for (sc1 = s1; *sc1 != 0; sc1++)  
....................       for (sc2 = s2; *sc2 != 0; sc2++)  
....................          if (*sc1 == *sc2)  
....................             return(sc1);  
....................    return(0);  
.................... }  
....................   
....................   
.................... /* standard template: char *strrchr(const char *s, int c).  
....................    Finds last occurrence of c in s */  
....................   
.................... char *strrchr(char *s, int c)  
.................... {  
....................    char *p;  
....................   
....................    for (p = 0; ; s++)  
....................    {  
....................       if (*s == c)  
....................          p = s;  
....................       if (*s == '\0')  
....................          return(p);  
....................    }  
.................... }  
.................... /* computes length of max initial segment of s1 consisting  
....................    entirely of characters from s2 */  
....................   
.................... int *strspn(char *s1, char *s2)  
.................... {  
....................    char *sc1, *sc2;  
....................   
....................    for (sc1 = s1; *sc1 != 0; sc1++)  
....................       for (sc2 = s2; ; sc2++)  
.................... 	 if (*sc2 == '\0')  
.................... 	    return(sc1 - s1);  
....................          else if (*sc1 == *sc2)  
....................             break;  
....................    return(sc1 - s1);  
.................... }  
.................... /* standard template:  
....................    char *strstr(const char *s1, const char *s2);  
....................    Locates first occurence of character sequence s2 in s1;  
....................    returns 0 if s2 is empty string  
....................   
....................    Uncomment #define FASTER_BUT_MORE_ROM at the top of the  
....................    file to use the faster algorithm */  
.................... char *strstr(char *s1, char *s2)  
.................... {  
.................... 	char *s, *t;  
....................   
....................    #ifdef FASTER_BUT_MORE_ROM  
....................    if (*s2 == '\0')  
....................          return(s1);  
....................    #endif  
....................   
.................... 	while (*s1)  
....................    {  
....................       for(s = s1, t = s2; *t && *s == *t; ++s, ++t);  
....................   
.................... 		if (*t == '\0')  
.................... 			return s1;  
....................       ++s1;  
....................       #ifdef FASTER_BUT_MORE_ROM  
....................          while(*s1 != '\0' && *s1 != *s2)  
....................             ++s1;  
....................       #endif  
.................... 	}  
.................... 	return 0;  
.................... }  
....................   
.................... /* standard template: char *strtok(char *s1, const char *s2).  
....................   
....................    Finds next token in s1 delimited by a character from separator  
....................    string s2 (which can be different from call to call).  First call  
....................    starts at beginning of s1 searching for first character NOT  
....................    contained in s2; returns 0 if none is found.  
....................    If one is found, it is the start of first token (return value).  
....................    Function then searches from there for a character contained in s2.  
....................    If none is found, current token extends to end of s1, and subsequent  
....................    searches for a token will return 0.  If one is found, it is  
....................    overwritten by '\0', which terminates current token.  Function saves  
....................    pointer to following character from which next search will start.  
....................    Each subsequent call, with 0 as first argument, starts searching  
....................    from saved pointer */  
....................   
.................... char *strtok(char *s1, char *s2)  
.................... {  
....................    char *beg, *end;  
....................    static char *save;  
0245:  CLRF   2F
....................   
....................    beg = (s1)?s1: save;  
....................    beg += strspn(beg, s2);  
....................    if (*beg == '\0')  
....................    {  
....................       *save = ' ';  
....................       return(0);  
....................    }  
....................    end = strpbrk(beg, s2);  
....................    if (*end != '\0')  
....................    {  
....................       *end = '\0';  
....................       end++;  
....................    }  
....................    save = end;  
....................    return(beg);  
.................... }  
....................   
.................... /*****************************************************************/  
.................... /*Miscellaneous functions*/  
.................... /* standard template  
.................... maps error number in errnum to an error message string  
.................... Returns: Pointer to string  
.................... */  
.................... #ifdef _ERRNO  
.................... char * strerror(int errnum)  
.................... {  
.................... char s[15];  
.................... switch( errnum)  
.................... {  
.................... case 0:  
....................    strcpy(s,"no errors");  
....................    return s;  
.................... case EDOM :  
....................    strcpy(s,"domain error");  
....................    return s;  
.................... case ERANGE:  
....................    strcpy(s,"range error");  
....................    return s;  
.................... }  
.................... }  
.................... #ENDIF  
.................... /* standard template: size_t strlen(const char *s).  
....................    Computes length of s1 (preceding terminating 0) */  
....................   
.................... int *strlen(char *s)  
.................... {  
....................    char *sc;  
....................   
....................    for (sc = s; *sc != 0; sc++);  
....................    return(sc - s);  
.................... }  
....................   
.................... /* standard template: size_t stricmp(const char *s1, const char *s2).  
....................    Compares s1 to s2 ignoring case (upper vs. lower) */  
....................   
.................... signed int stricmp(char *s1, char *s2)  
.................... {  
....................  for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));  
....................     s1++, s2++)  
....................     if (*s1 == '\0')  
....................        return(0);  
....................  return((*s1 < *s2) ?-1: 1);  
.................... }  
....................   
....................   
.................... /* standard template: char *strlwr(char *s).  
....................    Replaces uppercase letters by lowercase;  
....................    returns pointer to new string s */  
....................   
.................... char *strlwr(char *s)  
.................... {  
....................    char *p;  
....................   
....................    for (p = s; *p != '\0'; p++)  
....................       if (*p >= 'A' && *p <='Z')  
....................          *p += 'a' - 'A';  
....................    return(s);  
.................... }  
....................   
....................   
.................... /************************************************************/  
....................   
....................   
.................... #endif  
....................  
....................   
.................... div_t div(signed int numer,signed int denom)  
.................... {  
....................    div_t val;  
....................    val.quot = numer / denom;  
....................    val.rem = numer - (denom * val.quot);  
....................    return (val);  
.................... }  
....................   
.................... ldiv_t ldiv(signed long numer,signed long denom)  
.................... {  
....................    ldiv_t val;  
....................    val.quot = numer / denom;  
....................    val.rem = numer - (denom * val.quot);  
....................    return (val);  
.................... }  
....................   
.................... float atof(char * s)  
.................... {  
....................    float pow10 = 1.0;  
....................    float result = 0.0;  
....................    int sign = 0;  
....................    char c;  
....................    int ptr = 0;  
....................   
....................    c = s[ptr++];  
....................   
....................    if ((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {  
....................       if(c == '-') {  
....................          sign = 1;  
....................          c = s[ptr++];  
....................       }  
....................       if(c == '+')  
....................          c = s[ptr++];  
....................   
....................       while((c >= '0' && c <= '9')) {  
....................          result = 10*result + c - '0';  
....................          c = s[ptr++];  
....................       }  
....................   
....................       if (c == '.') {  
....................          c = s[ptr++];  
....................          while((c >= '0' && c <= '9')) {  
....................              pow10 = pow10*10;  
....................              result += (c - '0')/pow10;  
....................              c = s[ptr++];  
....................          }  
....................       }  
....................   
....................    }  
....................   
....................    if (sign == 1)  
....................       result = -1*result;  
....................    return(result);  
.................... }  
....................   
.................... signed int atoi(char *s)  
.................... {  
....................    signed int result;  
....................    int sign, base, index;  
....................    char c;  
....................   
....................    index = 0;  
....................    sign = 0;  
....................    base = 10;  
....................    result = 0;  
....................   
....................    // Omit all preceeding alpha characters  
....................    if(s)  
....................       c = s[index++];  
....................   
....................    // increase index if either positive or negative sign is detected  
....................    if (c == '-')  
....................    {  
....................       sign = 1;         // Set the sign to negative  
....................       c = s[index++];  
....................    }  
....................    else if (c == '+')  
....................    {  
....................       c = s[index++];  
....................    }  
....................   
....................    if (c >= '0' && c <= '9')  
....................    {  
....................   
....................       // Check for hexa number  
....................       if (c == '0' && (s[index] == 'x' || s[index] == 'X'))  
....................       {  
....................          base = 16;  
....................          index++;  
....................          c = s[index++];  
....................       }  
....................   
....................       // The number is a decimal number  
....................       if (base == 10)  
....................       {  
....................          while (c >= '0' && c <= '9')  
....................          {  
....................             result = 10*result + (c - '0');  
....................             c = s[index++];  
....................          }  
....................       }  
....................       else if (base == 16)    // The number is a hexa number  
....................       {  
....................          c = toupper(c);  
....................          while ( (c >= '0' && c <= '9') || (c >= 'A' && c<='F'))  
....................          {  
....................             if (c >= '0' && c <= '9')  
....................                result = (result << 4) + (c - '0');  
....................             else  
....................                result = (result << 4) + (c - 'A' + 10);  
....................   
....................             c = s[index++];  
....................             c = toupper(c);  
....................          }  
....................       }  
....................    }  
....................   
....................    if (sign == 1 && base == 10)  
....................        result = -result;  
....................   
....................    return(result);  
.................... }  
....................   
.................... signed long atol(char *s)  
.................... {  
....................    signed long result;  
....................    int sign, base, index;  
....................    char c;  
....................   
....................    index = 0;  
....................    sign = 0;  
....................    base = 10;  
....................    result = 0;  
....................   
....................    if(s)  
....................       c = s[index++];  
....................   
....................    // increase index if either positive or negative sign is detected  
....................    if (c == '-')  
....................    {  
....................       sign = 1;         // Set the sign to negative  
....................       c = s[index++];  
....................    }  
....................    else if (c == '+')  
....................    {  
....................       c = s[index++];  
....................    }  
....................   
....................    if (c >= '0' && c <= '9')  
....................    {  
....................       if (c == '0' && (s[index] == 'x' || s[index] == 'X'))  
....................       {  
....................          base = 16;  
....................          index++;  
....................          c = s[index++];  
....................       }  
....................   
....................       // The number is a decimal number  
....................       if (base == 10)  
....................       {  
....................          while (c >= '0' && c <= '9')  
....................          {  
....................             result = 10*result + (c - '0');  
....................             c = s[index++];  
....................          }  
....................       }  
....................       else if (base == 16)    // The number is a hexa number  
....................       {  
....................          c = toupper(c);  
....................          while ( (c >= '0' && c <= '9') || (c >= 'A' && c <='F'))  
....................          {  
....................             if (c >= '0' && c <= '9')  
....................                result = (result << 4) + (c - '0');  
....................             else  
....................                result = (result << 4) + (c - 'A' + 10);  
....................   
....................             c = s[index++];c = toupper(c);  
....................          }  
....................       }  
....................    }  
....................   
....................    if (base == 10 && sign == 1)  
....................       result = -result;  
....................   
....................    return(result);  
.................... }  
....................   
.................... /* A fast routine to multiply by 10  
....................  */  
.................... signed int32 mult_with10(int32 num)  
.................... {  
....................    return ( (num << 1) + (num << 3) );  
.................... }  
....................   
.................... signed int32 atoi32(char *s)  
.................... {  
....................    signed int32 result;  
....................    int sign, base, index;  
....................    char c;  
....................   
....................    index = 0;  
....................    sign = 0;  
....................    base = 10;  
....................    result = 0;  
....................   
....................    if(s)  
....................       c = s[index++];  
....................   
....................    // increase index if either positive or negative sign is detected  
....................    if (c == '-')  
....................    {  
....................       sign = 1;         // Set the sign to negative  
....................       c = s[index++];  
....................    }  
....................    else if (c == '+')  
....................    {  
....................       c = s[index++];  
....................    }  
....................   
....................    if (c >= '0' && c <= '9')  
....................    {  
....................       if (c == '0' && (s[index] == 'x' || s[index] == 'X'))  
....................       {  
....................          base = 16;  
....................          index++;  
....................          c = s[index++];  
....................       }  
....................   
....................       // The number is a decimal number  
....................       if (base == 10)  
....................       {  
....................          while (c >= '0' && c <= '9') {  
....................             result = (result << 1) + (result << 3);  // result *= 10;  
....................             result += (c - '0');  
....................             c = s[index++];  
....................          }  
....................       }  
....................       else if (base == 16)    // The number is a hexa number  
....................       {  
....................          c = toupper(c);  
....................          while ((c >= '0' && c <= '9') || (c >= 'A' && c <='F'))  
....................          {  
....................             if (c >= '0' && c <= '9')  
....................                result = (result << 4) + (c - '0');  
....................             else  
....................                result = (result << 4) + (c - 'A' + 10);  
....................   
....................             c = s[index++];c = toupper(c);  
....................          }  
....................       }  
....................    }  
....................   
....................    if (base == 10 && sign == 1)  
....................       result = -result;  
....................   
....................    return(result);  
.................... }  
....................   
.................... float strtod(char *s,char *endptr) {  
....................    float pow10 = 1.0;  
....................    float result = 0.0;  
....................    int sign = 0, point = 0;  
....................    char c;  
....................    int ptr = 0;  
....................   
....................    if(s)  
....................    {  
....................       c=s[ptr++];  
....................    }  
....................   
....................    while((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {  
....................       if(c == '-') {  
....................          sign = 1;  
....................          c = s[ptr++];  
....................       }  
....................   
....................       while((c >= '0' && c <= '9') && point == 0) {  
....................          result = 10*result + c - '0';  
....................          c = s[ptr++];  
....................       }  
....................   
....................       if (c == '.') {  
....................          point = 1;  
....................          c = s[ptr++];  
....................       }  
....................   
....................       while((c >= '0' && c <= '9') && point == 1) {  
....................          pow10 = pow10*10;  
....................          result += (c - '0')/pow10;  
....................          c = s[ptr++];  
....................       }  
....................   
....................       if (c == '+') {  
....................          c = s[ptr++];  
....................       }  
....................    }  
....................   
....................    if (sign == 1)  
....................       result = -1*result;  
....................    if(endptr)  
....................    {  
....................       if (ptr) {  
....................          ptr--;  
....................          *((char *)endptr)=s+ptr;  
....................       }  
....................       else  
....................          *((char *)endptr)=s;  
....................    }  
....................   
....................    return(result);  
.................... }  
....................   
.................... long strtoul(char *s,char *endptr,signed int base)  
.................... {  
....................    char *sc,*s1,*sd;  
....................    unsigned long x=0;  
....................    char sign;  
....................    char digits[]="0123456789abcdefghijklmnopqstuvwxyz";  
....................    for(sc=s;isspace(*sc);++sc);  
....................    sign=*sc=='-'||*sc=='+'?sc++:'+';  
....................    if(sign=='-')  
....................    {  
....................       if (endptr)  
....................       {  
....................         *((char *)endptr)=s;  
....................       }  
....................       return 0;  
....................    }  
....................   
....................    if (base <0 || base ==1|| base >36) // invalid base  
....................    {  
....................       if (endptr)  
....................       {  
....................         *((char *)endptr)=s;  
....................       }  
....................       return 0;  
....................    }  
....................    else if (base)  
....................    {  
....................       if(base==16 && *sc =='0'&&(sc[1]=='x' || sc[1]=='X'))  
....................          sc+=2;  
....................       if(base==8 && *sc =='0')  
....................          sc+=1;  
....................       if(base==2 && *sc =='0'&&sc[1]=='b')  
....................          sc+=2;  
....................   
....................    }  
....................    else if(*sc!='0') // base is 0, find base  
....................       base=10;  
....................    else if (sc[1]=='x' || sc[1]=='X')  
....................       base =16,sc+=2;  
....................    else if(sc[1]=='b')  
....................       base=2,sc+=2;  
....................    else  
....................       base=8;  
....................    for (s1=sc;*sc=='0';++sc);// skip leading zeroes  
....................    sd=memchr(digits,tolower(*sc),base);  
....................    for(; sd!=0; )  
....................    {  
....................       x=x*base+(int16)(sd-digits);  
....................       ++sc;  
....................       sd=memchr(digits,tolower(*sc),base);  
....................    }  
....................    if(s1==sc)  
....................    {  
....................       if (endptr)  
....................       {  
....................         *((char *)endptr)=s;  
....................       }  
....................    return 0;  
....................    }  
....................    if (endptr)  
....................         *((char *)endptr)=sc;  
....................    return x;  
.................... }  
....................   
....................   
.................... signed long strtol(char *s,char *endptr,signed int base)  
.................... {  
....................    char *sc,*s1,*sd;  
....................    signed long x=0;  
....................    char sign;  
....................    char digits[]="0123456789abcdefghijklmnopqstuvwxyz";  
....................    for(sc=s;isspace(*sc);++sc);  
....................    sign=*sc=='-'||*sc=='+'?sc++:'+';  
....................    if (base <0 || base ==1|| base >36) // invalid base  
....................    {  
....................       if (endptr)  
....................       {  
....................         *((char *)endptr)=s;  
....................       }  
....................       return 0;  
....................    }  
....................    else if (base)  
....................    {  
....................       if(base==16 && *sc =='0'&&(sc[1]=='x' || sc[1]=='X'))  
....................          sc+=2;  
....................       if(base==8 && *sc =='0')  
....................          sc+=1;  
....................       if(base==2 && *sc =='0'&&sc[1]=='b')  
....................          sc+=2;  
....................   
....................    }  
....................    else if(*sc!='0') // base is 0, find base  
....................       base=10;  
....................    else if (sc[1]=='x' || sc[1]=='X')  
....................       base =16,sc+=2;  
....................    else if(sc[1]=='b')  
....................       base=2,sc+=2;  
....................    else  
....................       base=8;  
....................    for (s1=sc;*sc=='0';++sc);// skip leading zeroes  
....................   
....................    sd=memchr(digits,tolower(*sc),base);  
....................    for(;sd!=0;)  
....................    {  
....................       x=x*base+(int16)(sd-digits);  
....................       ++sc;  
....................       sd=memchr(digits,tolower(*sc),base);  
....................    }  
....................    if(s1==sc)  
....................    {  
....................       if (endptr)  
....................       {  
....................         *((char *)endptr)=s;  
....................       }  
....................    return 0;  
....................    }  
....................    if(sign=='-')  
....................       x  =-x;  
....................    if (endptr)  
....................         *((char *)endptr)=sc;  
....................    return x;  
.................... }  
....................   
.................... signed int system(char *string)  
.................... {  
....................    return 0;  
.................... }  
....................   
.................... int mblen(char *s,size_t n)  
.................... {  
....................    return strlen(s);  
.................... }  
....................   
.................... int mbtowc(wchar_t *pwc,char *s,size_t n)  
.................... {  
....................    *pwc=*s;  
....................    return 1;  
.................... }  
....................   
.................... int wctomb(char *s,wchar_t wchar)  
.................... {  
....................    *s=wchar;  
....................    return 1;  
.................... }  
....................   
.................... size_t mbstowcs(wchar_t *pwcs,char *s,size_t n)  
.................... {  
....................    strncpy(pwcs,s,n);  
....................    return strlen(pwcs);  
.................... }  
....................   
.................... size_t wcstombs(char *s,wchar_t *pwcs,size_t n)  
.................... {  
....................    strncpy(s,pwcs,n);  
....................    return strlen(s);  
.................... }  
....................   
.................... //---------------------------------------------------------------------------  
.................... // The random number implementation  
.................... //---------------------------------------------------------------------------  
....................   
.................... unsigned int32 _Randseed = 1;  
0246:  MOVLW  01
0247:  MOVWF  30
0248:  CLRF   31
0249:  CLRF   32
024A:  CLRF   33
....................   
.................... long rand(void)  
.................... {  
....................    _Randseed = _Randseed * 1103515245 + 12345;  
....................    return ((unsigned long)(_Randseed >> 16) % RAND_MAX);  
.................... }  
....................   
.................... void srand(unsigned int32 seed)  
.................... {  
....................    _Randseed = seed;  
.................... }  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Searching and sorting utilities implementation  
.................... //---------------------------------------------------------------------------  
....................   
.................... typedef signed int (*_Cmpfun)(char * p1,char * p2);  
....................   
.................... void qsort(char * qdata, int qitems, int qsize, _Cmpfun cmp) {  
....................    int m,j,i,l;  
....................    short done;  
....................    BYTE t[16];  
....................   
....................    m = qitems/2;  
....................    while( m > 0 ) {  
....................      for(j=0; j<(qitems-m); ++j) {  
....................         i = j;  
....................         do  
....................         {  
....................            done=TRUE;  
....................            l = i+m;  
....................            if( (*cmp)(qdata+i*qsize, qdata+l*qsize) > 0 ) {  
....................               memcpy(t, qdata+i*qsize, qsize);  
....................               memcpy(qdata+i*qsize, qdata+l*qsize, qsize);  
....................               memcpy(qdata+l*qsize, t, qsize);  
....................               if(m <= i)  
....................                 i -= m;  
....................                 done = FALSE;  
....................            }  
....................         } while(!done);  
....................      }  
....................      m = m/2;  
....................    }  
.................... }  
....................   
....................   
.................... char *bsearch(char *key, char *base, size_t num, size_t width,_Cmpfun cmp)  
.................... {  
....................    char *p, *q;  
....................    size_t n;  
....................    size_t pivot;  
....................    signed int val;  
....................   
....................    p = base;  
....................    n = num;  
....................   
....................    while (n > 0)  
....................    {  
....................       pivot = n >> 1;  
....................       q = p + width * pivot;  
....................   
....................       val = (*cmp)(key, q);  
....................   
....................       if (val < 0)  
....................          n = pivot;  
....................       else if (val == 0)  
....................          return ((char *)q);  
....................       else {  
....................          p = q + width;  
....................          n -= pivot + 1;  
....................       }  
....................    }  
....................   
....................    return NULL;      // There's no match  
.................... }  
....................   
....................   
.................... #endif  
....................  
.................... #include <string.h> 
....................  ////////////////////////////////////////////////////////////////////////////  
.................... ////        (C) Copyright 1996,2003 Custom Computer Services            ////  
.................... //// This source code may only be used by licensed users of the CCS C   ////  
.................... //// compiler.  This source code may only be distributed to other       ////  
.................... //// licensed users of the CCS C compiler.  No other use, reproduction  ////  
.................... //// or distribution is permitted without written permission.           ////  
.................... //// Derivative programs created using this software in object code     ////  
.................... //// form are not restricted in any way.                                ////  
.................... ////////////////////////////////////////////////////////////////////////////  
....................   
.................... #ifndef _STRING  
.................... #define _STRING  
.................... #include <stddef.h>  
.................... #include <ctype.h>  
....................   
....................   
....................   
.................... //////////////////////////////////////////////  
.................... //// Uncomment the following define to    ////  
.................... //// allow some functions to use a        ////  
.................... //// quicker algorithm, but use more ROM  ////  
.................... ////                                      ////  
.................... //// #define FASTER_BUT_MORE_ROM          ////  
.................... //////////////////////////////////////////////  
....................   
....................   
....................   
.................... /*Copying functions*/  
.................... /* standard template:  
....................    void *memmove(void *s1, void *s2, size_t n).  
....................    Copies max of n characters safely (not following ending '\0')  
....................    from s2 in s1; if s2 has less than n characters, appends 0 */  
....................   
.................... char *memmove(void *s1,char *s2,size_t n)  
.................... {  
....................    char *sc1;  
....................    char *sc2;  
....................    sc1=s1;  
....................    sc2=s2;  
....................    if(sc2<sc1 && sc1 <sc2 +n)  
....................       for(sc1+=n,sc2+=n;0<n;--n)  
....................          *--sc1=*--sc2;  
....................    else  
....................       for(;0<n;--n)  
....................          *sc1++=*sc2++;  
....................   return s1;  
....................   }  
....................   
.................... /* compiler ignored the name 'strcpy()'; perhaps, it's reserved? 
....................    Standard template: char *strcpy(char *s1, const char *s2)  
....................    copies the string s2 including the null character to s1*/  
....................   
.................... char *strcopy(char *s1, char *s2)  
.................... {  
....................   char *s;  
....................   
....................   for (s = s1; *s2 != 0; s++, s2++) {  
.................... 	  *s = *s2;  
....................   }  
....................   *s = *s2;  
....................   return(s1);  
.................... }  
....................   
.................... /* standard template:  
....................    char *strncpy(char *s1, const char *s2, size_t n).  
....................    Copies max of n characters (not following ending '\0')  
....................    from s2 in s1; if s2 has less than n characters, appends 0 */  
....................   
.................... char *strncpy(char *s1, char *s2, size_t n)  
.................... {  
....................   char *s;  
....................   
....................   for (s = s1; n > 0 && *s2 != '\0'; n--)  
....................      *s++ = *s2++;  
....................   for (; n > 0; n--)  
....................      *s++ = '\0';  
....................   
....................   return(s1);  
.................... }  
.................... /***********************************************************/  
....................   
.................... /*concatenation functions*/  
.................... /* standard template: char *strcat(char *s1, const char *s2)  
.................... appends s2 to s1*/  
....................   
.................... char *strcat(char *s1, char *s2)  
.................... {  
....................    char *s;  
....................   
....................    for (s = s1; *s != '\0'; ++s);  
....................    while(*s2 != '\0')  
....................    {  
....................       *s = *s2;  
....................       ++s;  
....................       ++s2;  
....................    }  
....................   
....................    *s = '\0';  
....................    return(s1);  
.................... }  
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n)  
.................... appends not more than n characters from s2 to s1*/  
....................   
.................... char *strncat(char *s1, char *s2, size_t n)  
.................... {  
....................    char *s;  
....................   
....................    for (s = s1; *s != '\0'; ++s);  
....................    while(*s2 != '\0' && 0<n)  
....................    {  
....................       *s = *s2;  
....................       ++s;  
....................       ++s2;  
....................       --n;  
....................    }  
....................   
....................    *s = '\0';  
....................    return(s1);  
.................... }  
....................   
.................... /***********************************************************/  
....................   
....................   
.................... /*comparison functions*/  
.................... /* standard template: signed int memcmp(void *s1, void *s2).  
....................    Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */  
....................   
.................... signed int memcmp(void * s1,char *s2,size_t n)  
.................... {  
.................... char *su1, *su2;  
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)  
.................... {  
....................    if(*su1!=*su2)  
....................       return ((*su1<*su2)?1:+1);  
.................... }  
.................... return 0;  
.................... }  
....................   
.................... /* standard template: int strcmp(const char *s1, const char *s2).  
....................    Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */  
....................   
.................... signed int strcmp(char *s1, char *s2)  
.................... {  
....................    for (; *s1 == *s2; s1++, s2++)  
....................       if (*s1 == '\0')  
....................          return(0);  
....................    return((*s1 < *s2) ?-1: 1);  
.................... }  
.................... /* standard template: int strcoll(const char *s1, const char *s2).  
....................    Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */  
....................   
.................... signed int strcoll(char *s1, char *s2)  
.................... {  
....................    for (; *s1 == *s2; s1++, s2++)  
....................       if (*s1 == '\0')  
....................          return(0);  
....................    return((*s1 < *s2) ?-1: 1);  
.................... }  
....................   
.................... /* standard template:  
....................    int strncmp(const char *s1, const char *s2, size_t n).  
....................    Compares max of n characters (not following 0) from s1 to s2;  
....................    returns same as strcmp */  
....................   
.................... signed int strncmp(char *s1, char *s2, size_t n)  
.................... {  
....................    for (; n > 0; s1++, s2++, n--)  
....................       if (*s1 != *s2)  
....................          return((*s1 <*s2) ?-1: 1);  
....................       else if (*s1 == '\0')  
....................          return(0);  
....................    return(0);  
.................... }  
.................... /* standard template:  
....................    int strxfrm(const char *s1, const char *s2, size_t n).  
....................    transforms maximum of n characters from s2 and places them into s1*/  
.................... size_t strxfrm(char *s1, char *s2, size_t n)  
.................... {  
....................   char *s;  
....................   int n1;  
....................   n1=n;  
....................   for (s = s1; n > 0 && *s2 != '\0'; n--)  
....................      *s++ = *s2++;  
....................   for (; n > 0; n--)  
....................      *s++ = '\0';  
....................   
....................   return(n1);  
.................... }  
....................   
....................   
....................   
....................   
....................   
.................... /***********************************************************/  
.................... /*Search functions*/  
.................... /* standard template: void *memchr(const char *s, int c).  
....................    Finds first occurrence of c in n characters of s */  
....................   
.................... char *memchr(void *s,int c,size_t n)  
.................... {  
....................    char uc;  
....................    char *su;  
....................    uc=c;  
....................    for(su=s;0<n;++su,--n)  
....................       if(*su==uc)  
....................       return su;  
....................    return NULL;  
.................... }  
....................   
.................... /* standard template: char *strchr(const char *s, int c).  
....................    Finds first occurrence of c in s */  
....................   
.................... char *strchr(char *s, int c)  
.................... {  
....................    for (; *s != c; s++)  
....................       if (*s == '\0')  
....................          return(0);  
....................    return(s);  
.................... }  
.................... /* standard template:  
....................    size_t strcspn(const char *s1, const char *s2).  
....................    Computes length of max initial segment of s1 that  
....................    consists entirely of characters NOT from s2*/  
....................   
.................... int *strcspn(char *s1, char *s2)  
.................... {  
....................    char *sc1, *sc2;  
....................   
....................    for (sc1 = s1; *sc1 != 0; sc1++)  
....................       for (sc2 = s2; *sc2 != 0; sc2++)  
....................          if (*sc1 == *sc2)  
....................             return(sc1 - s1);  
....................    return(sc1 - s1);  
.................... }  
.................... /* standard template:  
....................    char *strpbrk(const char *s1, const char *s2).  
....................    Locates first occurence of any character from s2 in s1;  
....................    returns s1 if s2 is empty string */  
....................   
.................... char *strpbrk(char *s1, char *s2)  
.................... {  
....................    char *sc1, *sc2;  
....................   
....................    for (sc1 = s1; *sc1 != 0; sc1++)  
....................       for (sc2 = s2; *sc2 != 0; sc2++)  
....................          if (*sc1 == *sc2)  
....................             return(sc1);  
....................    return(0);  
.................... }  
....................   
....................   
.................... /* standard template: char *strrchr(const char *s, int c).  
....................    Finds last occurrence of c in s */  
....................   
.................... char *strrchr(char *s, int c)  
.................... {  
....................    char *p;  
....................   
....................    for (p = 0; ; s++)  
....................    {  
....................       if (*s == c)  
....................          p = s;  
....................       if (*s == '\0')  
....................          return(p);  
....................    }  
.................... }  
.................... /* computes length of max initial segment of s1 consisting  
....................    entirely of characters from s2 */  
....................   
.................... int *strspn(char *s1, char *s2)  
.................... {  
....................    char *sc1, *sc2;  
....................   
....................    for (sc1 = s1; *sc1 != 0; sc1++)  
....................       for (sc2 = s2; ; sc2++)  
.................... 	 if (*sc2 == '\0')  
.................... 	    return(sc1 - s1);  
....................          else if (*sc1 == *sc2)  
....................             break;  
....................    return(sc1 - s1);  
.................... }  
.................... /* standard template:  
....................    char *strstr(const char *s1, const char *s2);  
....................    Locates first occurence of character sequence s2 in s1;  
....................    returns 0 if s2 is empty string  
....................   
....................    Uncomment #define FASTER_BUT_MORE_ROM at the top of the  
....................    file to use the faster algorithm */  
.................... char *strstr(char *s1, char *s2)  
.................... {  
.................... 	char *s, *t;  
....................   
....................    #ifdef FASTER_BUT_MORE_ROM  
....................    if (*s2 == '\0')  
....................          return(s1);  
....................    #endif  
....................   
.................... 	while (*s1)  
....................    {  
....................       for(s = s1, t = s2; *t && *s == *t; ++s, ++t);  
....................   
.................... 		if (*t == '\0')  
.................... 			return s1;  
....................       ++s1;  
....................       #ifdef FASTER_BUT_MORE_ROM  
....................          while(*s1 != '\0' && *s1 != *s2)  
....................             ++s1;  
....................       #endif  
.................... 	}  
.................... 	return 0;  
.................... }  
....................   
.................... /* standard template: char *strtok(char *s1, const char *s2).  
....................   
....................    Finds next token in s1 delimited by a character from separator  
....................    string s2 (which can be different from call to call).  First call  
....................    starts at beginning of s1 searching for first character NOT  
....................    contained in s2; returns 0 if none is found.  
....................    If one is found, it is the start of first token (return value).  
....................    Function then searches from there for a character contained in s2.  
....................    If none is found, current token extends to end of s1, and subsequent  
....................    searches for a token will return 0.  If one is found, it is  
....................    overwritten by '\0', which terminates current token.  Function saves  
....................    pointer to following character from which next search will start.  
....................    Each subsequent call, with 0 as first argument, starts searching  
....................    from saved pointer */  
....................   
.................... char *strtok(char *s1, char *s2)  
.................... {  
....................    char *beg, *end;  
....................    static char *save;  
....................   
....................    beg = (s1)?s1: save;  
....................    beg += strspn(beg, s2);  
....................    if (*beg == '\0')  
....................    {  
....................       *save = ' ';  
....................       return(0);  
....................    }  
....................    end = strpbrk(beg, s2);  
....................    if (*end != '\0')  
....................    {  
....................       *end = '\0';  
....................       end++;  
....................    }  
....................    save = end;  
....................    return(beg);  
.................... }  
....................   
.................... /*****************************************************************/  
.................... /*Miscellaneous functions*/  
.................... /* standard template  
.................... maps error number in errnum to an error message string  
.................... Returns: Pointer to string  
.................... */  
.................... #ifdef _ERRNO  
.................... char * strerror(int errnum)  
.................... {  
.................... char s[15];  
.................... switch( errnum)  
.................... {  
.................... case 0:  
....................    strcpy(s,"no errors");  
....................    return s;  
.................... case EDOM :  
....................    strcpy(s,"domain error");  
....................    return s;  
.................... case ERANGE:  
....................    strcpy(s,"range error");  
....................    return s;  
.................... }  
.................... }  
.................... #ENDIF  
.................... /* standard template: size_t strlen(const char *s).  
....................    Computes length of s1 (preceding terminating 0) */  
....................   
.................... int *strlen(char *s)  
.................... {  
....................    char *sc;  
....................   
....................    for (sc = s; *sc != 0; sc++);  
....................    return(sc - s);  
.................... }  
....................   
.................... /* standard template: size_t stricmp(const char *s1, const char *s2).  
....................    Compares s1 to s2 ignoring case (upper vs. lower) */  
....................   
.................... signed int stricmp(char *s1, char *s2)  
.................... {  
....................  for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));  
....................     s1++, s2++)  
....................     if (*s1 == '\0')  
....................        return(0);  
....................  return((*s1 < *s2) ?-1: 1);  
.................... }  
....................   
....................   
.................... /* standard template: char *strlwr(char *s).  
....................    Replaces uppercase letters by lowercase;  
....................    returns pointer to new string s */  
....................   
.................... char *strlwr(char *s)  
.................... {  
....................    char *p;  
....................   
....................    for (p = s; *p != '\0'; p++)  
....................       if (*p >= 'A' && *p <='Z')  
....................          *p += 'a' - 'A';  
....................    return(s);  
.................... }  
....................   
....................   
.................... /************************************************************/  
....................   
....................   
.................... #endif  
....................  
.................... #include "freq_gen.h" 
....................  /****************************************************************************/  
.................... /* Copyright 2004 MBARI.                                                    */  
.................... /* Monterey Bay Aquarium Research Institute Proprietary Information.        */  
.................... /* All rights reserved.                                                     */  
.................... /****************************************************************************/  
.................... #ifndef FREQ_GEN_H  
.................... #define FREQ_GEN_H  
....................   
.................... #define FREQ_GEN_VERSION 0  
.................... #define FREQ_GEN_SUB_VERSION 30  
....................   
.................... /*  
....................     The ticks per second is based on an 8-bit counter over flowing that  
....................     is driven by a 4 Mhz ocsillator prescaled by 4 and postscaled by 64.  
....................   
....................     TICKS_PER_SEC = (OSC_CLK) / (PRESCALE) / (POSTSCALE) / (8_BIT_OVERFLOW)  
....................                   = 3580000   /     4      /      64     /      256  
....................                   = 54.626  
.................... */  
.................... #define TICKS_PER_SEC           55  
.................... #define FREQ_DURATION           TICKS_PER_SEC  
....................   
.................... #define PORTC_CLEAR_ALL         0b00000000  
....................   
.................... #define PORTB_LED_ON            0b00000010  
.................... #define PORTB_LED_OFF           0b00000000  
....................   
.................... #define PORTC_CURRENT_ON        0b00001100  
.................... #define PORTC_CURRENT_OFF       0b00000100  
....................   
.................... #define PORTC_1000HZ_FREQ_UP    0b00000001  
.................... #define PORTC_1000HZ_FREQ       0b00000000  
.................... #define PORTC_1000HZ_FREQ_DN    0b00000010  
....................   
.................... #define PORTC_316HZ_FREQ_UP     0b00100001  
.................... #define PORTC_316HZ_FREQ        0b00100000  
.................... #define PORTC_316HZ_FREQ_DN     0b00100010  
....................   
.................... #define PORTC_100HZ_FREQ_UP     0b00110001  
.................... #define PORTC_100HZ_FREQ        0b00110000  
.................... #define PORTC_100HZ_FREQ_DN     0b00110010  
....................   
.................... #define PORTC_DRAIN_CAPS        0b00110000  
....................   
.................... #endif  
....................  
....................   
.................... /********************************** GLOBS ***********************************/  
....................   
.................... long rtccTicks = 0;  
024B:  CLRF   34
024C:  CLRF   35
.................... int freqDuration = 0;  
024D:  CLRF   36
.................... int freqEnabled = FALSE;  
024E:  CLRF   37
.................... int loopSize = 0;  
024F:  CLRF   38
.................... int loopCount = 0;  
0250:  CLRF   39
.................... #byte portB = 0x06  
.................... #byte portC = 0x07  
....................   
.................... /********************************** GLOBS ***********************************/  
....................   
.................... #INT_RTCC  
.................... rtccIsr()  
.................... {  
....................     if ( !freqEnabled )  
*
00FB:  MOVF   37,F
00FC:  BTFSS  03.2
00FD:  GOTO   102
....................     {  
....................         rtccTicks = 0;  
00FE:  CLRF   35
00FF:  CLRF   34
....................         // stay in process commands   
....................         freqDuration = 0;  
0100:  CLRF   36
....................         return;  
0101:  GOTO   10F
....................     }  
....................   
....................     rtccTicks++;  
0102:  INCF   34,F
0103:  BTFSC  03.2
0104:  INCF   35,F
....................   
....................     if ( FREQ_DURATION == rtccTicks )  
0105:  MOVF   34,W
0106:  SUBLW  37
0107:  BTFSS  03.2
0108:  GOTO   10F
0109:  MOVF   35,F
010A:  BTFSS  03.2
010B:  GOTO   10F
....................     {  
....................         rtccTicks = 0;  
010C:  CLRF   35
010D:  CLRF   34
....................         ++freqDuration;  
010E:  INCF   36,F
....................     }  
.................... }  
....................   
010F:  BCF    0B.2
0110:  BCF    0A.3
0111:  GOTO   020
.................... void enable()  
.................... {  
....................     freqEnabled = TRUE;  
*
0185:  MOVLW  01
0186:  MOVWF  37
....................     printf("freq gen enabled\r\n");  
0187:  CLRF   3D
0188:  MOVF   3D,W
0189:  CALL   035
018A:  INCF   3D,F
018B:  MOVWF  20
018C:  MOVF   20,W
018D:  BTFSS  0C.4
018E:  GOTO   18D
018F:  MOVWF  19
0190:  MOVLW  12
0191:  SUBWF  3D,W
0192:  BTFSS  03.2
0193:  GOTO   188
....................     //portB = PORTB_LED_ON;  
.................... 	return;  
.................... }  
0194:  RETLW  00
....................   
.................... void disable()  
.................... {  
....................     freqEnabled = FALSE;  
0195:  CLRF   37
....................     printf("freq gen disabled\r\n");  
0196:  CLRF   3D
0197:  MOVF   3D,W
0198:  CALL   04C
0199:  INCF   3D,F
019A:  MOVWF  20
019B:  MOVF   20,W
019C:  BTFSS  0C.4
019D:  GOTO   19C
019E:  MOVWF  19
019F:  MOVLW  13
01A0:  SUBWF  3D,W
01A1:  BTFSS  03.2
01A2:  GOTO   197
....................     //portB = PORTB_LED_OFF;  
....................     return;  
.................... }  
01A3:  RETLW  00
....................   
.................... void processCmds()  
.................... {  
....................     int b, c;  
....................     static int old_b = 1;  
*
0251:  MOVWF  3A
....................   
....................     b = input(PIN_B0);  
*
01B1:  BSF    03.5
01B2:  BSF    06.0
01B3:  BCF    03.5
01B4:  CLRF   3B
01B5:  BTFSC  06.0
01B6:  INCF   3B,F
....................     //b = 0x00;  
....................   
....................     if (b!=old_b && !b && !freqEnabled)  
01B7:  MOVF   3A,W
01B8:  SUBWF  3B,W
01B9:  BTFSC  03.2
01BA:  GOTO   1C3
01BB:  MOVF   3B,F
01BC:  BTFSS  03.2
01BD:  GOTO   1C3
01BE:  MOVF   37,F
01BF:  BTFSS  03.2
01C0:  GOTO   1C3
....................     {  
.................... 		enable();  
01C1:  CALL   185
....................     }  
....................   
....................     else if (b!=old_b && b && freqEnabled)  
01C2:  GOTO   21F
01C3:  MOVF   3A,W
01C4:  SUBWF  3B,W
01C5:  BTFSC  03.2
01C6:  GOTO   1CF
01C7:  MOVF   3B,F
01C8:  BTFSC  03.2
01C9:  GOTO   1CF
01CA:  MOVF   37,F
01CB:  BTFSC  03.2
01CC:  GOTO   1CF
....................     {  
.................... 		disable();  
01CD:  CALL   195
....................     }  
....................   
....................     else if ( kbhit() )  
01CE:  GOTO   21F
01CF:  BTFSS  0C.5
01D0:  GOTO   21F
....................     {  
....................         c = getc();  
01D1:  GOTO   1A4
01D2:  MOVF   21,W
01D3:  MOVWF  3C
....................   
....................         switch ( toupper(c))  
....................         {  
01D4:  MOVF   3C,W
01D5:  SUBLW  60
01D6:  BTFSC  03.0
01D7:  GOTO   1DF
01D8:  MOVF   3C,W
01D9:  SUBLW  7A
01DA:  BTFSS  03.0
01DB:  GOTO   1DF
01DC:  MOVF   3C,W
01DD:  ANDLW  DF
01DE:  GOTO   1E0
01DF:  MOVF   3C,W
01E0:  XORLW  31
01E1:  BTFSC  03.2
01E2:  GOTO   1F3
01E3:  XORLW  50
01E4:  BTFSC  03.2
01E5:  GOTO   1F3
01E6:  XORLW  20
01E7:  BTFSC  03.2
01E8:  GOTO   1F3
01E9:  XORLW  73
01EA:  BTFSC  03.2
01EB:  GOTO   1F5
01EC:  XORLW  50
01ED:  BTFSC  03.2
01EE:  GOTO   1F5
01EF:  XORLW  20
01F0:  BTFSC  03.2
01F1:  GOTO   1F5
01F2:  GOTO   1F7
....................             case '1':     
....................             case 'a':     
....................             case 'A':     
....................                 enable();  
01F3:  CALL   185
....................                 break;  
01F4:  GOTO   21F
....................             case '2':     
....................             case 'b':     
....................             case 'B':     
....................                 disable();  
01F5:  CALL   195
....................                 break;  
01F6:  GOTO   21F
....................             default:      
....................                 printf("1 - enable freq gen\r\n");  
01F7:  CLRF   3D
01F8:  MOVF   3D,W
01F9:  CALL   064
01FA:  INCF   3D,F
01FB:  MOVWF  20
01FC:  MOVF   20,W
01FD:  BTFSS  0C.4
01FE:  GOTO   1FD
01FF:  MOVWF  19
0200:  MOVLW  15
0201:  SUBWF  3D,W
0202:  BTFSS  03.2
0203:  GOTO   1F8
....................                 printf("2 - disable freq gen\r\n");  
0204:  CLRF   3D
0205:  MOVF   3D,W
0206:  CALL   07E
0207:  INCF   3D,F
0208:  MOVWF  20
0209:  MOVF   20,W
020A:  BTFSS  0C.4
020B:  GOTO   20A
020C:  MOVWF  19
020D:  MOVLW  16
020E:  SUBWF  3D,W
020F:  BTFSS  03.2
0210:  GOTO   205
....................                 printf("?- help menu\r\n");  
0211:  CLRF   3D
0212:  MOVF   3D,W
0213:  CALL   099
0214:  INCF   3D,F
0215:  MOVWF  20
0216:  MOVF   20,W
0217:  BTFSS  0C.4
0218:  GOTO   217
0219:  MOVWF  19
021A:  MOVLW  0F
021B:  SUBWF  3D,W
021C:  BTFSS  03.2
021D:  GOTO   212
....................                 break;  
021E:  GOTO   21F
....................         }  
....................     }  
....................     old_b = b;  
021F:  MOVF   3B,W
0220:  MOVWF  3A
....................     return;  
.................... }  
0221:  RETLW  00
....................   
.................... main()  
.................... {  
*
0235:  CLRF   04
0236:  MOVLW  1F
0237:  ANDWF  03,F
0238:  BSF    03.5
0239:  BSF    1F.0
023A:  BSF    1F.1
023B:  BSF    1F.2
023C:  BCF    1F.3
023D:  MOVLW  16
023E:  MOVWF  19
023F:  MOVLW  26
0240:  MOVWF  18
0241:  MOVLW  90
0242:  BCF    03.5
0243:  MOVWF  18
....................     // setup port b bit 0 as input, 1 as output   
....................     set_tris_b(0x02);  
*
0252:  MOVLW  02
0253:  BSF    03.5
0254:  MOVWF  06
....................   
....................     // setup port c bits 0-6 as outputs, 7 as input   
....................     set_tris_c(0x80);  
0255:  MOVLW  80
0256:  MOVWF  07
....................   
....................     // init freq pins   
....................     portC = PORTC_CLEAR_ALL;  
0257:  BCF    03.5
0258:  CLRF   07
....................   
....................     // setup the system clock   
....................     setup_counters(RTCC_INTERNAL, RTCC_DIV_64);  
0259:  MOVLW  05
025A:  MOVWF  20
025B:  BTFSS  20.3
025C:  GOTO   265
025D:  MOVLW  07
025E:  CLRF   01
025F:  MOVLW  81
0260:  MOVWF  04
0261:  MOVF   00,W
0262:  ANDLW  C0
0263:  IORLW  0F
0264:  MOVWF  00
0265:  CLRWDT
0266:  MOVLW  81
0267:  MOVWF  04
0268:  MOVF   00,W
0269:  ANDLW  C0
026A:  IORWF  20,W
026B:  MOVWF  00
....................   
....................     // make sure interrupts are enabled   
....................     enable_interrupts(INT_RTCC);  
026C:  BSF    0B.5
....................     enable_interrupts(GLOBAL);  
026D:  MOVLW  C0
026E:  IORWF  0B,F
....................   
....................     // welcome message   
....................     printf("Freq Gen version %d.%d\r\n",  
....................             FREQ_GEN_VERSION, FREQ_GEN_SUB_VERSION);  
026F:  CLRF   3B
0270:  MOVF   3B,W
0271:  CALL   0AD
0272:  INCF   3B,F
0273:  MOVWF  20
0274:  MOVF   20,W
0275:  BTFSS  0C.4
0276:  GOTO   275
0277:  MOVWF  19
0278:  MOVLW  11
0279:  SUBWF  3B,W
027A:  BTFSS  03.2
027B:  GOTO   270
027C:  CLRF   3C
027D:  MOVLW  18
027E:  MOVWF  3D
027F:  CALL   127
0280:  MOVLW  2E
0281:  BTFSS  0C.4
0282:  GOTO   281
0283:  MOVWF  19
0284:  MOVLW  1E
0285:  MOVWF  3C
0286:  MOVLW  18
0287:  MOVWF  3D
0288:  CALL   127
0289:  MOVLW  0D
028A:  BTFSS  0C.4
028B:  GOTO   28A
028C:  MOVWF  19
028D:  MOVLW  0A
028E:  BTFSS  0C.4
028F:  GOTO   28E
0290:  MOVWF  19
....................   
....................     // main loop   
....................     for(;;)  
....................     {  
....................         // wait for things to settle down   
....................         delay_ms(50);  
0291:  MOVLW  32
0292:  MOVWF  3B
0293:  CALL   170
....................   
....................         // process any queued cmds   
....................         while ( freqDuration == 0 )  
....................         processCmds();  
0294:  MOVF   36,F
0295:  BTFSS  03.2
0296:  GOTO   299
0297:  CALL   1B1
0298:  GOTO   294
....................         while ( freqDuration == 1 )  
....................         processCmds();  
0299:  DECFSZ 36,W
029A:  GOTO   29D
029B:  CALL   1B1
029C:  GOTO   299
....................   
.................... 		// Magnetic source output  
....................         printf("Magnetic signal...\r\n");  
029D:  CLRF   3B
029E:  MOVF   3B,W
029F:  CALL   0CA
02A0:  INCF   3B,F
02A1:  MOVWF  20
02A2:  MOVF   20,W
02A3:  BTFSS  0C.4
02A4:  GOTO   2A3
02A5:  MOVWF  19
02A6:  MOVLW  0F
02A7:  SUBWF  3B,W
02A8:  BTFSS  03.2
02A9:  GOTO   29E
02AA:  MOVLW  03
02AB:  MOVWF  3C
02AC:  MOVLW  2E
02AD:  BTFSS  0C.4
02AE:  GOTO   2AD
02AF:  MOVWF  19
02B0:  DECFSZ 3C,F
02B1:  GOTO   2AC
02B2:  MOVLW  0D
02B3:  BTFSS  0C.4
02B4:  GOTO   2B3
02B5:  MOVWF  19
02B6:  MOVLW  0A
02B7:  BTFSS  0C.4
02B8:  GOTO   2B7
02B9:  MOVWF  19
....................         output_high(PIN_B1); //portB = PORTB_LED_ON;  
02BA:  BSF    03.5
02BB:  BCF    06.1
02BC:  BCF    03.5
02BD:  BSF    06.1
....................   
....................         // 1000 Hz Magnetic  
....................         while ( freqDuration == 2 )  
....................         {  
02BE:  MOVF   36,W
02BF:  SUBLW  02
02C0:  BTFSS  03.2
02C1:  GOTO   2DF
....................                      
....................             //50% duty cycle  
....................             // off  
....................             //portC = PORTC_1000HZ_FREQ;  
....................             delay_us(124);  
02C2:  MOVLW  24
02C3:  MOVWF  20
02C4:  DECFSZ 20,F
02C5:  GOTO   2C4
02C6:  NOP
....................             // wave up   
....................             output_high(PIN_C0); //portC = PORTC_1000HZ_FREQ_UP;  
02C7:  BSF    07.0
....................             delay_us(247);  
02C8:  MOVLW  49
02C9:  MOVWF  20
02CA:  DECFSZ 20,F
02CB:  GOTO   2CA
02CC:  NOP
....................             // off  
....................             output_low(PIN_C0); //portC = PORTC_1000HZ_FREQ;  
02CD:  BCF    07.0
....................             delay_us(247);  
02CE:  MOVLW  49
02CF:  MOVWF  20
02D0:  DECFSZ 20,F
02D1:  GOTO   2D0
02D2:  NOP
....................             // wave down   
....................             output_high(PIN_C1); //portC = PORTC_1000HZ_FREQ_DN;  
02D3:  BSF    07.1
....................             delay_us(247); // (5 us delay)   
02D4:  MOVLW  49
02D5:  MOVWF  20
02D6:  DECFSZ 20,F
02D7:  GOTO   2D6
02D8:  NOP
....................             // off  
....................             output_low(PIN_C1); //portC = PORTC_1000HZ_FREQ;  
02D9:  BCF    07.1
....................             delay_us(119);  
02DA:  MOVLW  23
02DB:  MOVWF  20
02DC:  DECFSZ 20,F
02DD:  GOTO   2DC
....................         }  
02DE:  GOTO   2BE
....................           
....................         /*  
....................         // 100% Duty cycle  
....................         for (loopCount = 0; loopCount < 250; ++loopCount)  
....................         {  
....................             // wave up   
....................             portC = PORTC_1000HZ_FREQ_UP;  
....................             delay_us(499);  
....................             // wave down   
....................             portC = PORTC_1000HZ_FREQ_DN;  
....................             delay_us(494); // (5 us delay)   
....................         }  
....................         // 50% Duty cycle  
....................         for (loopCount = 0; loopCount < 250; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_1000HZ_FREQ;  
....................             delay_us(124);  
....................             // wave up   
....................             portC = PORTC_1000HZ_FREQ_UP;  
....................             delay_us(249);  
....................             // off  
....................             portC = PORTC_1000HZ_FREQ;  
....................             delay_us(249);  
....................             // wave down   
....................             portC = PORTC_1000HZ_FREQ_DN;  
....................             delay_us(249); // (5 us delay)   
....................             // off  
....................             portC = PORTC_1000HZ_FREQ;  
....................             delay_us(120);  
....................         }  
....................         // 25% Duty cycle  
....................         for (loopCount = 0; loopCount < 250; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_1000HZ_FREQ;  
....................             delay_us(187);  
....................             // wave up   
....................             portC = PORTC_1000HZ_FREQ_UP;  
....................             delay_us(124);  
....................             // off  
....................             portC = PORTC_1000HZ_FREQ;  
....................             delay_us(374);  
....................             // wave down   
....................             portC = PORTC_1000HZ_FREQ_DN;  
....................             delay_us(124); // (5 us delay)   
....................             // off  
....................             portC = PORTC_1000HZ_FREQ;  
....................             delay_us(183);  
....................         }  
....................         // 10% Duty cycle  
....................         for (loopCount = 0; loopCount < 250; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_1000HZ_FREQ;  
....................             delay_us(224);  
....................             // wave up   
....................             portC = PORTC_1000HZ_FREQ_UP;  
....................             delay_us(49);  
....................             // off  
....................             portC = PORTC_1000HZ_FREQ;  
....................             delay_us(449);  
....................             // wave down   
....................             portC = PORTC_1000HZ_FREQ_DN;  
....................             delay_us(49); // (5 us delay)   
....................             // off  
....................             portC = PORTC_1000HZ_FREQ;  
....................             delay_us(220);  
....................         }  
....................         */  
....................         /*  
....................         for (loopSize = 1; loopSize <= 141; ++loopSize)   
....................         {  
....................             for (loopCount = 0; loopCount < loopSize; ++loopCount)  
....................             {  
....................                 // wave up   
....................                 portC = PORTC_1000HZ_FREQ_UP;  
....................                 delay_us(23);  
....................             } // for (loopCount  
....................             for (loopCount = 0; loopCount < loopSize; ++loopCount)  
....................             {  
....................                 // wave down   
....................                 portC = PORTC_1000HZ_FREQ_DN;  
....................                 delay_us(23);   
....................             } // for (loopCount  
....................         } // for (loopSize  
....................         */  
....................   
....................         // 316 Hz Magnetic  
....................           
....................         while ( freqDuration == 3 )  
....................         {    
02DF:  MOVF   36,W
02E0:  SUBLW  03
02E1:  BTFSS  03.2
02E2:  GOTO   301
.................... 			// 75% duty cycle  
....................             // off  
....................             output_high(PIN_C5); //portC = PORTC_316HZ_FREQ;  
02E3:  BSF    07.5
....................             delay_us(193);  
02E4:  MOVLW  39
02E5:  MOVWF  20
02E6:  DECFSZ 20,F
02E7:  GOTO   2E6
....................             // wave up   
....................             output_high(PIN_C0); //portC = PORTC_316HZ_FREQ_UP;  
02E8:  BSF    07.0
....................             delay_us(1160);  
02E9:  MOVLW  01
02EA:  MOVWF  3B
02EB:  CALL   170
02EC:  MOVLW  A0
02ED:  MOVWF  3C
02EE:  CALL   222
....................             // off  
....................             output_low(PIN_C0); //portC = PORTC_316HZ_FREQ;  
02EF:  BCF    07.0
....................             delay_us(387);  
02F0:  MOVLW  73
02F1:  MOVWF  20
02F2:  DECFSZ 20,F
02F3:  GOTO   2F2
....................             // wave down   
....................             output_high(PIN_C1); //portC = PORTC_316HZ_FREQ_DN;  
02F4:  BSF    07.1
....................             delay_us(1160);   
02F5:  MOVLW  01
02F6:  MOVWF  3B
02F7:  CALL   170
02F8:  MOVLW  A0
02F9:  MOVWF  3C
02FA:  CALL   222
....................             // off  
....................             output_low(PIN_C1); //portC = PORTC_316HZ_FREQ;  
02FB:  BCF    07.1
....................             delay_us(189);  
02FC:  MOVLW  38
02FD:  MOVWF  20
02FE:  DECFSZ 20,F
02FF:  GOTO   2FE
....................         }  
0300:  GOTO   2DF
....................           
....................         /*  
....................         // 100% Duty cycle  
....................         for (loopCount = 0; loopCount < 79; ++loopCount)  
....................         {  
....................             // wave up   
....................             portC = PORTC_316HZ_FREQ_UP;  
....................             delay_us(1580);  
....................             // wave down   
....................             portC = PORTC_316HZ_FREQ_DN;  
....................             delay_us(1575); // (5 us delay)   
....................         }  
....................         // 75% Duty cycle  
....................         for (loopCount = 0; loopCount < 79; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(197);  
....................             // wave up   
....................             portC = PORTC_316HZ_FREQ_UP;  
....................             delay_us(1185);  
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(394);  
....................             // wave down   
....................             portC = PORTC_316HZ_FREQ_DN;  
....................             delay_us(1185); // (5 us delay)   
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(193);  
....................         }  
....................         // 50% Duty cycle  
....................         for (loopCount = 0; loopCount < 79; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(394);  
....................             // wave up   
....................             portC = PORTC_316HZ_FREQ_UP;  
....................             delay_us(790);  
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(790);  
....................             // wave down   
....................             portC = PORTC_316HZ_FREQ_DN;  
....................             delay_us(790); // (5 us delay)   
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(390);  
....................         }  
....................         // 25% Duty cycle  
....................         for (loopCount = 0; loopCount < 79; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(592);  
....................             // wave up   
....................             portC = PORTC_316HZ_FREQ_UP;  
....................             delay_us(394);  
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(1185);  
....................             // wave down   
....................             portC = PORTC_316HZ_FREQ_DN;  
....................             delay_us(394); // (5 us delay)   
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(588);  
....................         }  
....................         // 10% Duty cycle  
....................         for (loopCount = 0; loopCount < 79; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(711);  
....................             // wave up   
....................             portC = PORTC_316HZ_FREQ_UP;  
....................             delay_us(157);  
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(1422);  
....................             // wave down   
....................             portC = PORTC_316HZ_FREQ_DN;  
....................             delay_us(157); // (5 us delay)   
....................             // off  
....................             portC = PORTC_316HZ_FREQ;  
....................             delay_us(707);  
....................         }  
....................         */  
....................         /*  
....................         for (loopSize = 1; loopSize <= 141; ++loopSize)   
....................         {  
....................             for (loopCount = 0; loopCount < loopSize; ++loopCount)  
....................             {  
....................                 // wave up   
....................                 portC = PORTC_316HZ_FREQ_UP;  
....................                 delay_us(23);  
....................             } // for (loopCount  
....................             for (loopCount = 0; loopCount < loopSize; ++loopCount)  
....................             {  
....................                 // wave down   
....................                 portC = PORTC_316HZ_FREQ_DN;  
....................                 delay_us(23);   
....................             } // for (loopCount  
....................         } // for (loopSize  
....................         */  
....................   
....................         // 100 Hz Magnetic  
....................           
....................         while ( freqDuration == 4 )  
....................         {  
0301:  MOVF   36,W
0302:  SUBLW  04
0303:  BTFSS  03.2
0304:  GOTO   330
....................               
....................             // 75% duty cycle  
....................             // off  
....................             output_high(PIN_C4); //portC = PORTC_100HZ_FREQ;  
0305:  BSF    07.4
....................             delay_us(607);  
0306:  MOVLW  B4
0307:  MOVWF  20
0308:  DECFSZ 20,F
0309:  GOTO   308
030A:  NOP
030B:  NOP
....................             // wave up   
....................             output_high(PIN_C0); //portC = PORTC_100HZ_FREQ_UP;  
030C:  BSF    07.0
....................             delay_us(3641);  
030D:  MOVLW  03
030E:  MOVWF  3B
030F:  CALL   170
0310:  MOVLW  04
0311:  MOVWF  3B
0312:  MOVLW  9D
0313:  MOVWF  3C
0314:  CALL   222
0315:  DECFSZ 3B,F
0316:  GOTO   312
....................             // off  
....................             output_low(PIN_C0); //portC = PORTC_100HZ_FREQ;  
0317:  BCF    07.0
....................             delay_us(1214);  
0318:  MOVLW  01
0319:  MOVWF  3B
031A:  CALL   170
031B:  MOVLW  D6
031C:  MOVWF  3C
031D:  CALL   222
....................             // wave down   
....................             output_high(PIN_C1); //portC = PORTC_100HZ_FREQ_DN;  
031E:  BSF    07.1
....................             delay_us(3641);   
031F:  MOVLW  03
0320:  MOVWF  3B
0321:  CALL   170
0322:  MOVLW  04
0323:  MOVWF  3B
0324:  MOVLW  9D
0325:  MOVWF  3C
0326:  CALL   222
0327:  DECFSZ 3B,F
0328:  GOTO   324
....................             // off  
....................             output_low(PIN_C1); //portC = PORTC_100HZ_FREQ;  
0329:  BCF    07.1
....................             delay_us(603);  
032A:  MOVLW  B3
032B:  MOVWF  20
032C:  DECFSZ 20,F
032D:  GOTO   32C
032E:  NOP
....................         }  
032F:  GOTO   301
....................           
....................         /*  
....................         // 100% Duty cycle  
....................         for (loopCount = 0; loopCount < 25; ++loopCount)  
....................         {  
....................             // wave up   
....................             portC = PORTC_100HZ_FREQ_UP;  
....................             delay_us(4999);  
....................             // wave down   
....................             portC = PORTC_100HZ_FREQ_DN;  
....................             delay_us(4995); // (5 us delay)   
....................         }  
....................         // 75% Duty cycle  
....................         for (loopCount = 0; loopCount < 25; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_100HZ_FREQ;  
....................             delay_us(624);  
....................             // wave up   
....................             portC = PORTC_100HZ_FREQ_UP;  
....................             delay_us(3749);  
....................             // off  
....................             portC = PORTC_100HZ_FREQ;  
....................             delay_us(1249);  
....................             // wave down   
....................             portC = PORTC_100HZ_FREQ_DN;  
....................             delay_us(3749); // (5 us delay)   
....................             // off  
....................             portC = PORTC_100HZ_FREQ;  
....................             delay_us(620);  
....................         }  
....................         // 50% Duty cycle  
....................         for (loopCount = 0; loopCount < 25; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_100HZ_FREQ;  
....................             delay_us(1249);  
....................             // wave up   
....................             portC = PORTC_100HZ_FREQ_UP;  
....................             delay_us(2499);  
....................             // off  
....................             portC = PORTC_100HZ_FREQ;  
....................             delay_us(2499);  
....................             // wave down   
....................             portC = PORTC_100HZ_FREQ_DN;  
....................             delay_us(2499); // (5 us delay)   
....................             // off  
....................             portC = PORTC_100HZ_FREQ;  
....................             delay_us(1245);  
....................         }  
....................         // 25% Duty cycle  
....................         for (loopCount = 0; loopCount < 25; ++loopCount)  
....................         {  
....................             // off  
....................             portC = PORTC_100HZ_FREQ;  
....................             delay_us(1874);  
....................             // wave up   
....................             portC = PORTC_100HZ_FREQ_UP;  
....................             delay_us(1249);  
....................             // off  
....................             portC = PORTC_100HZ_FREQ;  
....................             delay_us(3749);  
....................             // wave down   
....................             portC = PORTC_100HZ_FREQ_DN;  
....................             delay_us(1249);   
....................             // off  
....................             portC = PORTC_100HZ_FREQ;  
....................             delay_us(1870);  
....................         }  
....................         */  
....................         /*  
....................         for (loopSize = 1; loopSize <= 160; ++loopSize)   
....................         {  
....................             for (loopCount = 0; loopCount < loopSize; ++loopCount)  
....................             {  
....................                 // wave up   
....................                 portC = PORTC_100HZ_FREQ_UP;  
....................                 delay_us(23);  
....................             } // for (loopCount  
....................             for (loopCount = 0; loopCount < loopSize; ++loopCount)  
....................             {  
....................                 // wave down   
....................                 portC = PORTC_100HZ_FREQ_DN;  
....................                 delay_us(23);   
....................             } // for (loopCount  
....................         } // for (loopSize  
....................         */  
....................   
....................         // wait for big caps to drain  
....................         //portC = PORTC_DRAIN_CAPS;  
....................         output_low(PIN_B1); //portB = PORTB_LED_OFF;  
0330:  BSF    03.5
0331:  BCF    06.1
0332:  BCF    03.5
0333:  BCF    06.1
....................         delay_ms(50);  
0334:  MOVLW  32
0335:  MOVWF  3B
0336:  CALL   170
....................   
....................         // clear all the pins  
....................         output_low(PIN_C5);   
0337:  BCF    07.5
.................... 		delay_ms(25);  
0338:  MOVLW  19
0339:  MOVWF  3B
033A:  CALL   170
....................         output_low(PIN_C4); //portC = PORTC_CLEAR_ALL;  
033B:  BCF    07.4
....................   
....................         // wait for things to settle down   
....................         delay_ms(25);  
033C:  MOVLW  19
033D:  MOVWF  3B
033E:  CALL   170
....................   
....................         // process any queued cmds   
....................         while ( freqDuration == 5 )  
....................         	processCmds();  
033F:  MOVF   36,W
0340:  SUBLW  05
0341:  BTFSS  03.2
0342:  GOTO   345
0343:  CALL   1B1
0344:  GOTO   33F
....................         while ( freqDuration == 6 )  
....................             processCmds();  
0345:  MOVF   36,W
0346:  SUBLW  06
0347:  BTFSS  03.2
0348:  GOTO   34B
0349:  CALL   1B1
034A:  GOTO   345
....................         if(!freqEnabled)  
034B:  MOVF   37,F
034C:  BTFSC  03.2
....................             continue;  
034D:  GOTO   3C8
....................   
.................... 		// Current source output  
....................         printf("Curent Source signal...\r\n");  
034E:  CLRF   3B
034F:  MOVF   3B,W
0350:  CALL   0E0
0351:  INCF   3B,F
0352:  MOVWF  20
0353:  MOVF   20,W
0354:  BTFSS  0C.4
0355:  GOTO   354
0356:  MOVWF  19
0357:  MOVLW  14
0358:  SUBWF  3B,W
0359:  BTFSS  03.2
035A:  GOTO   34F
035B:  MOVLW  03
035C:  MOVWF  3C
035D:  MOVLW  2E
035E:  BTFSS  0C.4
035F:  GOTO   35E
0360:  MOVWF  19
0361:  DECFSZ 3C,F
0362:  GOTO   35D
0363:  MOVLW  0D
0364:  BTFSS  0C.4
0365:  GOTO   364
0366:  MOVWF  19
0367:  MOVLW  0A
0368:  BTFSS  0C.4
0369:  GOTO   368
036A:  MOVWF  19
....................         output_high(PIN_B1); //portB = PORTB_LED_ON;  
036B:  BSF    03.5
036C:  BCF    06.1
036D:  BCF    03.5
036E:  BSF    06.1
....................         delay_ms(25);  
036F:  MOVLW  19
0370:  MOVWF  3B
0371:  CALL   170
....................         output_high(PIN_C2);  
0372:  BSF    07.2
....................         // 1000 Hz Current  
....................         while ( freqDuration == 7 )  
....................         {  
0373:  MOVF   36,W
0374:  SUBLW  07
0375:  BTFSS  03.2
0376:  GOTO   386
....................             // wave up  
....................             output_high(PIN_C3); //portC = PORTC_CURRENT_ON;  
0377:  BSF    07.3
....................             delay_us(490);  
0378:  MOVLW  91
0379:  MOVWF  20
037A:  DECFSZ 20,F
037B:  GOTO   37A
037C:  NOP
037D:  NOP
....................             // wave down   
....................             output_low(PIN_C3); //portC = PORTC_CURRENT_OFF;  
037E:  BCF    07.3
....................             delay_us(480);  
037F:  MOVLW  8E
0380:  MOVWF  20
0381:  DECFSZ 20,F
0382:  GOTO   381
0383:  NOP
0384:  NOP
....................         }  
0385:  GOTO   373
....................   
....................         // 316 Hz Current  
....................         while ( freqDuration == 8 )  
....................         {  
0386:  MOVF   36,W
0387:  SUBLW  08
0388:  BTFSS  03.2
0389:  GOTO   3A1
....................             // wave up   
....................             output_high(PIN_C3); //portC = PORTC_CURRENT_ON;  
038A:  BSF    07.3
....................             delay_us(1540);  
038B:  MOVLW  01
038C:  MOVWF  3B
038D:  CALL   170
038E:  MOVLW  03
038F:  MOVWF  3B
0390:  MOVLW  B1
0391:  MOVWF  3C
0392:  CALL   222
0393:  DECFSZ 3B,F
0394:  GOTO   390
....................             // wave down   
....................             output_low(PIN_C3); //portC = PORTC_CURRENT_OFF;  
0395:  BCF    07.3
....................             delay_us(1530);   
0396:  MOVLW  01
0397:  MOVWF  3B
0398:  CALL   170
0399:  MOVLW  05
039A:  MOVWF  3B
039B:  MOVLW  67
039C:  MOVWF  3C
039D:  CALL   222
039E:  DECFSZ 3B,F
039F:  GOTO   39B
....................         }  
03A0:  GOTO   386
....................   
....................         // 100 Hz Current  
....................         while ( freqDuration == 9 )  
....................         {  
03A1:  MOVF   36,W
03A2:  SUBLW  09
03A3:  BTFSS  03.2
03A4:  GOTO   3BC
....................             // wave up   
....................             output_high(PIN_C3); //portC = PORTC_CURRENT_ON;  
03A5:  BSF    07.3
....................             delay_us(4990);  
03A6:  MOVLW  04
03A7:  MOVWF  3B
03A8:  CALL   170
03A9:  MOVLW  05
03AA:  MOVWF  3B
03AB:  MOVLW  C3
03AC:  MOVWF  3C
03AD:  CALL   222
03AE:  DECFSZ 3B,F
03AF:  GOTO   3AB
....................             // wave down   
....................             output_low(PIN_C3); //portC = PORTC_CURRENT_OFF;  
03B0:  BCF    07.3
....................             delay_us(4980);  
03B1:  MOVLW  04
03B2:  MOVWF  3B
03B3:  CALL   170
03B4:  MOVLW  04
03B5:  MOVWF  3B
03B6:  MOVLW  F2
03B7:  MOVWF  3C
03B8:  CALL   222
03B9:  DECFSZ 3B,F
03BA:  GOTO   3B6
....................         }  
03BB:  GOTO   3A1
....................   
....................         // clear all the pins   
....................         output_low(PIN_C2); //portC = PORTC_CLEAR_ALL;  
03BC:  BCF    07.2
....................         delay_ms(25);  
03BD:  MOVLW  19
03BE:  MOVWF  3B
03BF:  CALL   170
....................         output_low(PIN_B1); //portB = PORTB_LED_OFF;  
03C0:  BSF    03.5
03C1:  BCF    06.1
03C2:  BCF    03.5
03C3:  BCF    06.1
....................   
....................         // wait for things to settle down   
....................         delay_ms(25);  
03C4:  MOVLW  19
03C5:  MOVWF  3B
03C6:  CALL   170
....................   
....................         // do it again !   
....................         freqDuration = 0;  
03C7:  CLRF   36
....................     }  
03C8:  GOTO   291
.................... }  
....................  
03C9:  SLEEP

Configuration Fuses:
   Word  1: 3F31   XT NOWDT PUT NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG
