CCS PCM C Compiler, Version 4.106, 47914               04-II-14 11:45

               Filename: Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC16F887\main.lst

               ROM used: 984 words (12%)
                         Largest free fragment is 2048
               RAM used: 43 (12%) at main() level
                         96 (26%) worst case
               Stack:    3 worst case (1 in main + 2 for interrupts)

*
0000:  MOVLW  03
0001:  MOVWF  0A
0002:  GOTO   332
0003:  NOP
0004:  MOVWF  7F
0005:  SWAPF  03,W
0006:  CLRF   03
0007:  MOVWF  21
0008:  MOVF   0A,W
0009:  MOVWF  20
000A:  CLRF   0A
000B:  MOVF   04,W
000C:  MOVWF  22
000D:  MOVF   77,W
000E:  MOVWF  23
000F:  MOVF   78,W
0010:  MOVWF  24
0011:  MOVF   79,W
0012:  MOVWF  25
0013:  MOVF   7A,W
0014:  MOVWF  26
0015:  BCF    03.7
0016:  BCF    03.5
0017:  BTFSS  0B.4
0018:  GOTO   01B
0019:  BTFSC  0B.1
001A:  GOTO   038
001B:  MOVLW  8C
001C:  MOVWF  04
001D:  BTFSS  00.0
001E:  GOTO   021
001F:  BTFSC  0C.0
0020:  GOTO   03B
0021:  MOVLW  8C
0022:  MOVWF  04
0023:  BTFSS  00.3
0024:  GOTO   027
0025:  BTFSC  0C.3
0026:  GOTO   03E
0027:  MOVF   22,W
0028:  MOVWF  04
0029:  MOVF   23,W
002A:  MOVWF  77
002B:  MOVF   24,W
002C:  MOVWF  78
002D:  MOVF   25,W
002E:  MOVWF  79
002F:  MOVF   26,W
0030:  MOVWF  7A
0031:  MOVF   20,W
0032:  MOVWF  0A
0033:  SWAPF  21,W
0034:  MOVWF  03
0035:  SWAPF  7F,F
0036:  SWAPF  7F,W
0037:  RETFIE
0038:  BCF    0A.3
0039:  BCF    0A.4
003A:  GOTO   145
003B:  BCF    0A.3
003C:  BCF    0A.4
003D:  GOTO   2C6
003E:  BCF    0A.3
003F:  BCF    0A.4
0040:  GOTO   06D
.................... #include "main.h" 
.................... #include <16F887.h> 
.................... //////// Standard Header file for the PIC16F887 device //////////////// 
.................... #device PIC16F887 
.................... #list 
....................  
.................... #device adc=8 
....................  
.................... #FUSES NOWDT                    //No Watch Dog Timer 
.................... #FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD) 
.................... #FUSES NOPUT                    //No Power Up Timer 
.................... #FUSES MCLR                     //Master Clear pin enabled 
.................... #FUSES NOPROTECT                //Code not protected from reading 
.................... #FUSES NOCPD                    //No EE protection 
.................... #FUSES NOBROWNOUT               //No brownout reset 
.................... #FUSES IESO                     //Internal External Switch Over mode enabled 
.................... #FUSES FCMEN                    //Fail-safe clock monitor enabled 
.................... #FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O 
.................... #FUSES NODEBUG                  //No Debug mode for ICD 
.................... #FUSES NOWRT                    //Program memory not write protected 
.................... #FUSES BORV40                   //Brownout reset at 4.0V 
....................  
.................... #use delay(clock=20000000) 
*
02D2:  MOVLW  47
02D3:  MOVWF  04
02D4:  BCF    03.7
02D5:  MOVF   00,W
02D6:  BTFSC  03.2
02D7:  GOTO   2E5
02D8:  MOVLW  06
02D9:  MOVWF  78
02DA:  CLRF   77
02DB:  DECFSZ 77,F
02DC:  GOTO   2DB
02DD:  DECFSZ 78,F
02DE:  GOTO   2DA
02DF:  MOVLW  7B
02E0:  MOVWF  77
02E1:  DECFSZ 77,F
02E2:  GOTO   2E1
02E3:  DECFSZ 00,F
02E4:  GOTO   2D8
02E5:  BCF    0A.3
02E6:  BCF    0A.4
02E7:  GOTO   3B7 (RETURN)
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,errors) 
....................  
.................... //NOTE: Must declare MASTER before SLAVE, i2c_isr_state() returns 0  
.................... //      when MASTER is the most recent #use i2c  
.................... //#use i2c(MASTER, sda=PIN_C1, scl=PIN_C0, stream=I2CM)  
.................... #use i2c(SLAVE, Fast, sda=PIN_C4, scl=PIN_C3, force_hw, address=0xA0)  
*
00AC:  MOVF   4C,W
00AD:  MOVWF  13
00AE:  BSF    14.4
00AF:  BCF    0C.3
00B0:  BSF    03.5
00B1:  BTFSC  14.0
00B2:  GOTO   0B1
00B3:  CLRF   78
00B4:  BCF    03.5
00B5:  BTFSC  14.4
00B6:  INCF   78,F
....................  
....................  
....................  
.................... #include <string.h> 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... ////        (C) Copyright 1996,2008 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(unsigned int8 *)==1 
.................... #define ptrdiff_t unsigned int8 
.................... #else 
.................... #define ptrdiff_t unsigned int16 
.................... #endif 
....................  
.................... #define size_t unsigned int8 
.................... #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; 
....................   } 
....................  
.................... /* Standard template: char *strcpy(char *s1, const char *s2) 
....................    copies the string s2 including the null character to s1. 
....................    This is a compiler built in to handle the different address 
....................    spaces */ 
....................  
.................... #define strcopy strcpy 
....................  
.................... /* 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--) 
*
0101:  MOVF   63,W
0102:  MOVWF  68
0103:  MOVF   62,W
0104:  MOVWF  67
0105:  MOVF   66,F
0106:  BTFSC  03.2
0107:  GOTO   130
0108:  MOVF   65,W
0109:  MOVWF  7A
010A:  MOVF   64,W
010B:  MOVWF  04
010C:  BCF    03.7
010D:  BTFSC  7A.0
010E:  BSF    03.7
010F:  MOVF   00,F
0110:  BTFSC  03.2
0111:  GOTO   130
....................      *s++ = *s2++; 
0112:  MOVF   68,W
0113:  MOVWF  7A
0114:  MOVF   67,W
0115:  INCF   67,F
0116:  BTFSC  03.2
0117:  INCF   68,F
0118:  MOVWF  69
0119:  MOVF   7A,W
011A:  MOVWF  6A
011B:  MOVF   65,W
011C:  MOVWF  7A
011D:  MOVF   64,W
011E:  INCF   64,F
011F:  BTFSC  03.2
0120:  INCF   65,F
0121:  MOVWF  04
0122:  BCF    03.7
0123:  BTFSC  7A.0
0124:  BSF    03.7
0125:  MOVF   00,W
0126:  MOVWF  6B
0127:  MOVF   69,W
0128:  MOVWF  04
0129:  BCF    03.7
012A:  BTFSC  6A.0
012B:  BSF    03.7
012C:  MOVF   6B,W
012D:  MOVWF  00
012E:  DECF   66,F
012F:  GOTO   105
....................   for (; n > 0; n--) 
0130:  MOVF   66,F
0131:  BTFSC  03.2
0132:  GOTO   140
....................      *s++ = '\0'; 
0133:  MOVF   68,W
0134:  MOVWF  7A
0135:  MOVF   67,W
0136:  INCF   67,F
0137:  BTFSC  03.2
0138:  INCF   68,F
0139:  MOVWF  04
013A:  BCF    03.7
013B:  BTFSC  7A.0
013C:  BSF    03.7
013D:  CLRF   00
013E:  DECF   66,F
013F:  GOTO   130
....................  
....................   return(s1); 
0140:  MOVF   62,W
0141:  MOVWF  78
0142:  MOVF   63,W
0143:  MOVWF  79
.................... } 
0144:  RETURN
.................... /***********************************************************/ 
....................  
.................... /*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 int8 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 int8 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 int8 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 int8 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; 
....................   unsigned int8 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,unsigned int8 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, unsigned int8 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*/ 
....................  
.................... unsigned int8  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, unsigned int8 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 */ 
....................  
.................... unsigned int8  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; 
*
0366:  CLRF   29
0367:  CLRF   2A
....................  
....................    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(unsigned int8 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) */ 
....................  
.................... unsigned int8 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 int8 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 
....................  
....................  
.................... #define LED PIN_E1   
.................... #define CE  PIN_E2 
....................  
.................... #define SEL0   PIN_E0   // external counter division ratio 
.................... #define SEL1   PIN_E1   // external counter division ratio 
.................... #define MR     PIN_E2   // external counter master reset 
.................... #define CLKI   PIN_C0   // internal counter input 
.................... #define BEEP   PIN_C3   // buzzer 
....................  
.................... unsigned int32 count; 
....................  
....................  
.................... int8 buffer[0x10];   // I2C buffer      
.................... int8 address; 
....................  
.................... unsigned int16 of=0; // count of overflow 
....................  
.................... const char cmd[40]={0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x80, 0x84, 0x1E, 0x00, 0xE0, 0xC8, 0x10, 0x00, 0x40, 0x42, 0x0F, 0x00, 0xA0, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0x00, 0x00, 0x00, 0x12, 0x03}; 
....................  
.................... #INT_SSP 
.................... void ssp_interupt () 
.................... { 
....................    BYTE incoming, state; 
....................  
....................    state = i2c_isr_state(); 
*
006D:  BSF    03.5
006E:  BTFSC  14.5
006F:  GOTO   078
0070:  BCF    03.5
0071:  CLRF   42
0072:  BSF    03.5
0073:  BTFSS  14.2
0074:  GOTO   078
0075:  BCF    03.5
0076:  BSF    42.7
0077:  BSF    03.5
0078:  BCF    03.5
0079:  MOVF   42,W
007A:  INCF   42,F
007B:  MOVWF  4A
....................     
....................    if(state < 0x80)                     //Master is sending data 
007C:  MOVF   4A,W
007D:  SUBLW  7F
007E:  BTFSS  03.0
007F:  GOTO   0A0
....................    { 
....................       incoming = i2c_read(); 
0080:  BCF    14.6
0081:  BTFSS  0C.3
0082:  GOTO   081
0083:  MOVF   13,W
0084:  BSF    14.4
0085:  MOVWF  49
....................       if(state == 1)                     //First received byte is address 
0086:  DECFSZ 4A,W
0087:  GOTO   096
....................       { 
....................          address = incoming; 
0088:  MOVF   49,W
0089:  MOVWF  3F
....................          if (incoming == 2) 
008A:  MOVF   49,W
008B:  SUBLW  02
008C:  BTFSS  03.2
008D:  GOTO   096
....................          { 
....................             buffer[0]=make8(count,0); 
008E:  MOVF   2B,W
008F:  MOVWF  2F
....................             buffer[1]=make8(count,1); 
0090:  MOVF   2C,W
0091:  MOVWF  30
....................             buffer[2]=make8(count,2); 
0092:  MOVF   2D,W
0093:  MOVWF  31
....................             buffer[3]=make8(count,3); 
0094:  MOVF   2E,W
0095:  MOVWF  32
....................          } 
....................       } 
....................       if(state == 2)                     //Second received byte is data 
0096:  MOVF   4A,W
0097:  SUBLW  02
0098:  BTFSS  03.2
0099:  GOTO   0A0
....................          buffer[address] = incoming; 
009A:  MOVLW  2F
009B:  ADDWF  3F,W
009C:  MOVWF  04
009D:  BCF    03.7
009E:  MOVF   49,W
009F:  MOVWF  00
....................           
....................        
....................    } 
....................    if(state == 0x80)                     //Master is requesting data 
00A0:  MOVF   4A,W
00A1:  SUBLW  80
00A2:  BTFSS  03.2
00A3:  GOTO   0B7
....................    { 
....................       i2c_write(buffer[address]); 
00A4:  MOVLW  2F
00A5:  ADDWF  3F,W
00A6:  MOVWF  04
00A7:  BCF    03.7
00A8:  MOVF   00,W
00A9:  MOVWF  4B
00AA:  MOVF   4B,W
00AB:  MOVWF  4C
....................    } 
.................... } 
....................  
....................  
*
00B7:  BCF    0C.3
00B8:  BCF    0A.3
00B9:  BCF    0A.4
00BA:  GOTO   027
.................... #int_EXT  // Interrupt from 1PPS 
.................... void  EXT_isr(void)  
.................... { 
....................    unsigned int16 countH; 
....................    unsigned int8  countL; 
....................    char countS[10], a[4], b[4], c[4];  // strings for printing results 
....................     
....................    countL=0; 
*
0145:  CLRF   4B
....................    countH=get_timer1();    // read internal counter 
0146:  MOVF   0F,W
0147:  MOVWF  7A
0148:  MOVF   0E,W
0149:  MOVWF  77
014A:  MOVF   0F,W
014B:  SUBWF  7A,W
014C:  BTFSS  03.2
014D:  GOTO   146
014E:  MOVF   77,W
014F:  MOVWF  49
0150:  MOVF   7A,W
0151:  MOVWF  4A
....................    output_low(SEL0); 
0152:  BSF    03.5
0153:  BCF    09.0
0154:  BCF    03.5
0155:  BCF    09.0
....................    output_low(SEL1); 
0156:  BSF    03.5
0157:  BCF    09.1
0158:  BCF    03.5
0159:  BCF    09.1
....................    countL=input(CLKI);     // read bit 0 of external counter 
015A:  BSF    28.0
015B:  MOVF   28,W
015C:  BSF    03.5
015D:  MOVWF  07
015E:  BCF    03.5
015F:  CLRF   4B
0160:  BTFSC  07.0
0161:  INCF   4B,F
....................    output_high(SEL0); 
0162:  BSF    03.5
0163:  BCF    09.0
0164:  BCF    03.5
0165:  BSF    09.0
....................    output_low(SEL1); 
0166:  BSF    03.5
0167:  BCF    09.1
0168:  BCF    03.5
0169:  BCF    09.1
....................    countL|=input(CLKI)<<1; // read bit 1 of external counter 
016A:  BSF    28.0
016B:  MOVF   28,W
016C:  BSF    03.5
016D:  MOVWF  07
016E:  MOVLW  00
016F:  BCF    03.5
0170:  BTFSC  07.0
0171:  MOVLW  01
0172:  MOVWF  77
0173:  BCF    03.0
0174:  RLF    77,F
0175:  MOVF   77,W
0176:  IORWF  4B,F
....................    output_low(SEL0); 
0177:  BSF    03.5
0178:  BCF    09.0
0179:  BCF    03.5
017A:  BCF    09.0
....................    output_high(SEL1); 
017B:  BSF    03.5
017C:  BCF    09.1
017D:  BCF    03.5
017E:  BSF    09.1
....................    countL|=input(CLKI)<<2; // read bit 2 of external counter 
017F:  BSF    28.0
0180:  MOVF   28,W
0181:  BSF    03.5
0182:  MOVWF  07
0183:  MOVLW  00
0184:  BCF    03.5
0185:  BTFSC  07.0
0186:  MOVLW  01
0187:  MOVWF  77
0188:  RLF    77,F
0189:  RLF    77,F
018A:  MOVLW  FC
018B:  ANDWF  77,F
018C:  MOVF   77,W
018D:  IORWF  4B,F
....................    output_high(SEL0); 
018E:  BSF    03.5
018F:  BCF    09.0
0190:  BCF    03.5
0191:  BSF    09.0
....................    output_high(SEL1); 
0192:  BSF    03.5
0193:  BCF    09.1
0194:  BCF    03.5
0195:  BSF    09.1
....................    countL|=input(CLKI)<<3; // read bit 3 of external counter 
0196:  BSF    28.0
0197:  MOVF   28,W
0198:  BSF    03.5
0199:  MOVWF  07
019A:  MOVLW  00
019B:  BCF    03.5
019C:  BTFSC  07.0
019D:  MOVLW  01
019E:  MOVWF  77
019F:  RLF    77,F
01A0:  RLF    77,F
01A1:  RLF    77,F
01A2:  MOVLW  F8
01A3:  ANDWF  77,F
01A4:  MOVF   77,W
01A5:  IORWF  4B,F
....................  
....................    output_low(MR);   // External counter Master Reset 
01A6:  BSF    03.5
01A7:  BCF    09.2
01A8:  BCF    03.5
01A9:  BCF    09.2
....................    output_high(MR); 
01AA:  BSF    03.5
01AB:  BCF    09.2
01AC:  BCF    03.5
01AD:  BSF    09.2
....................     
....................    set_timer1(0);    // Internal counter reset 
01AE:  CLRF   0F
01AF:  CLRF   0E
....................     
....................    count=((unsigned int32)of<<20)+((unsigned int32)countH<<4)+(unsigned int32)countL; // concatenate  
01B0:  CLRF   65
01B1:  CLRF   64
01B2:  MOVF   41,W
01B3:  MOVWF  63
01B4:  MOVF   40,W
01B5:  MOVWF  62
01B6:  MOVF   41,W
01B7:  MOVWF  65
01B8:  MOVF   40,W
01B9:  MOVWF  64
01BA:  CLRF   62
01BB:  CLRF   63
01BC:  RLF    64,F
01BD:  RLF    65,F
01BE:  RLF    64,F
01BF:  RLF    65,F
01C0:  RLF    64,F
01C1:  RLF    65,F
01C2:  RLF    64,F
01C3:  RLF    65,F
01C4:  MOVLW  F0
01C5:  ANDWF  64,F
01C6:  CLRF   6A
01C7:  CLRF   69
01C8:  RLF    49,W
01C9:  MOVWF  77
01CA:  RLF    4A,W
01CB:  MOVWF  78
01CC:  RLF    69,W
01CD:  MOVWF  79
01CE:  RLF    6A,W
01CF:  MOVWF  7A
01D0:  RLF    77,F
01D1:  RLF    78,F
01D2:  RLF    79,F
01D3:  RLF    7A,F
01D4:  RLF    77,F
01D5:  RLF    78,F
01D6:  RLF    79,F
01D7:  RLF    7A,F
01D8:  RLF    77,F
01D9:  RLF    78,F
01DA:  RLF    79,F
01DB:  RLF    7A,F
01DC:  MOVLW  F0
01DD:  ANDWF  77,F
01DE:  MOVF   77,W
01DF:  ADDWF  62,F
01E0:  MOVF   78,W
01E1:  BTFSC  03.0
01E2:  INCFSZ 78,W
01E3:  ADDWF  63,F
01E4:  MOVF   79,W
01E5:  BTFSC  03.0
01E6:  INCFSZ 79,W
01E7:  ADDWF  64,F
01E8:  MOVF   7A,W
01E9:  BTFSC  03.0
01EA:  INCFSZ 7A,W
01EB:  ADDWF  65,F
01EC:  CLRF   78
01ED:  CLRF   79
01EE:  CLRF   7A
01EF:  MOVF   4B,W
01F0:  ADDWF  62,W
01F1:  MOVWF  2B
01F2:  MOVF   63,W
01F3:  MOVWF  2C
01F4:  MOVF   78,W
01F5:  BTFSC  03.0
01F6:  INCFSZ 78,W
01F7:  ADDWF  2C,F
01F8:  MOVF   64,W
01F9:  MOVWF  2D
01FA:  MOVF   79,W
01FB:  BTFSC  03.0
01FC:  INCFSZ 79,W
01FD:  ADDWF  2D,F
01FE:  MOVF   65,W
01FF:  MOVWF  2E
0200:  MOVF   7A,W
0201:  BTFSC  03.0
0202:  INCFSZ 7A,W
0203:  ADDWF  2E,F
....................  
....................    sprintf(countS,"%09Lu", count);  // engeneering values conversion 
0204:  CLRF   44
0205:  MOVLW  4C
0206:  MOVWF  43
0207:  MOVLW  49
0208:  MOVWF  04
0209:  MOVF   2E,W
020A:  MOVWF  65
020B:  MOVF   2D,W
020C:  MOVWF  64
020D:  MOVF   2C,W
020E:  MOVWF  63
020F:  MOVF   2B,W
0210:  MOVWF  62
....................    strncpy(a, countS, 3); a[3]='\0'; 
*
027A:  CLRF   63
027B:  MOVLW  56
027C:  MOVWF  62
027D:  CLRF   65
027E:  MOVLW  4C
027F:  MOVWF  64
0280:  MOVLW  03
0281:  MOVWF  66
0282:  CALL   101
0283:  CLRF   59
....................    strncpy(b, &countS[3], 3); b[3]='\0'; 
0284:  CLRF   63
0285:  MOVLW  5A
0286:  MOVWF  62
0287:  CLRF   65
0288:  MOVLW  4F
0289:  MOVWF  64
028A:  MOVLW  03
028B:  MOVWF  66
028C:  CALL   101
028D:  CLRF   5D
....................    strncpy(c, &countS[6], 3); c[3]='\0'; 
028E:  CLRF   63
028F:  MOVLW  5E
0290:  MOVWF  62
0291:  CLRF   65
0292:  MOVLW  52
0293:  MOVWF  64
0294:  MOVLW  03
0295:  MOVWF  66
0296:  CALL   101
0297:  CLRF   61
....................     
....................    printf("%s\r\n", countS);                    // output to RS232 
0298:  MOVLW  4C
0299:  MOVWF  04
029A:  BCF    03.7
*
02B1:  MOVLW  0D
02B2:  BTFSS  0C.4
02B3:  GOTO   2B2
02B4:  MOVWF  19
02B5:  MOVLW  0A
02B6:  BTFSS  0C.4
02B7:  GOTO   2B6
02B8:  MOVWF  19
....................  
....................    output_toggle(BEEP); // cvak... 
02B9:  BCF    28.3
02BA:  MOVF   28,W
02BB:  BSF    03.5
02BC:  MOVWF  07
02BD:  MOVLW  08
02BE:  BCF    03.5
02BF:  XORWF  07,F
....................  
....................    of=0; // reset overflow counter 
02C0:  CLRF   41
02C1:  CLRF   40
.................... } 
....................  
02C2:  BCF    0B.1
02C3:  BCF    0A.3
02C4:  BCF    0A.4
02C5:  GOTO   027
.................... #int_TIMER1  // Interrupf from overflow 
.................... void  TIMER1_isr(void)  
.................... { 
....................    of++; 
02C6:  INCF   40,F
02C7:  BTFSC  03.2
02C8:  INCF   41,F
.................... } 
....................  
....................  
.................... /*#int_TIMER2 // every 10 ms 
.................... void  TIMER2_isr(void)  
.................... { 
....................    output_low(CE); 
....................    count=get_timer1(); 
....................    set_timer1(0); 
....................    output_high(CE); 
.................... }*/ 
....................  
....................   
02C9:  BCF    0C.0
02CA:  BCF    0A.3
02CB:  BCF    0A.4
02CC:  GOTO   027
.................... void main() 
.................... { 
*
0332:  CLRF   04
0333:  BCF    03.7
0334:  MOVLW  1F
0335:  ANDWF  03,F
0336:  BSF    03.5
0337:  BSF    03.6
0338:  BSF    07.3
0339:  MOVLW  08
033A:  BCF    03.6
033B:  MOVWF  19
033C:  MOVLW  02
033D:  MOVWF  1A
033E:  MOVLW  A6
033F:  MOVWF  18
0340:  MOVLW  90
0341:  BCF    03.5
0342:  MOVWF  18
0343:  BSF    28.3
0344:  MOVF   28,W
0345:  BSF    03.5
0346:  MOVWF  07
0347:  BCF    03.5
0348:  BSF    28.4
0349:  MOVF   28,W
034A:  BSF    03.5
034B:  MOVWF  07
034C:  MOVLW  A0
034D:  MOVWF  13
034E:  MOVLW  36
034F:  BCF    03.5
0350:  MOVWF  14
0351:  CLRF   41
0352:  CLRF   40
0353:  BSF    03.5
0354:  BSF    03.6
0355:  MOVF   09,W
0356:  ANDLW  C0
0357:  MOVWF  09
0358:  BCF    03.6
0359:  BCF    1F.4
035A:  BCF    1F.5
035B:  MOVLW  00
035C:  BSF    03.6
035D:  MOVWF  08
035E:  BCF    03.5
035F:  CLRF   07
0360:  CLRF   08
0361:  CLRF   09
....................    setup_adc_ports(NO_ANALOGS|VSS_VDD); 
*
036C:  BSF    03.5
036D:  BSF    03.6
036E:  MOVF   09,W
036F:  ANDLW  C0
0370:  MOVWF  09
0371:  BCF    03.6
0372:  BCF    1F.4
0373:  BCF    1F.5
0374:  MOVLW  00
0375:  BSF    03.6
0376:  MOVWF  08
....................    setup_adc(ADC_OFF); 
0377:  BCF    03.5
0378:  BCF    03.6
0379:  BCF    1F.0
....................    setup_spi(SPI_SS_DISABLED); 
037A:  BCF    14.5
037B:  BCF    28.5
037C:  MOVF   28,W
037D:  BSF    03.5
037E:  MOVWF  07
037F:  BCF    03.5
0380:  BSF    28.4
0381:  MOVF   28,W
0382:  BSF    03.5
0383:  MOVWF  07
0384:  BCF    03.5
0385:  BCF    28.3
0386:  MOVF   28,W
0387:  BSF    03.5
0388:  MOVWF  07
0389:  MOVLW  01
038A:  BCF    03.5
038B:  MOVWF  14
038C:  MOVLW  00
038D:  BSF    03.5
038E:  MOVWF  14
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 
038F:  MOVF   01,W
0390:  ANDLW  C7
0391:  IORLW  08
0392:  MOVWF  01
.................... //   setup_wdt(WDT_144MS); 
....................    setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1); 
0393:  MOVLW  07
0394:  BCF    03.5
0395:  MOVWF  10
....................    setup_timer_2(T2_DIV_BY_16,196,16); 
0396:  MOVLW  78
0397:  MOVWF  78
0398:  IORLW  06
0399:  MOVWF  12
039A:  MOVLW  C4
039B:  BSF    03.5
039C:  MOVWF  12
....................    setup_ccp1(CCP_OFF); 
039D:  BCF    03.5
039E:  BSF    28.2
039F:  MOVF   28,W
03A0:  BSF    03.5
03A1:  MOVWF  07
03A2:  BCF    03.5
03A3:  CLRF   17
03A4:  BSF    03.5
03A5:  CLRF   1B
03A6:  CLRF   1C
03A7:  MOVLW  01
03A8:  MOVWF  1D
....................    setup_comparator(NC_NC_NC_NC); 
03A9:  BCF    03.5
03AA:  BSF    03.6
03AB:  CLRF   07
03AC:  CLRF   08
03AD:  CLRF   09
....................    setup_vref(FALSE); 
03AE:  BSF    03.5
03AF:  BCF    03.6
03B0:  CLRF   17
....................     
....................    delay_ms(1000); 
03B1:  MOVLW  04
03B2:  BCF    03.5
03B3:  MOVWF  46
03B4:  MOVLW  FA
03B5:  MOVWF  47
03B6:  GOTO   2D2
03B7:  DECFSZ 46,F
03B8:  GOTO   3B4
....................    int n; 
....................    for (n=0;n<40;n++) putc(cmd[n]); // setup GPS 
03B9:  CLRF   45
03BA:  MOVF   45,W
03BB:  SUBLW  27
03BC:  BTFSS  03.0
03BD:  GOTO   3C5
03BE:  MOVF   45,W
03BF:  CALL   041
03C0:  BTFSS  0C.4
03C1:  GOTO   3C0
03C2:  MOVWF  19
03C3:  INCF   45,F
03C4:  GOTO   3BA
....................  
....................    printf("cvak...\r\n"); 
03C5:  MOVLW  CD
03C6:  BSF    03.6
03C7:  MOVWF  0D
03C8:  MOVLW  02
03C9:  MOVWF  0F
03CA:  BCF    03.6
03CB:  GOTO   2E8
....................     
....................    ext_int_edge( L_TO_H );       // set 1PPS active edge 
03CC:  BSF    03.5
03CD:  BSF    01.6
....................    enable_interrupts(INT_TIMER1); 
03CE:  BSF    0C.0
....................    enable_interrupts(INT_EXT); 
03CF:  BCF    03.5
03D0:  BSF    0B.4
....................    enable_interrupts(INT_SSP);  
03D1:  BSF    03.5
03D2:  BSF    0C.3
.................... //   enable_interrupts(INT_TIMER2); 
....................    enable_interrupts(GLOBAL);     
03D3:  MOVLW  C0
03D4:  BCF    03.5
03D5:  IORWF  0B,F
....................  
....................    while(true) 
....................    {       
.................... /*     output_high(LED); 
....................      delay_ms(999); 
....................      output_low(LED); 
....................      delay_ms(999); 
....................      printf("%X %X %X %X\r\n", buffer[0],buffer[1],buffer[2],buffer[3]); 
.................... */ 
....................    } 
03D6:  GOTO   3D6
.................... } 
03D7:  SLEEP

Configuration Fuses:
   Word  1: 2CF2   HS NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
   Word  2: 3FFF   NOWRT BORV40