1,17 → 1,17 |
CCS PCM C Compiler, Version 4.106, 47914 01-II-14 20:13 |
CCS PCM C Compiler, Version 4.106, 47914 04-II-14 11:45 |
|
Filename: Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC887\main.lst |
Filename: Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC16F887\main.lst |
|
ROM used: 786 words (10%) |
ROM used: 984 words (12%) |
Largest free fragment is 2048 |
RAM used: 67 (18%) at main() level |
80 (22%) worst case |
Stack: 2 worst case (1 in main + 1 for interrupts) |
RAM used: 43 (12%) at main() level |
96 (26%) worst case |
Stack: 3 worst case (1 in main + 2 for interrupts) |
|
* |
0000: MOVLW 02 |
0000: MOVLW 03 |
0001: MOVWF 0A |
0002: GOTO 21C |
0002: GOTO 332 |
0003: NOP |
0004: MOVWF 7F |
0005: SWAPF 03,W |
32,41 → 32,48 |
0014: MOVWF 26 |
0015: BCF 03.7 |
0016: BCF 03.5 |
0017: MOVLW 8C |
0018: MOVWF 04 |
0019: BTFSS 00.1 |
001A: GOTO 01D |
001B: BTFSC 0C.1 |
001C: GOTO 034 |
001D: MOVLW 8C |
001E: MOVWF 04 |
001F: BTFSS 00.3 |
0020: GOTO 023 |
0021: BTFSC 0C.3 |
0022: GOTO 037 |
0023: MOVF 22,W |
0024: MOVWF 04 |
0025: MOVF 23,W |
0026: MOVWF 77 |
0027: MOVF 24,W |
0028: MOVWF 78 |
0029: MOVF 25,W |
002A: MOVWF 79 |
002B: MOVF 26,W |
002C: MOVWF 7A |
002D: MOVF 20,W |
002E: MOVWF 0A |
002F: SWAPF 21,W |
0030: MOVWF 03 |
0031: SWAPF 7F,F |
0032: SWAPF 7F,W |
0033: RETFIE |
0034: BCF 0A.3 |
0035: BCF 0A.4 |
0036: GOTO 0B0 |
0037: BCF 0A.3 |
0038: BCF 0A.4 |
0039: GOTO 066 |
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 //////////////// |
91,44 → 98,28 |
.................... |
.................... #use delay(clock=20000000) |
* |
00DC: MOVLW 5F |
00DD: MOVWF 04 |
00DE: BCF 03.7 |
00DF: MOVF 00,W |
00E0: BTFSC 03.2 |
00E1: GOTO 0EF |
00E2: MOVLW 06 |
00E3: MOVWF 78 |
00E4: CLRF 77 |
00E5: DECFSZ 77,F |
00E6: GOTO 0E5 |
00E7: DECFSZ 78,F |
00E8: GOTO 0E4 |
00E9: MOVLW 7B |
00EA: MOVWF 77 |
00EB: DECFSZ 77,F |
00EC: GOTO 0EB |
00ED: DECFSZ 00,F |
00EE: GOTO 0E2 |
00EF: RETURN |
* |
013A: MOVLW 03 |
013B: SUBWF 5F,F |
013C: BTFSS 03.0 |
013D: GOTO 148 |
013E: MOVLW 5F |
013F: MOVWF 04 |
0140: BCF 03.7 |
0141: MOVF 00,W |
0142: BTFSC 03.2 |
0143: GOTO 148 |
0144: GOTO 146 |
0145: GOTO 146 |
0146: DECFSZ 00,F |
0147: GOTO 145 |
0148: BCF 0A.3 |
0149: BCF 0A.4 |
014A: GOTO 2C1 (RETURN) |
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 |
136,32 → 127,576 |
.................... //#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) |
* |
00A1: MOVF 6A,W |
00A2: MOVWF 13 |
00A3: BSF 14.4 |
00A4: BCF 0C.3 |
00A5: BSF 03.5 |
00A6: BTFSC 14.0 |
00A7: GOTO 0A6 |
00A8: CLRF 78 |
00A9: BCF 03.5 |
00AA: BTFSC 14.4 |
00AB: INCF 78,F |
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 |
.................... |
.................... int16 count; |
.................... #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 |
.................... |
.................... int8 rcv_buf[0x10]; // I2C receive buffer |
.................... int8 snd_buf[0x10]; // I2C send buffer |
.................... 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 |
171,417 → 706,621 |
.................... |
.................... state = i2c_isr_state(); |
* |
0066: BSF 03.5 |
0067: BTFSC 14.5 |
0068: GOTO 071 |
0069: BCF 03.5 |
006A: CLRF 5C |
006B: BSF 03.5 |
006C: BTFSS 14.2 |
006D: GOTO 071 |
006E: BCF 03.5 |
006F: BSF 5C.7 |
0070: BSF 03.5 |
0071: BCF 03.5 |
0072: MOVF 5C,W |
0073: INCF 5C,F |
0074: MOVWF 68 |
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 |
0075: MOVF 68,W |
0076: SUBLW 7F |
0077: BTFSS 03.0 |
0078: GOTO 095 |
007C: MOVF 4A,W |
007D: SUBLW 7F |
007E: BTFSS 03.0 |
007F: GOTO 0A0 |
.................... { |
.................... incoming = i2c_read(); |
0079: BCF 14.6 |
007A: BTFSS 0C.3 |
007B: GOTO 07A |
007C: MOVF 13,W |
007D: BSF 14.4 |
007E: MOVWF 67 |
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 |
007F: DECFSZ 68,W |
0080: GOTO 08B |
0086: DECFSZ 4A,W |
0087: GOTO 096 |
.................... { |
.................... address = incoming; |
0081: MOVF 67,W |
0082: MOVWF 5B |
0088: MOVF 49,W |
0089: MOVWF 3F |
.................... if (incoming == 2) |
0083: MOVF 67,W |
0084: SUBLW 02 |
0085: BTFSS 03.2 |
0086: GOTO 08B |
008A: MOVF 49,W |
008B: SUBLW 02 |
008C: BTFSS 03.2 |
008D: GOTO 096 |
.................... { |
.................... buffer[0]=make8(count,0); |
0087: MOVF 29,W |
0088: MOVWF 4B |
008E: MOVF 2B,W |
008F: MOVWF 2F |
.................... buffer[1]=make8(count,1); |
0089: MOVF 2A,W |
008A: MOVWF 4C |
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 |
008B: MOVF 68,W |
008C: SUBLW 02 |
008D: BTFSS 03.2 |
008E: GOTO 095 |
0096: MOVF 4A,W |
0097: SUBLW 02 |
0098: BTFSS 03.2 |
0099: GOTO 0A0 |
.................... buffer[address] = incoming; |
008F: MOVLW 4B |
0090: ADDWF 5B,W |
0091: MOVWF 04 |
0092: BCF 03.7 |
0093: MOVF 67,W |
0094: MOVWF 00 |
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 |
0095: MOVF 68,W |
0096: SUBLW 80 |
0097: BTFSS 03.2 |
0098: GOTO 0AC |
00A0: MOVF 4A,W |
00A1: SUBLW 80 |
00A2: BTFSS 03.2 |
00A3: GOTO 0B7 |
.................... { |
.................... i2c_write(buffer[address]); |
0099: MOVLW 4B |
009A: ADDWF 5B,W |
009B: MOVWF 04 |
009C: BCF 03.7 |
009D: MOVF 00,W |
009E: MOVWF 69 |
009F: MOVF 69,W |
00A0: MOVWF 6A |
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 |
.................... } |
.................... } |
.................... |
.................... |
* |
00AC: BCF 0C.3 |
00AD: BCF 0A.3 |
00AE: BCF 0A.4 |
00AF: GOTO 023 |
.................... #int_TIMER2 // every 10 ms |
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); |
00B0: BSF 03.5 |
00B1: BCF 09.2 |
00B2: BCF 03.5 |
00B3: BCF 09.2 |
.................... count=get_timer1(); |
00B4: MOVF 0F,W |
00B5: MOVWF 7A |
00B6: MOVF 0E,W |
00B7: MOVWF 77 |
00B8: MOVF 0F,W |
00B9: SUBWF 7A,W |
00BA: BTFSS 03.2 |
00BB: GOTO 0B4 |
00BC: MOVF 77,W |
00BD: MOVWF 29 |
00BE: MOVF 7A,W |
00BF: MOVWF 2A |
.................... set_timer1(0); |
00C0: CLRF 0F |
00C1: CLRF 0E |
.................... output_high(CE); |
00C2: BSF 03.5 |
00C3: BCF 09.2 |
00C4: BCF 03.5 |
00C5: BSF 09.2 |
.................... } |
.................... }*/ |
.................... |
.................... |
00C6: BCF 0C.1 |
00C7: BCF 0A.3 |
00C8: BCF 0A.4 |
00C9: GOTO 023 |
02C9: BCF 0C.0 |
02CA: BCF 0A.3 |
02CB: BCF 0A.4 |
02CC: GOTO 027 |
.................... void main() |
.................... { |
* |
021C: CLRF 04 |
021D: BCF 03.7 |
021E: MOVLW 1F |
021F: ANDWF 03,F |
0220: BSF 03.5 |
0221: BSF 03.6 |
0222: BSF 07.3 |
0223: MOVLW 08 |
0224: BCF 03.6 |
0225: MOVWF 19 |
0226: MOVLW 02 |
0227: MOVWF 1A |
0228: MOVLW A6 |
0229: MOVWF 18 |
022A: MOVLW 90 |
022B: BCF 03.5 |
022C: MOVWF 18 |
022D: BSF 28.3 |
022E: MOVF 28,W |
022F: BSF 03.5 |
0230: MOVWF 07 |
0231: BCF 03.5 |
0232: BSF 28.4 |
0233: MOVF 28,W |
0234: BSF 03.5 |
0235: MOVWF 07 |
0236: MOVLW A0 |
0237: MOVWF 13 |
0238: MOVLW 36 |
0239: BCF 03.5 |
023A: MOVWF 14 |
023B: BSF 03.5 |
023C: BSF 03.6 |
023D: MOVF 09,W |
023E: ANDLW C0 |
023F: MOVWF 09 |
0240: BCF 03.6 |
0241: BCF 1F.4 |
0242: BCF 1F.5 |
0243: MOVLW 00 |
0244: BSF 03.6 |
0245: MOVWF 08 |
0246: BCF 03.5 |
0247: CLRF 07 |
0248: CLRF 08 |
0249: CLRF 09 |
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); |
* |
0250: BSF 03.5 |
0251: BSF 03.6 |
0252: MOVF 09,W |
0253: ANDLW C0 |
0254: MOVWF 09 |
0255: BCF 03.6 |
0256: BCF 1F.4 |
0257: BCF 1F.5 |
0258: MOVLW 00 |
0259: BSF 03.6 |
025A: MOVWF 08 |
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); |
025B: BCF 03.5 |
025C: BCF 03.6 |
025D: BCF 1F.0 |
.................... // setup_spi(SPI_SS_DISABLED); |
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); |
025E: BSF 03.5 |
025F: MOVF 01,W |
0260: ANDLW C7 |
0261: IORLW 08 |
0262: MOVWF 01 |
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); |
0263: MOVLW 07 |
0264: BCF 03.5 |
0265: MOVWF 10 |
0393: MOVLW 07 |
0394: BCF 03.5 |
0395: MOVWF 10 |
.................... setup_timer_2(T2_DIV_BY_16,196,16); |
0266: MOVLW 78 |
0267: MOVWF 78 |
0268: IORLW 06 |
0269: MOVWF 12 |
026A: MOVLW C4 |
026B: BSF 03.5 |
026C: MOVWF 12 |
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); |
026D: BCF 03.5 |
026E: BSF 28.2 |
026F: MOVF 28,W |
0270: BSF 03.5 |
0271: MOVWF 07 |
0272: BCF 03.5 |
0273: CLRF 17 |
0274: BSF 03.5 |
0275: CLRF 1B |
0276: CLRF 1C |
0277: MOVLW 01 |
0278: MOVWF 1D |
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); |
0279: BCF 03.5 |
027A: BSF 03.6 |
027B: CLRF 07 |
027C: CLRF 08 |
027D: CLRF 09 |
03A9: BCF 03.5 |
03AA: BSF 03.6 |
03AB: CLRF 07 |
03AC: CLRF 08 |
03AD: CLRF 09 |
.................... setup_vref(FALSE); |
027E: BSF 03.5 |
027F: BCF 03.6 |
0280: CLRF 17 |
03AE: BSF 03.5 |
03AF: BCF 03.6 |
03B0: CLRF 17 |
.................... |
.................... delay_ms(1000); |
0281: MOVLW 04 |
0282: BCF 03.5 |
0283: MOVWF 5E |
0284: MOVLW FA |
0285: MOVWF 5F |
0286: CALL 0DC |
0287: DECFSZ 5E,F |
0288: GOTO 284 |
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++) |
0289: CLRF 5D |
028A: MOVF 5D,W |
028B: SUBLW 27 |
028C: BTFSS 03.0 |
028D: GOTO 295 |
.................... { |
.................... putc(cmd[n]); |
028E: MOVF 5D,W |
028F: CALL 03A |
0290: BTFSS 0C.4 |
0291: GOTO 290 |
0292: MOVWF 19 |
.................... } |
0293: INCF 5D,F |
0294: GOTO 28A |
.................... 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"); |
0295: MOVLW CA |
0296: BSF 03.6 |
0297: MOVWF 0D |
0298: MOVLW 00 |
0299: MOVWF 0F |
029A: BCF 03.6 |
029B: GOTO 0F0 |
.................... snd_buf[2]=0x55; |
029C: MOVLW 55 |
029D: MOVWF 3D |
.................... snd_buf[3]=0xAA; |
029E: MOVLW AA |
029F: MOVWF 3E |
03C5: MOVLW CD |
03C6: BSF 03.6 |
03C7: MOVWF 0D |
03C8: MOVLW 02 |
03C9: MOVWF 0F |
03CA: BCF 03.6 |
03CB: GOTO 2E8 |
.................... |
.................... set_timer1(0); |
02A0: CLRF 0F |
02A1: CLRF 0E |
.................... 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); |
02A2: BSF 03.5 |
02A3: BSF 0C.3 |
03D1: BSF 03.5 |
03D2: BSF 0C.3 |
.................... // enable_interrupts(INT_TIMER2); |
.................... enable_interrupts(GLOBAL); |
02A4: MOVLW C0 |
02A5: BCF 03.5 |
02A6: IORWF 0B,F |
03D3: MOVLW C0 |
03D4: BCF 03.5 |
03D5: IORWF 0B,F |
.................... |
.................... while(true) |
.................... { |
.................... |
.................... output_high(LED); |
02A7: BSF 03.5 |
02A8: BCF 09.1 |
02A9: BCF 03.5 |
02AA: BSF 09.1 |
.................... output_low(LED); |
02AB: BSF 03.5 |
02AC: BCF 09.1 |
02AD: BCF 03.5 |
02AE: BCF 09.1 |
.................... set_timer1(0); |
02AF: CLRF 0F |
02B0: CLRF 0E |
.................... output_high(CE); |
02B1: BSF 03.5 |
02B2: BCF 09.2 |
02B3: BCF 03.5 |
02B4: BSF 09.2 |
.................... delay_ms(999); |
02B5: MOVLW 09 |
02B6: MOVWF 5E |
02B7: MOVLW 6F |
02B8: MOVWF 5F |
02B9: CALL 0DC |
02BA: DECFSZ 5E,F |
02BB: GOTO 2B7 |
.................... delay_us(966); |
02BC: MOVLW 06 |
02BD: MOVWF 5E |
02BE: MOVLW A0 |
02BF: MOVWF 5F |
02C0: GOTO 13A |
02C1: DECFSZ 5E,F |
02C2: GOTO 2BE |
.................... output_low(CE); |
02C3: BSF 03.5 |
02C4: BCF 09.2 |
02C5: BCF 03.5 |
02C6: BCF 09.2 |
.................... count=get_timer1(); |
02C7: MOVF 0F,W |
02C8: MOVWF 7A |
02C9: MOVF 0E,W |
02CA: MOVWF 77 |
02CB: MOVF 0F,W |
02CC: SUBWF 7A,W |
02CD: BTFSS 03.2 |
02CE: GOTO 2C7 |
02CF: MOVF 77,W |
02D0: MOVWF 29 |
02D1: MOVF 7A,W |
02D2: MOVWF 2A |
.................... |
.................... printf("count: %Lu %X %X %X %X\r\n",count, buffer[0],buffer[1],buffer[2],buffer[3]); |
02D3: MOVLW CF |
02D4: BSF 03.6 |
02D5: MOVWF 0D |
02D6: MOVLW 00 |
02D7: MOVWF 0F |
02D8: BCF 03.0 |
02D9: MOVLW 07 |
02DA: BCF 03.6 |
02DB: MOVWF 5E |
02DC: GOTO 14B |
02DD: MOVLW 10 |
02DE: MOVWF 04 |
02DF: MOVF 2A,W |
02E0: MOVWF 5F |
02E1: MOVF 29,W |
02E2: MOVWF 5E |
02E3: GOTO 19E |
02E4: MOVLW 20 |
02E5: BTFSS 0C.4 |
02E6: GOTO 2E5 |
02E7: MOVWF 19 |
02E8: MOVF 4B,W |
02E9: MOVWF 5E |
02EA: MOVLW 37 |
02EB: MOVWF 5F |
02EC: CALL 1F9 |
02ED: MOVLW 20 |
02EE: BTFSS 0C.4 |
02EF: GOTO 2EE |
02F0: MOVWF 19 |
02F1: MOVF 4C,W |
02F2: MOVWF 5E |
02F3: MOVLW 37 |
02F4: MOVWF 5F |
02F5: CALL 1F9 |
02F6: MOVLW 20 |
02F7: BTFSS 0C.4 |
02F8: GOTO 2F7 |
02F9: MOVWF 19 |
02FA: MOVF 4D,W |
02FB: MOVWF 5E |
02FC: MOVLW 37 |
02FD: MOVWF 5F |
02FE: CALL 1F9 |
02FF: MOVLW 20 |
0300: BTFSS 0C.4 |
0301: GOTO 300 |
0302: MOVWF 19 |
0303: MOVF 4E,W |
0304: MOVWF 5E |
0305: MOVLW 37 |
0306: MOVWF 5F |
0307: CALL 1F9 |
0308: MOVLW 0D |
0309: BTFSS 0C.4 |
030A: GOTO 309 |
030B: MOVWF 19 |
030C: MOVLW 0A |
030D: BTFSS 0C.4 |
030E: GOTO 30D |
030F: MOVWF 19 |
.................... { |
.................... /* 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]); |
.................... */ |
.................... } |
0310: GOTO 2A7 |
03D6: GOTO 3D6 |
.................... } |
0311: SLEEP |
03D7: SLEEP |
|
Configuration Fuses: |
Word 1: 2CF2 HS NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |