Rev Author Line No. Line
3462 kaklik 1 CCS PCM C Compiler, Version 4.106, 47914 04-II-14 11:45
3458 kaklik 2  
3462 kaklik 3 Filename: Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC16F887\main.lst
3458 kaklik 4  
3462 kaklik 5 ROM used: 984 words (12%)
3458 kaklik 6 Largest free fragment is 2048
3462 kaklik 7 RAM used: 43 (12%) at main() level
8 96 (26%) worst case
9 Stack: 3 worst case (1 in main + 2 for interrupts)
3458 kaklik 10  
11 *
3462 kaklik 12 0000: MOVLW 03
3458 kaklik 13 0001: MOVWF 0A
3462 kaklik 14 0002: GOTO 332
3458 kaklik 15 0003: NOP
16 0004: MOVWF 7F
17 0005: SWAPF 03,W
18 0006: CLRF 03
19 0007: MOVWF 21
20 0008: MOVF 0A,W
21 0009: MOVWF 20
22 000A: CLRF 0A
23 000B: MOVF 04,W
24 000C: MOVWF 22
25 000D: MOVF 77,W
26 000E: MOVWF 23
27 000F: MOVF 78,W
28 0010: MOVWF 24
29 0011: MOVF 79,W
30 0012: MOVWF 25
31 0013: MOVF 7A,W
32 0014: MOVWF 26
33 0015: BCF 03.7
34 0016: BCF 03.5
3462 kaklik 35 0017: BTFSS 0B.4
36 0018: GOTO 01B
37 0019: BTFSC 0B.1
38 001A: GOTO 038
39 001B: MOVLW 8C
40 001C: MOVWF 04
41 001D: BTFSS 00.0
42 001E: GOTO 021
43 001F: BTFSC 0C.0
44 0020: GOTO 03B
45 0021: MOVLW 8C
46 0022: MOVWF 04
47 0023: BTFSS 00.3
48 0024: GOTO 027
49 0025: BTFSC 0C.3
50 0026: GOTO 03E
51 0027: MOVF 22,W
52 0028: MOVWF 04
53 0029: MOVF 23,W
54 002A: MOVWF 77
55 002B: MOVF 24,W
56 002C: MOVWF 78
57 002D: MOVF 25,W
58 002E: MOVWF 79
59 002F: MOVF 26,W
60 0030: MOVWF 7A
61 0031: MOVF 20,W
62 0032: MOVWF 0A
63 0033: SWAPF 21,W
64 0034: MOVWF 03
65 0035: SWAPF 7F,F
66 0036: SWAPF 7F,W
67 0037: RETFIE
68 0038: BCF 0A.3
69 0039: BCF 0A.4
70 003A: GOTO 145
71 003B: BCF 0A.3
72 003C: BCF 0A.4
73 003D: GOTO 2C6
74 003E: BCF 0A.3
75 003F: BCF 0A.4
76 0040: GOTO 06D
3458 kaklik 77 .................... #include "main.h"
78 .................... #include <16F887.h>
79 .................... //////// Standard Header file for the PIC16F887 device ////////////////
80 .................... #device PIC16F887
81 .................... #list
82 ....................
83 .................... #device adc=8
84 ....................
85 .................... #FUSES NOWDT //No Watch Dog Timer
86 .................... #FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
87 .................... #FUSES NOPUT //No Power Up Timer
88 .................... #FUSES MCLR //Master Clear pin enabled
89 .................... #FUSES NOPROTECT //Code not protected from reading
90 .................... #FUSES NOCPD //No EE protection
91 .................... #FUSES NOBROWNOUT //No brownout reset
92 .................... #FUSES IESO //Internal External Switch Over mode enabled
93 .................... #FUSES FCMEN //Fail-safe clock monitor enabled
94 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
95 .................... #FUSES NODEBUG //No Debug mode for ICD
96 .................... #FUSES NOWRT //Program memory not write protected
97 .................... #FUSES BORV40 //Brownout reset at 4.0V
98 ....................
99 .................... #use delay(clock=20000000)
100 *
3462 kaklik 101 02D2: MOVLW 47
102 02D3: MOVWF 04
103 02D4: BCF 03.7
104 02D5: MOVF 00,W
105 02D6: BTFSC 03.2
106 02D7: GOTO 2E5
107 02D8: MOVLW 06
108 02D9: MOVWF 78
109 02DA: CLRF 77
110 02DB: DECFSZ 77,F
111 02DC: GOTO 2DB
112 02DD: DECFSZ 78,F
113 02DE: GOTO 2DA
114 02DF: MOVLW 7B
115 02E0: MOVWF 77
116 02E1: DECFSZ 77,F
117 02E2: GOTO 2E1
118 02E3: DECFSZ 00,F
119 02E4: GOTO 2D8
120 02E5: BCF 0A.3
121 02E6: BCF 0A.4
122 02E7: GOTO 3B7 (RETURN)
3458 kaklik 123 .................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,errors)
124 ....................
125 .................... //NOTE: Must declare MASTER before SLAVE, i2c_isr_state() returns 0
126 .................... // when MASTER is the most recent #use i2c
127 .................... //#use i2c(MASTER, sda=PIN_C1, scl=PIN_C0, stream=I2CM)
128 .................... #use i2c(SLAVE, Fast, sda=PIN_C4, scl=PIN_C3, force_hw, address=0xA0)
129 *
3462 kaklik 130 00AC: MOVF 4C,W
131 00AD: MOVWF 13
132 00AE: BSF 14.4
133 00AF: BCF 0C.3
134 00B0: BSF 03.5
135 00B1: BTFSC 14.0
136 00B2: GOTO 0B1
137 00B3: CLRF 78
138 00B4: BCF 03.5
139 00B5: BTFSC 14.4
140 00B6: INCF 78,F
3458 kaklik 141 ....................
142 ....................
143 ....................
3462 kaklik 144 .................... #include <string.h>
145 .................... ////////////////////////////////////////////////////////////////////////////
146 .................... //// (C) Copyright 1996,2008 Custom Computer Services ////
147 .................... //// This source code may only be used by licensed users of the CCS C ////
148 .................... //// compiler. This source code may only be distributed to other ////
149 .................... //// licensed users of the CCS C compiler. No other use, reproduction ////
150 .................... //// or distribution is permitted without written permission. ////
151 .................... //// Derivative programs created using this software in object code ////
152 .................... //// form are not restricted in any way. ////
153 .................... ////////////////////////////////////////////////////////////////////////////
3458 kaklik 154 ....................
3462 kaklik 155 .................... #ifndef _STRING
156 .................... #define _STRING
157 .................... #include <stddef.h>
158 .................... ///////////////////////////////////////////////////////////////////////////
159 .................... //// (C) Copyright 1996,2003 Custom Computer Services ////
160 .................... //// This source code may only be used by licensed users of the CCS C ////
161 .................... //// compiler. This source code may only be distributed to other ////
162 .................... //// licensed users of the CCS C compiler. No other use, reproduction ////
163 .................... //// or distribution is permitted without written permission. ////
164 .................... //// Derivative programs created using this software in object code ////
165 .................... //// form are not restricted in any way. ////
166 .................... ///////////////////////////////////////////////////////////////////////////
167 ....................
168 .................... #ifndef _STDDEF
169 ....................
170 .................... #define _STDDEF
171 ....................
172 .................... #if sizeof(unsigned int8 *)==1
173 .................... #define ptrdiff_t unsigned int8
174 .................... #else
175 .................... #define ptrdiff_t unsigned int16
176 .................... #endif
177 ....................
178 .................... #define size_t unsigned int8
179 .................... #define wchar_t char
180 .................... #define NULL 0
181 ....................
182 .................... #define offsetof(s,f) (offsetofbit(s,f)/8)
183 ....................
184 .................... #endif
185 ....................
186 .................... #include <ctype.h>
187 .................... ////////////////////////////////////////////////////////////////////////////
188 .................... //// (C) Copyright 1996,2003 Custom Computer Services ////
189 .................... //// This source code may only be used by licensed users of the CCS C ////
190 .................... //// compiler. This source code may only be distributed to other ////
191 .................... //// licensed users of the CCS C compiler. No other use, reproduction ////
192 .................... //// or distribution is permitted without written permission. ////
193 .................... //// Derivative programs created using this software in object code ////
194 .................... //// form are not restricted in any way. ////
195 .................... ////////////////////////////////////////////////////////////////////////////
196 ....................
197 .................... #ifndef _CTYPE
198 .................... #define _CTYPE
199 ....................
200 .................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz")
201 .................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
202 .................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
203 .................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
204 .................... #define isdigit(x) isamong(x,"0123456789")
205 .................... #define isspace(x) ((x)==' ')
206 .................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef")
207 .................... #define iscntrl(x) ((x)<' ')
208 .................... #define isprint(x) ((x)>=' ')
209 .................... #define isgraph(x) ((x)>' ')
210 .................... #define ispunct(x) (((x)>' ')&&!isalnum(x))
211 ....................
212 .................... #endif
213 ....................
214 ....................
215 ....................
216 ....................
217 ....................
218 .................... //////////////////////////////////////////////
219 .................... //// Uncomment the following define to ////
220 .................... //// allow some functions to use a ////
221 .................... //// quicker algorithm, but use more ROM ////
222 .................... //// ////
223 .................... //// #define FASTER_BUT_MORE_ROM ////
224 .................... //////////////////////////////////////////////
225 ....................
226 ....................
227 ....................
228 .................... /*Copying functions*/
229 .................... /* standard template:
230 .................... void *memmove(void *s1, void *s2, size_t n).
231 .................... Copies max of n characters safely (not following ending '\0')
232 .................... from s2 in s1; if s2 has less than n characters, appends 0 */
233 ....................
234 .................... char *memmove(void *s1,char *s2,size_t n)
235 .................... {
236 .................... char *sc1;
237 .................... char *sc2;
238 .................... sc1=s1;
239 .................... sc2=s2;
240 .................... if(sc2<sc1 && sc1 <sc2 +n)
241 .................... for(sc1+=n,sc2+=n;0<n;--n)
242 .................... *--sc1=*--sc2;
243 .................... else
244 .................... for(;0<n;--n)
245 .................... *sc1++=*sc2++;
246 .................... return s1;
247 .................... }
248 ....................
249 .................... /* Standard template: char *strcpy(char *s1, const char *s2)
250 .................... copies the string s2 including the null character to s1.
251 .................... This is a compiler built in to handle the different address
252 .................... spaces */
253 ....................
254 .................... #define strcopy strcpy
255 ....................
256 .................... /* standard template:
257 .................... char *strncpy(char *s1, const char *s2, size_t n).
258 .................... Copies max of n characters (not following ending '\0')
259 .................... from s2 in s1; if s2 has less than n characters, appends 0 */
260 ....................
261 .................... char *strncpy(char *s1, char *s2, size_t n)
262 .................... {
263 .................... char *s;
264 ....................
265 .................... for (s = s1; n > 0 && *s2 != '\0'; n--)
266 *
267 0101: MOVF 63,W
268 0102: MOVWF 68
269 0103: MOVF 62,W
270 0104: MOVWF 67
271 0105: MOVF 66,F
272 0106: BTFSC 03.2
273 0107: GOTO 130
274 0108: MOVF 65,W
275 0109: MOVWF 7A
276 010A: MOVF 64,W
277 010B: MOVWF 04
278 010C: BCF 03.7
279 010D: BTFSC 7A.0
280 010E: BSF 03.7
281 010F: MOVF 00,F
282 0110: BTFSC 03.2
283 0111: GOTO 130
284 .................... *s++ = *s2++;
285 0112: MOVF 68,W
286 0113: MOVWF 7A
287 0114: MOVF 67,W
288 0115: INCF 67,F
289 0116: BTFSC 03.2
290 0117: INCF 68,F
291 0118: MOVWF 69
292 0119: MOVF 7A,W
293 011A: MOVWF 6A
294 011B: MOVF 65,W
295 011C: MOVWF 7A
296 011D: MOVF 64,W
297 011E: INCF 64,F
298 011F: BTFSC 03.2
299 0120: INCF 65,F
300 0121: MOVWF 04
301 0122: BCF 03.7
302 0123: BTFSC 7A.0
303 0124: BSF 03.7
304 0125: MOVF 00,W
305 0126: MOVWF 6B
306 0127: MOVF 69,W
307 0128: MOVWF 04
308 0129: BCF 03.7
309 012A: BTFSC 6A.0
310 012B: BSF 03.7
311 012C: MOVF 6B,W
312 012D: MOVWF 00
313 012E: DECF 66,F
314 012F: GOTO 105
315 .................... for (; n > 0; n--)
316 0130: MOVF 66,F
317 0131: BTFSC 03.2
318 0132: GOTO 140
319 .................... *s++ = '\0';
320 0133: MOVF 68,W
321 0134: MOVWF 7A
322 0135: MOVF 67,W
323 0136: INCF 67,F
324 0137: BTFSC 03.2
325 0138: INCF 68,F
326 0139: MOVWF 04
327 013A: BCF 03.7
328 013B: BTFSC 7A.0
329 013C: BSF 03.7
330 013D: CLRF 00
331 013E: DECF 66,F
332 013F: GOTO 130
333 ....................
334 .................... return(s1);
335 0140: MOVF 62,W
336 0141: MOVWF 78
337 0142: MOVF 63,W
338 0143: MOVWF 79
339 .................... }
340 0144: RETURN
341 .................... /***********************************************************/
342 ....................
343 .................... /*concatenation functions*/
344 .................... /* standard template: char *strcat(char *s1, const char *s2)
345 .................... appends s2 to s1*/
346 ....................
347 .................... char *strcat(char *s1, char *s2)
348 .................... {
349 .................... char *s;
350 ....................
351 .................... for (s = s1; *s != '\0'; ++s);
352 .................... while(*s2 != '\0')
353 .................... {
354 .................... *s = *s2;
355 .................... ++s;
356 .................... ++s2;
357 .................... }
358 ....................
359 .................... *s = '\0';
360 .................... return(s1);
361 .................... }
362 .................... /* standard template: char *strncat(char *s1, char *s2,size_t n)
363 .................... appends not more than n characters from s2 to s1*/
364 ....................
365 .................... char *strncat(char *s1, char *s2, size_t n)
366 .................... {
367 .................... char *s;
368 ....................
369 .................... for (s = s1; *s != '\0'; ++s);
370 .................... while(*s2 != '\0' && 0<n)
371 .................... {
372 .................... *s = *s2;
373 .................... ++s;
374 .................... ++s2;
375 .................... --n;
376 .................... }
377 ....................
378 .................... *s = '\0';
379 .................... return(s1);
380 .................... }
381 ....................
382 .................... /***********************************************************/
383 ....................
384 ....................
385 .................... /*comparison functions*/
386 .................... /* standard template: signed int memcmp(void *s1, void *s2).
387 .................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
388 ....................
389 .................... signed int8 memcmp(void * s1,char *s2,size_t n)
390 .................... {
391 .................... char *su1, *su2;
392 .................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)
393 .................... {
394 .................... if(*su1!=*su2)
395 .................... return ((*su1<*su2)?-1:+1);
396 .................... }
397 .................... return 0;
398 .................... }
399 ....................
400 .................... /* standard template: int strcmp(const char *s1, const char *s2).
401 .................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
402 ....................
403 .................... signed int8 strcmp(char *s1, char *s2)
404 .................... {
405 .................... for (; *s1 == *s2; s1++, s2++)
406 .................... if (*s1 == '\0')
407 .................... return(0);
408 .................... return((*s1 < *s2) ? -1: 1);
409 .................... }
410 .................... /* standard template: int strcoll(const char *s1, const char *s2).
411 .................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
412 ....................
413 .................... signed int8 strcoll(char *s1, char *s2)
414 .................... {
415 .................... for (; *s1 == *s2; s1++, s2++)
416 .................... if (*s1 == '\0')
417 .................... return(0);
418 .................... return((*s1 < *s2) ? -1: 1);
419 .................... }
420 ....................
421 .................... /* standard template:
422 .................... int strncmp(const char *s1, const char *s2, size_t n).
423 .................... Compares max of n characters (not following 0) from s1 to s2;
424 .................... returns same as strcmp */
425 ....................
426 .................... signed int8 strncmp(char *s1, char *s2, size_t n)
427 .................... {
428 .................... for (; n > 0; s1++, s2++, n--)
429 .................... if (*s1 != *s2)
430 .................... return((*s1 <*s2) ? -1: 1);
431 .................... else if (*s1 == '\0')
432 .................... return(0);
433 .................... return(0);
434 .................... }
435 .................... /* standard template:
436 .................... int strxfrm(const char *s1, const char *s2, size_t n).
437 .................... transforms maximum of n characters from s2 and places them into s1*/
438 .................... size_t strxfrm(char *s1, char *s2, size_t n)
439 .................... {
440 .................... char *s;
441 .................... unsigned int8 n1;
442 .................... n1=n;
443 .................... for (s = s1; n > 0 && *s2 != '\0'; n--)
444 .................... *s++ = *s2++;
445 .................... for (; n > 0; n--)
446 .................... *s++ = '\0';
447 ....................
448 .................... return(n1);
449 .................... }
450 ....................
451 ....................
452 ....................
453 ....................
454 ....................
455 .................... /***********************************************************/
456 .................... /*Search functions*/
457 .................... /* standard template: void *memchr(const char *s, int c).
458 .................... Finds first occurrence of c in n characters of s */
459 ....................
460 .................... char *memchr(void *s,unsigned int8 c,size_t n)
461 .................... {
462 .................... char uc;
463 .................... char *su;
464 .................... uc=c;
465 .................... for(su=s;0<n;++su,--n)
466 .................... if(*su==uc)
467 .................... return su;
468 .................... return NULL;
469 .................... }
470 ....................
471 .................... /* standard template: char *strchr(const char *s, int c).
472 .................... Finds first occurrence of c in s */
473 ....................
474 .................... char *strchr(char *s, unsigned int8 c)
475 .................... {
476 .................... for (; *s != c; s++)
477 .................... if (*s == '\0')
478 .................... return(0);
479 .................... return(s);
480 .................... }
481 .................... /* standard template:
482 .................... size_t strcspn(const char *s1, const char *s2).
483 .................... Computes length of max initial segment of s1 that
484 .................... consists entirely of characters NOT from s2*/
485 ....................
486 .................... unsigned int8 strcspn(char *s1, char *s2)
487 .................... {
488 .................... char *sc1, *sc2;
489 ....................
490 .................... for (sc1 = s1; *sc1 != 0; sc1++)
491 .................... for (sc2 = s2; *sc2 != 0; sc2++)
492 .................... if (*sc1 == *sc2)
493 .................... return(sc1 - s1);
494 .................... return(sc1 - s1);
495 .................... }
496 .................... /* standard template:
497 .................... char *strpbrk(const char *s1, const char *s2).
498 .................... Locates first occurence of any character from s2 in s1;
499 .................... returns s1 if s2 is empty string */
500 ....................
501 .................... char *strpbrk(char *s1, char *s2)
502 .................... {
503 .................... char *sc1, *sc2;
504 ....................
505 .................... for (sc1 = s1; *sc1 != 0; sc1++)
506 .................... for (sc2 = s2; *sc2 != 0; sc2++)
507 .................... if (*sc1 == *sc2)
508 .................... return(sc1);
509 .................... return(0);
510 .................... }
511 ....................
512 ....................
513 .................... /* standard template: char *strrchr(const char *s, int c).
514 .................... Finds last occurrence of c in s */
515 ....................
516 .................... char *strrchr(char *s, unsigned int8 c)
517 .................... {
518 .................... char *p;
519 ....................
520 .................... for (p = 0; ; s++)
521 .................... {
522 .................... if (*s == c)
523 .................... p = s;
524 .................... if (*s == '\0')
525 .................... return(p);
526 .................... }
527 .................... }
528 .................... /* computes length of max initial segment of s1 consisting
529 .................... entirely of characters from s2 */
530 ....................
531 .................... unsigned int8 strspn(char *s1, char *s2)
532 .................... {
533 .................... char *sc1, *sc2;
534 ....................
535 .................... for (sc1 = s1; *sc1 != 0; sc1++)
536 .................... for (sc2 = s2; ; sc2++)
537 .................... if (*sc2 == '\0')
538 .................... return(sc1 - s1);
539 .................... else if (*sc1 == *sc2)
540 .................... break;
541 .................... return(sc1 - s1);
542 .................... }
543 .................... /* standard template:
544 .................... char *strstr(const char *s1, const char *s2);
545 .................... Locates first occurence of character sequence s2 in s1;
546 .................... returns 0 if s2 is empty string
547 ....................
548 .................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the
549 .................... file to use the faster algorithm */
550 .................... char *strstr(char *s1, char *s2)
551 .................... {
552 .................... char *s, *t;
553 ....................
554 .................... #ifdef FASTER_BUT_MORE_ROM
555 .................... if (*s2 == '\0')
556 .................... return(s1);
557 .................... #endif
558 ....................
559 .................... while (*s1)
560 .................... {
561 .................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t);
562 ....................
563 .................... if (*t == '\0')
564 .................... return s1;
565 .................... ++s1;
566 .................... #ifdef FASTER_BUT_MORE_ROM
567 .................... while(*s1 != '\0' && *s1 != *s2)
568 .................... ++s1;
569 .................... #endif
570 .................... }
571 .................... return 0;
572 .................... }
573 ....................
574 .................... /* standard template: char *strtok(char *s1, const char *s2).
575 ....................
576 .................... Finds next token in s1 delimited by a character from separator
577 .................... string s2 (which can be different from call to call). First call
578 .................... starts at beginning of s1 searching for first character NOT
579 .................... contained in s2; returns 0 if none is found.
580 .................... If one is found, it is the start of first token (return value).
581 .................... Function then searches from there for a character contained in s2.
582 .................... If none is found, current token extends to end of s1, and subsequent
583 .................... searches for a token will return 0. If one is found, it is
584 .................... overwritten by '\0', which terminates current token. Function saves
585 .................... pointer to following character from which next search will start.
586 .................... Each subsequent call, with 0 as first argument, starts searching
587 .................... from saved pointer */
588 ....................
589 .................... char *strtok(char *s1, char *s2)
590 .................... {
591 .................... char *beg, *end;
592 .................... static char *save;
593 *
594 0366: CLRF 29
595 0367: CLRF 2A
596 ....................
597 .................... beg = (s1)? s1: save;
598 .................... beg += strspn(beg, s2);
599 .................... if (*beg == '\0')
600 .................... {
601 .................... *save = ' ';
602 .................... return(0);
603 .................... }
604 .................... end = strpbrk(beg, s2);
605 .................... if (*end != '\0')
606 .................... {
607 .................... *end = '\0';
608 .................... end++;
609 .................... }
610 .................... save = end;
611 .................... return(beg);
612 .................... }
613 ....................
614 .................... /*****************************************************************/
615 .................... /*Miscellaneous functions*/
616 .................... /* standard template
617 .................... maps error number in errnum to an error message string
618 .................... Returns: Pointer to string
619 .................... */
620 .................... #ifdef _ERRNO
621 .................... char * strerror(unsigned int8 errnum)
622 .................... {
623 .................... char s[15];
624 .................... switch( errnum)
625 .................... {
626 .................... case 0:
627 .................... strcpy(s,"no errors");
628 .................... return s;
629 .................... case EDOM :
630 .................... strcpy(s,"domain error");
631 .................... return s;
632 .................... case ERANGE:
633 .................... strcpy(s,"range error");
634 .................... return s;
635 .................... }
636 .................... }
637 .................... #ENDIF
638 .................... /* standard template: size_t strlen(const char *s).
639 .................... Computes length of s1 (preceding terminating 0) */
640 ....................
641 .................... unsigned int8 strlen(char *s)
642 .................... {
643 .................... char *sc;
644 ....................
645 .................... for (sc = s; *sc != 0; sc++);
646 .................... return(sc - s);
647 .................... }
648 ....................
649 .................... /* standard template: size_t stricmp(const char *s1, const char *s2).
650 .................... Compares s1 to s2 ignoring case (upper vs. lower) */
651 ....................
652 .................... signed int8 stricmp(char *s1, char *s2)
653 .................... {
654 .................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));
655 .................... s1++, s2++)
656 .................... if (*s1 == '\0')
657 .................... return(0);
658 .................... return((*s1 < *s2) ? -1: 1);
659 .................... }
660 ....................
661 ....................
662 .................... /* standard template: char *strlwr(char *s).
663 .................... Replaces uppercase letters by lowercase;
664 .................... returns pointer to new string s */
665 ....................
666 .................... char *strlwr(char *s)
667 .................... {
668 .................... char *p;
669 ....................
670 .................... for (p = s; *p != '\0'; p++)
671 .................... if (*p >= 'A' && *p <='Z')
672 .................... *p += 'a' - 'A';
673 .................... return(s);
674 .................... }
675 ....................
676 ....................
677 .................... /************************************************************/
678 ....................
679 ....................
680 .................... #endif
681 ....................
682 ....................
3458 kaklik 683 .................... #define LED PIN_E1
684 .................... #define CE PIN_E2
685 ....................
3462 kaklik 686 .................... #define SEL0 PIN_E0 // external counter division ratio
687 .................... #define SEL1 PIN_E1 // external counter division ratio
688 .................... #define MR PIN_E2 // external counter master reset
689 .................... #define CLKI PIN_C0 // internal counter input
690 .................... #define BEEP PIN_C3 // buzzer
3458 kaklik 691 ....................
3462 kaklik 692 .................... unsigned int32 count;
3458 kaklik 693 ....................
3462 kaklik 694 ....................
3458 kaklik 695 .................... int8 buffer[0x10]; // I2C buffer
696 .................... int8 address;
697 ....................
3462 kaklik 698 .................... unsigned int16 of=0; // count of overflow
699 ....................
3458 kaklik 700 .................... 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};
701 ....................
702 .................... #INT_SSP
703 .................... void ssp_interupt ()
704 .................... {
705 .................... BYTE incoming, state;
706 ....................
707 .................... state = i2c_isr_state();
708 *
3462 kaklik 709 006D: BSF 03.5
710 006E: BTFSC 14.5
711 006F: GOTO 078
712 0070: BCF 03.5
713 0071: CLRF 42
714 0072: BSF 03.5
715 0073: BTFSS 14.2
716 0074: GOTO 078
717 0075: BCF 03.5
718 0076: BSF 42.7
719 0077: BSF 03.5
720 0078: BCF 03.5
721 0079: MOVF 42,W
722 007A: INCF 42,F
723 007B: MOVWF 4A
3458 kaklik 724 ....................
725 .................... if(state < 0x80) //Master is sending data
3462 kaklik 726 007C: MOVF 4A,W
727 007D: SUBLW 7F
728 007E: BTFSS 03.0
729 007F: GOTO 0A0
3458 kaklik 730 .................... {
731 .................... incoming = i2c_read();
3462 kaklik 732 0080: BCF 14.6
733 0081: BTFSS 0C.3
734 0082: GOTO 081
735 0083: MOVF 13,W
736 0084: BSF 14.4
737 0085: MOVWF 49
3458 kaklik 738 .................... if(state == 1) //First received byte is address
3462 kaklik 739 0086: DECFSZ 4A,W
740 0087: GOTO 096
3458 kaklik 741 .................... {
742 .................... address = incoming;
3462 kaklik 743 0088: MOVF 49,W
744 0089: MOVWF 3F
3458 kaklik 745 .................... if (incoming == 2)
3462 kaklik 746 008A: MOVF 49,W
747 008B: SUBLW 02
748 008C: BTFSS 03.2
749 008D: GOTO 096
3458 kaklik 750 .................... {
751 .................... buffer[0]=make8(count,0);
3462 kaklik 752 008E: MOVF 2B,W
753 008F: MOVWF 2F
3458 kaklik 754 .................... buffer[1]=make8(count,1);
3462 kaklik 755 0090: MOVF 2C,W
756 0091: MOVWF 30
757 .................... buffer[2]=make8(count,2);
758 0092: MOVF 2D,W
759 0093: MOVWF 31
760 .................... buffer[3]=make8(count,3);
761 0094: MOVF 2E,W
762 0095: MOVWF 32
3458 kaklik 763 .................... }
764 .................... }
765 .................... if(state == 2) //Second received byte is data
3462 kaklik 766 0096: MOVF 4A,W
767 0097: SUBLW 02
768 0098: BTFSS 03.2
769 0099: GOTO 0A0
3458 kaklik 770 .................... buffer[address] = incoming;
3462 kaklik 771 009A: MOVLW 2F
772 009B: ADDWF 3F,W
773 009C: MOVWF 04
774 009D: BCF 03.7
775 009E: MOVF 49,W
776 009F: MOVWF 00
3458 kaklik 777 ....................
778 ....................
779 .................... }
780 .................... if(state == 0x80) //Master is requesting data
3462 kaklik 781 00A0: MOVF 4A,W
782 00A1: SUBLW 80
783 00A2: BTFSS 03.2
784 00A3: GOTO 0B7
3458 kaklik 785 .................... {
786 .................... i2c_write(buffer[address]);
3462 kaklik 787 00A4: MOVLW 2F
788 00A5: ADDWF 3F,W
789 00A6: MOVWF 04
790 00A7: BCF 03.7
791 00A8: MOVF 00,W
792 00A9: MOVWF 4B
793 00AA: MOVF 4B,W
794 00AB: MOVWF 4C
3458 kaklik 795 .................... }
796 .................... }
797 ....................
798 ....................
799 *
3462 kaklik 800 00B7: BCF 0C.3
801 00B8: BCF 0A.3
802 00B9: BCF 0A.4
803 00BA: GOTO 027
804 .................... #int_EXT // Interrupt from 1PPS
805 .................... void EXT_isr(void)
806 .................... {
807 .................... unsigned int16 countH;
808 .................... unsigned int8 countL;
809 .................... char countS[10], a[4], b[4], c[4]; // strings for printing results
810 ....................
811 .................... countL=0;
812 *
813 0145: CLRF 4B
814 .................... countH=get_timer1(); // read internal counter
815 0146: MOVF 0F,W
816 0147: MOVWF 7A
817 0148: MOVF 0E,W
818 0149: MOVWF 77
819 014A: MOVF 0F,W
820 014B: SUBWF 7A,W
821 014C: BTFSS 03.2
822 014D: GOTO 146
823 014E: MOVF 77,W
824 014F: MOVWF 49
825 0150: MOVF 7A,W
826 0151: MOVWF 4A
827 .................... output_low(SEL0);
828 0152: BSF 03.5
829 0153: BCF 09.0
830 0154: BCF 03.5
831 0155: BCF 09.0
832 .................... output_low(SEL1);
833 0156: BSF 03.5
834 0157: BCF 09.1
835 0158: BCF 03.5
836 0159: BCF 09.1
837 .................... countL=input(CLKI); // read bit 0 of external counter
838 015A: BSF 28.0
839 015B: MOVF 28,W
840 015C: BSF 03.5
841 015D: MOVWF 07
842 015E: BCF 03.5
843 015F: CLRF 4B
844 0160: BTFSC 07.0
845 0161: INCF 4B,F
846 .................... output_high(SEL0);
847 0162: BSF 03.5
848 0163: BCF 09.0
849 0164: BCF 03.5
850 0165: BSF 09.0
851 .................... output_low(SEL1);
852 0166: BSF 03.5
853 0167: BCF 09.1
854 0168: BCF 03.5
855 0169: BCF 09.1
856 .................... countL|=input(CLKI)<<1; // read bit 1 of external counter
857 016A: BSF 28.0
858 016B: MOVF 28,W
859 016C: BSF 03.5
860 016D: MOVWF 07
861 016E: MOVLW 00
862 016F: BCF 03.5
863 0170: BTFSC 07.0
864 0171: MOVLW 01
865 0172: MOVWF 77
866 0173: BCF 03.0
867 0174: RLF 77,F
868 0175: MOVF 77,W
869 0176: IORWF 4B,F
870 .................... output_low(SEL0);
871 0177: BSF 03.5
872 0178: BCF 09.0
873 0179: BCF 03.5
874 017A: BCF 09.0
875 .................... output_high(SEL1);
876 017B: BSF 03.5
877 017C: BCF 09.1
878 017D: BCF 03.5
879 017E: BSF 09.1
880 .................... countL|=input(CLKI)<<2; // read bit 2 of external counter
881 017F: BSF 28.0
882 0180: MOVF 28,W
883 0181: BSF 03.5
884 0182: MOVWF 07
885 0183: MOVLW 00
886 0184: BCF 03.5
887 0185: BTFSC 07.0
888 0186: MOVLW 01
889 0187: MOVWF 77
890 0188: RLF 77,F
891 0189: RLF 77,F
892 018A: MOVLW FC
893 018B: ANDWF 77,F
894 018C: MOVF 77,W
895 018D: IORWF 4B,F
896 .................... output_high(SEL0);
897 018E: BSF 03.5
898 018F: BCF 09.0
899 0190: BCF 03.5
900 0191: BSF 09.0
901 .................... output_high(SEL1);
902 0192: BSF 03.5
903 0193: BCF 09.1
904 0194: BCF 03.5
905 0195: BSF 09.1
906 .................... countL|=input(CLKI)<<3; // read bit 3 of external counter
907 0196: BSF 28.0
908 0197: MOVF 28,W
909 0198: BSF 03.5
910 0199: MOVWF 07
911 019A: MOVLW 00
912 019B: BCF 03.5
913 019C: BTFSC 07.0
914 019D: MOVLW 01
915 019E: MOVWF 77
916 019F: RLF 77,F
917 01A0: RLF 77,F
918 01A1: RLF 77,F
919 01A2: MOVLW F8
920 01A3: ANDWF 77,F
921 01A4: MOVF 77,W
922 01A5: IORWF 4B,F
923 ....................
924 .................... output_low(MR); // External counter Master Reset
925 01A6: BSF 03.5
926 01A7: BCF 09.2
927 01A8: BCF 03.5
928 01A9: BCF 09.2
929 .................... output_high(MR);
930 01AA: BSF 03.5
931 01AB: BCF 09.2
932 01AC: BCF 03.5
933 01AD: BSF 09.2
934 ....................
935 .................... set_timer1(0); // Internal counter reset
936 01AE: CLRF 0F
937 01AF: CLRF 0E
938 ....................
939 .................... count=((unsigned int32)of<<20)+((unsigned int32)countH<<4)+(unsigned int32)countL; // concatenate
940 01B0: CLRF 65
941 01B1: CLRF 64
942 01B2: MOVF 41,W
943 01B3: MOVWF 63
944 01B4: MOVF 40,W
945 01B5: MOVWF 62
946 01B6: MOVF 41,W
947 01B7: MOVWF 65
948 01B8: MOVF 40,W
949 01B9: MOVWF 64
950 01BA: CLRF 62
951 01BB: CLRF 63
952 01BC: RLF 64,F
953 01BD: RLF 65,F
954 01BE: RLF 64,F
955 01BF: RLF 65,F
956 01C0: RLF 64,F
957 01C1: RLF 65,F
958 01C2: RLF 64,F
959 01C3: RLF 65,F
960 01C4: MOVLW F0
961 01C5: ANDWF 64,F
962 01C6: CLRF 6A
963 01C7: CLRF 69
964 01C8: RLF 49,W
965 01C9: MOVWF 77
966 01CA: RLF 4A,W
967 01CB: MOVWF 78
968 01CC: RLF 69,W
969 01CD: MOVWF 79
970 01CE: RLF 6A,W
971 01CF: MOVWF 7A
972 01D0: RLF 77,F
973 01D1: RLF 78,F
974 01D2: RLF 79,F
975 01D3: RLF 7A,F
976 01D4: RLF 77,F
977 01D5: RLF 78,F
978 01D6: RLF 79,F
979 01D7: RLF 7A,F
980 01D8: RLF 77,F
981 01D9: RLF 78,F
982 01DA: RLF 79,F
983 01DB: RLF 7A,F
984 01DC: MOVLW F0
985 01DD: ANDWF 77,F
986 01DE: MOVF 77,W
987 01DF: ADDWF 62,F
988 01E0: MOVF 78,W
989 01E1: BTFSC 03.0
990 01E2: INCFSZ 78,W
991 01E3: ADDWF 63,F
992 01E4: MOVF 79,W
993 01E5: BTFSC 03.0
994 01E6: INCFSZ 79,W
995 01E7: ADDWF 64,F
996 01E8: MOVF 7A,W
997 01E9: BTFSC 03.0
998 01EA: INCFSZ 7A,W
999 01EB: ADDWF 65,F
1000 01EC: CLRF 78
1001 01ED: CLRF 79
1002 01EE: CLRF 7A
1003 01EF: MOVF 4B,W
1004 01F0: ADDWF 62,W
1005 01F1: MOVWF 2B
1006 01F2: MOVF 63,W
1007 01F3: MOVWF 2C
1008 01F4: MOVF 78,W
1009 01F5: BTFSC 03.0
1010 01F6: INCFSZ 78,W
1011 01F7: ADDWF 2C,F
1012 01F8: MOVF 64,W
1013 01F9: MOVWF 2D
1014 01FA: MOVF 79,W
1015 01FB: BTFSC 03.0
1016 01FC: INCFSZ 79,W
1017 01FD: ADDWF 2D,F
1018 01FE: MOVF 65,W
1019 01FF: MOVWF 2E
1020 0200: MOVF 7A,W
1021 0201: BTFSC 03.0
1022 0202: INCFSZ 7A,W
1023 0203: ADDWF 2E,F
1024 ....................
1025 .................... sprintf(countS,"%09Lu", count); // engeneering values conversion
1026 0204: CLRF 44
1027 0205: MOVLW 4C
1028 0206: MOVWF 43
1029 0207: MOVLW 49
1030 0208: MOVWF 04
1031 0209: MOVF 2E,W
1032 020A: MOVWF 65
1033 020B: MOVF 2D,W
1034 020C: MOVWF 64
1035 020D: MOVF 2C,W
1036 020E: MOVWF 63
1037 020F: MOVF 2B,W
1038 0210: MOVWF 62
1039 .................... strncpy(a, countS, 3); a[3]='\0';
1040 *
1041 027A: CLRF 63
1042 027B: MOVLW 56
1043 027C: MOVWF 62
1044 027D: CLRF 65
1045 027E: MOVLW 4C
1046 027F: MOVWF 64
1047 0280: MOVLW 03
1048 0281: MOVWF 66
1049 0282: CALL 101
1050 0283: CLRF 59
1051 .................... strncpy(b, &countS[3], 3); b[3]='\0';
1052 0284: CLRF 63
1053 0285: MOVLW 5A
1054 0286: MOVWF 62
1055 0287: CLRF 65
1056 0288: MOVLW 4F
1057 0289: MOVWF 64
1058 028A: MOVLW 03
1059 028B: MOVWF 66
1060 028C: CALL 101
1061 028D: CLRF 5D
1062 .................... strncpy(c, &countS[6], 3); c[3]='\0';
1063 028E: CLRF 63
1064 028F: MOVLW 5E
1065 0290: MOVWF 62
1066 0291: CLRF 65
1067 0292: MOVLW 52
1068 0293: MOVWF 64
1069 0294: MOVLW 03
1070 0295: MOVWF 66
1071 0296: CALL 101
1072 0297: CLRF 61
1073 ....................
1074 .................... printf("%s\r\n", countS); // output to RS232
1075 0298: MOVLW 4C
1076 0299: MOVWF 04
1077 029A: BCF 03.7
1078 *
1079 02B1: MOVLW 0D
1080 02B2: BTFSS 0C.4
1081 02B3: GOTO 2B2
1082 02B4: MOVWF 19
1083 02B5: MOVLW 0A
1084 02B6: BTFSS 0C.4
1085 02B7: GOTO 2B6
1086 02B8: MOVWF 19
1087 ....................
1088 .................... output_toggle(BEEP); // cvak...
1089 02B9: BCF 28.3
1090 02BA: MOVF 28,W
1091 02BB: BSF 03.5
1092 02BC: MOVWF 07
1093 02BD: MOVLW 08
1094 02BE: BCF 03.5
1095 02BF: XORWF 07,F
1096 ....................
1097 .................... of=0; // reset overflow counter
1098 02C0: CLRF 41
1099 02C1: CLRF 40
1100 .................... }
1101 ....................
1102 02C2: BCF 0B.1
1103 02C3: BCF 0A.3
1104 02C4: BCF 0A.4
1105 02C5: GOTO 027
1106 .................... #int_TIMER1 // Interrupf from overflow
1107 .................... void TIMER1_isr(void)
1108 .................... {
1109 .................... of++;
1110 02C6: INCF 40,F
1111 02C7: BTFSC 03.2
1112 02C8: INCF 41,F
1113 .................... }
1114 ....................
1115 ....................
1116 .................... /*#int_TIMER2 // every 10 ms
3458 kaklik 1117 .................... void TIMER2_isr(void)
1118 .................... {
1119 .................... output_low(CE);
1120 .................... count=get_timer1();
1121 .................... set_timer1(0);
1122 .................... output_high(CE);
3462 kaklik 1123 .................... }*/
3458 kaklik 1124 ....................
1125 ....................
3462 kaklik 1126 02C9: BCF 0C.0
1127 02CA: BCF 0A.3
1128 02CB: BCF 0A.4
1129 02CC: GOTO 027
3458 kaklik 1130 .................... void main()
1131 .................... {
1132 *
3462 kaklik 1133 0332: CLRF 04
1134 0333: BCF 03.7
1135 0334: MOVLW 1F
1136 0335: ANDWF 03,F
1137 0336: BSF 03.5
1138 0337: BSF 03.6
1139 0338: BSF 07.3
1140 0339: MOVLW 08
1141 033A: BCF 03.6
1142 033B: MOVWF 19
1143 033C: MOVLW 02
1144 033D: MOVWF 1A
1145 033E: MOVLW A6
1146 033F: MOVWF 18
1147 0340: MOVLW 90
1148 0341: BCF 03.5
1149 0342: MOVWF 18
1150 0343: BSF 28.3
1151 0344: MOVF 28,W
1152 0345: BSF 03.5
1153 0346: MOVWF 07
1154 0347: BCF 03.5
1155 0348: BSF 28.4
1156 0349: MOVF 28,W
1157 034A: BSF 03.5
1158 034B: MOVWF 07
1159 034C: MOVLW A0
1160 034D: MOVWF 13
1161 034E: MOVLW 36
1162 034F: BCF 03.5
1163 0350: MOVWF 14
1164 0351: CLRF 41
1165 0352: CLRF 40
1166 0353: BSF 03.5
1167 0354: BSF 03.6
1168 0355: MOVF 09,W
1169 0356: ANDLW C0
1170 0357: MOVWF 09
1171 0358: BCF 03.6
1172 0359: BCF 1F.4
1173 035A: BCF 1F.5
1174 035B: MOVLW 00
1175 035C: BSF 03.6
1176 035D: MOVWF 08
1177 035E: BCF 03.5
1178 035F: CLRF 07
1179 0360: CLRF 08
1180 0361: CLRF 09
3458 kaklik 1181 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
1182 *
3462 kaklik 1183 036C: BSF 03.5
1184 036D: BSF 03.6
1185 036E: MOVF 09,W
1186 036F: ANDLW C0
1187 0370: MOVWF 09
1188 0371: BCF 03.6
1189 0372: BCF 1F.4
1190 0373: BCF 1F.5
1191 0374: MOVLW 00
1192 0375: BSF 03.6
1193 0376: MOVWF 08
3458 kaklik 1194 .................... setup_adc(ADC_OFF);
3462 kaklik 1195 0377: BCF 03.5
1196 0378: BCF 03.6
1197 0379: BCF 1F.0
1198 .................... setup_spi(SPI_SS_DISABLED);
1199 037A: BCF 14.5
1200 037B: BCF 28.5
1201 037C: MOVF 28,W
1202 037D: BSF 03.5
1203 037E: MOVWF 07
1204 037F: BCF 03.5
1205 0380: BSF 28.4
1206 0381: MOVF 28,W
1207 0382: BSF 03.5
1208 0383: MOVWF 07
1209 0384: BCF 03.5
1210 0385: BCF 28.3
1211 0386: MOVF 28,W
1212 0387: BSF 03.5
1213 0388: MOVWF 07
1214 0389: MOVLW 01
1215 038A: BCF 03.5
1216 038B: MOVWF 14
1217 038C: MOVLW 00
1218 038D: BSF 03.5
1219 038E: MOVWF 14
3458 kaklik 1220 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
3462 kaklik 1221 038F: MOVF 01,W
1222 0390: ANDLW C7
1223 0391: IORLW 08
1224 0392: MOVWF 01
3458 kaklik 1225 .................... // setup_wdt(WDT_144MS);
1226 .................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);
3462 kaklik 1227 0393: MOVLW 07
1228 0394: BCF 03.5
1229 0395: MOVWF 10
3458 kaklik 1230 .................... setup_timer_2(T2_DIV_BY_16,196,16);
3462 kaklik 1231 0396: MOVLW 78
1232 0397: MOVWF 78
1233 0398: IORLW 06
1234 0399: MOVWF 12
1235 039A: MOVLW C4
1236 039B: BSF 03.5
1237 039C: MOVWF 12
3458 kaklik 1238 .................... setup_ccp1(CCP_OFF);
3462 kaklik 1239 039D: BCF 03.5
1240 039E: BSF 28.2
1241 039F: MOVF 28,W
1242 03A0: BSF 03.5
1243 03A1: MOVWF 07
1244 03A2: BCF 03.5
1245 03A3: CLRF 17
1246 03A4: BSF 03.5
1247 03A5: CLRF 1B
1248 03A6: CLRF 1C
1249 03A7: MOVLW 01
1250 03A8: MOVWF 1D
3458 kaklik 1251 .................... setup_comparator(NC_NC_NC_NC);
3462 kaklik 1252 03A9: BCF 03.5
1253 03AA: BSF 03.6
1254 03AB: CLRF 07
1255 03AC: CLRF 08
1256 03AD: CLRF 09
3458 kaklik 1257 .................... setup_vref(FALSE);
3462 kaklik 1258 03AE: BSF 03.5
1259 03AF: BCF 03.6
1260 03B0: CLRF 17
3458 kaklik 1261 ....................
1262 .................... delay_ms(1000);
3462 kaklik 1263 03B1: MOVLW 04
1264 03B2: BCF 03.5
1265 03B3: MOVWF 46
1266 03B4: MOVLW FA
1267 03B5: MOVWF 47
1268 03B6: GOTO 2D2
1269 03B7: DECFSZ 46,F
1270 03B8: GOTO 3B4
3458 kaklik 1271 .................... int n;
3462 kaklik 1272 .................... for (n=0;n<40;n++) putc(cmd[n]); // setup GPS
1273 03B9: CLRF 45
1274 03BA: MOVF 45,W
1275 03BB: SUBLW 27
1276 03BC: BTFSS 03.0
1277 03BD: GOTO 3C5
1278 03BE: MOVF 45,W
1279 03BF: CALL 041
1280 03C0: BTFSS 0C.4
1281 03C1: GOTO 3C0
1282 03C2: MOVWF 19
1283 03C3: INCF 45,F
1284 03C4: GOTO 3BA
3458 kaklik 1285 ....................
1286 .................... printf("cvak...\r\n");
3462 kaklik 1287 03C5: MOVLW CD
1288 03C6: BSF 03.6
1289 03C7: MOVWF 0D
1290 03C8: MOVLW 02
1291 03C9: MOVWF 0F
1292 03CA: BCF 03.6
1293 03CB: GOTO 2E8
3458 kaklik 1294 ....................
3462 kaklik 1295 .................... ext_int_edge( L_TO_H ); // set 1PPS active edge
1296 03CC: BSF 03.5
1297 03CD: BSF 01.6
1298 .................... enable_interrupts(INT_TIMER1);
1299 03CE: BSF 0C.0
1300 .................... enable_interrupts(INT_EXT);
1301 03CF: BCF 03.5
1302 03D0: BSF 0B.4
3458 kaklik 1303 .................... enable_interrupts(INT_SSP);
3462 kaklik 1304 03D1: BSF 03.5
1305 03D2: BSF 0C.3
3458 kaklik 1306 .................... // enable_interrupts(INT_TIMER2);
1307 .................... enable_interrupts(GLOBAL);
3462 kaklik 1308 03D3: MOVLW C0
1309 03D4: BCF 03.5
1310 03D5: IORWF 0B,F
3458 kaklik 1311 ....................
1312 .................... while(true)
3462 kaklik 1313 .................... {
1314 .................... /* output_high(LED);
1315 .................... delay_ms(999);
1316 .................... output_low(LED);
1317 .................... delay_ms(999);
1318 .................... printf("%X %X %X %X\r\n", buffer[0],buffer[1],buffer[2],buffer[3]);
1319 .................... */
3458 kaklik 1320 .................... }
3462 kaklik 1321 03D6: GOTO 3D6
3458 kaklik 1322 .................... }
3462 kaklik 1323 03D7: SLEEP
3458 kaklik 1324  
1325 Configuration Fuses:
1326 Word 1: 2CF2 HS NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
1327 Word 2: 3FFF NOWRT BORV40