Rev Author Line No. Line
3095 jacho 1 CCS PCM C Compiler, Version 4.106, 47914 29-6-13 22:36
2  
3 Filename: D:\Honza\MLAB\Modules\Sensors\LTS01A\SW\PIC16F887\main.lst
4  
5 ROM used: 1725 words (21%)
6 Largest free fragment is 2048
7 RAM used: 10 (3%) at main() level
8 38 (10%) worst case
9 Stack: 2 locations
10  
11 *
12 0000: MOVLW 05
13 0001: MOVWF 0A
14 0002: GOTO 574
15 0003: NOP
16 .................... #include "D:\Honza\MLAB\Modules\Sensors\LTS01A\SW\PIC16F887\main.h"
17 .................... #include <16F887.h>
18 .................... //////// Standard Header file for the PIC16F887 device ////////////////
19 .................... #device PIC16F887
20 .................... #list
21 ....................
22 .................... #device adc=8
23 ....................
24 .................... #FUSES NOWDT //No Watch Dog Timer
25 .................... #FUSES INTRC //Internal RC Osc
26 .................... #FUSES NOPUT //No Power Up Timer
27 .................... #FUSES MCLR //Master Clear pin enabled
28 .................... #FUSES NOPROTECT //Code not protected from reading
29 .................... #FUSES NOCPD //No EE protection
30 .................... #FUSES NOBROWNOUT //No brownout reset
31 .................... #FUSES IESO //Internal External Switch Over mode enabled
32 .................... #FUSES FCMEN //Fail-safe clock monitor enabled
33 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
34 .................... #FUSES NODEBUG //No Debug mode for ICD
35 .................... #FUSES NOWRT //Program memory not write protected
36 .................... #FUSES BORV40 //Brownout reset at 4.0V
37 ....................
38 .................... #use delay(clock=8000000)
39 *
40 055E: MOVLW 28
41 055F: MOVWF 04
42 0560: BCF 03.7
43 0561: MOVF 00,W
44 0562: BTFSC 03.2
45 0563: GOTO 571
46 0564: MOVLW 02
47 0565: MOVWF 78
48 0566: CLRF 77
49 0567: DECFSZ 77,F
50 0568: GOTO 567
51 0569: DECFSZ 78,F
52 056A: GOTO 566
53 056B: MOVLW 97
54 056C: MOVWF 77
55 056D: DECFSZ 77,F
56 056E: GOTO 56D
57 056F: DECFSZ 00,F
58 0570: GOTO 564
59 0571: BCF 0A.3
60 0572: BCF 0A.4
61 0573: GOTO 6B9 (RETURN)
62 ....................
63 ....................
64 ....................
65 .................... #define S_SDA PIN_C3
66 .................... #define S_SCL PIN_C4
67 .................... #use i2c(master, sda=S_SDA, scl=S_SCL)
68 *
69 008D: MOVLW 08
70 008E: MOVWF 78
71 008F: NOP
72 0090: BCF 07.4
73 0091: BCF 20.4
74 0092: MOVF 20,W
75 0093: BSF 03.5
76 0094: MOVWF 07
77 0095: NOP
78 0096: BCF 03.5
79 0097: RLF 27,F
80 0098: BCF 07.3
81 0099: BTFSS 03.0
82 009A: GOTO 0A1
83 009B: BSF 20.3
84 009C: MOVF 20,W
85 009D: BSF 03.5
86 009E: MOVWF 07
87 009F: GOTO 0A5
88 00A0: BCF 03.5
89 00A1: BCF 20.3
90 00A2: MOVF 20,W
91 00A3: BSF 03.5
92 00A4: MOVWF 07
93 00A5: NOP
94 00A6: BCF 03.5
95 00A7: BSF 20.4
96 00A8: MOVF 20,W
97 00A9: BSF 03.5
98 00AA: MOVWF 07
99 00AB: BCF 03.5
100 00AC: BTFSS 07.4
101 00AD: GOTO 0AC
102 00AE: DECFSZ 78,F
103 00AF: GOTO 08F
104 00B0: NOP
105 00B1: BCF 07.4
106 00B2: BCF 20.4
107 00B3: MOVF 20,W
108 00B4: BSF 03.5
109 00B5: MOVWF 07
110 00B6: NOP
111 00B7: BCF 03.5
112 00B8: BSF 20.3
113 00B9: MOVF 20,W
114 00BA: BSF 03.5
115 00BB: MOVWF 07
116 00BC: NOP
117 00BD: NOP
118 00BE: BCF 03.5
119 00BF: BSF 20.4
120 00C0: MOVF 20,W
121 00C1: BSF 03.5
122 00C2: MOVWF 07
123 00C3: BCF 03.5
124 00C4: BTFSS 07.4
125 00C5: GOTO 0C4
126 00C6: CLRF 78
127 00C7: NOP
128 00C8: BTFSC 07.3
129 00C9: BSF 78.0
130 00CA: BCF 07.4
131 00CB: BCF 20.4
132 00CC: MOVF 20,W
133 00CD: BSF 03.5
134 00CE: MOVWF 07
135 00CF: BCF 03.5
136 00D0: BCF 07.3
137 00D1: BCF 20.3
138 00D2: MOVF 20,W
139 00D3: BSF 03.5
140 00D4: MOVWF 07
141 00D5: BCF 03.5
142 00D6: RETURN
143 00D7: MOVLW 08
144 00D8: MOVWF 28
145 00D9: MOVF 77,W
146 00DA: MOVWF 29
147 00DB: BSF 20.3
148 00DC: MOVF 20,W
149 00DD: BSF 03.5
150 00DE: MOVWF 07
151 00DF: NOP
152 00E0: BCF 03.5
153 00E1: BSF 20.4
154 00E2: MOVF 20,W
155 00E3: BSF 03.5
156 00E4: MOVWF 07
157 00E5: BCF 03.5
158 00E6: BTFSS 07.4
159 00E7: GOTO 0E6
160 00E8: BTFSC 07.3
161 00E9: BSF 03.0
162 00EA: BTFSS 07.3
163 00EB: BCF 03.0
164 00EC: RLF 78,F
165 00ED: NOP
166 00EE: BCF 20.4
167 00EF: MOVF 20,W
168 00F0: BSF 03.5
169 00F1: MOVWF 07
170 00F2: BCF 03.5
171 00F3: BCF 07.4
172 00F4: DECFSZ 28,F
173 00F5: GOTO 0DB
174 00F6: BSF 20.3
175 00F7: MOVF 20,W
176 00F8: BSF 03.5
177 00F9: MOVWF 07
178 00FA: NOP
179 00FB: BCF 03.5
180 00FC: BCF 07.3
181 00FD: MOVF 29,W
182 00FE: BTFSC 03.2
183 00FF: GOTO 105
184 0100: BCF 20.3
185 0101: MOVF 20,W
186 0102: BSF 03.5
187 0103: MOVWF 07
188 0104: BCF 03.5
189 0105: NOP
190 0106: BSF 20.4
191 0107: MOVF 20,W
192 0108: BSF 03.5
193 0109: MOVWF 07
194 010A: BCF 03.5
195 010B: BTFSS 07.4
196 010C: GOTO 10B
197 010D: NOP
198 010E: BCF 07.4
199 010F: BCF 20.4
200 0110: MOVF 20,W
201 0111: BSF 03.5
202 0112: MOVWF 07
203 0113: NOP
204 0114: BCF 03.5
205 0115: BCF 07.3
206 0116: BCF 20.3
207 0117: MOVF 20,W
208 0118: BSF 03.5
209 0119: MOVWF 07
210 011A: BCF 03.5
211 011B: RETURN
212 .................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD
213 *
214 0025: BSF 03.5
215 0026: BCF 06.3
216 0027: BCF 03.5
217 0028: BCF 06.3
218 0029: MOVLW 08
219 002A: MOVWF 78
220 002B: GOTO 02C
221 002C: NOP
222 002D: BSF 78.7
223 002E: GOTO 03D
224 002F: BCF 78.7
225 0030: RRF 34,F
226 0031: BTFSC 03.0
227 0032: BSF 06.3
228 0033: BTFSS 03.0
229 0034: BCF 06.3
230 0035: BSF 78.6
231 0036: GOTO 03D
232 0037: BCF 78.6
233 0038: DECFSZ 78,F
234 0039: GOTO 030
235 003A: GOTO 03B
236 003B: NOP
237 003C: BSF 06.3
238 003D: MOVLW 3F
239 003E: MOVWF 04
240 003F: DECFSZ 04,F
241 0040: GOTO 03F
242 0041: NOP
243 0042: BTFSC 78.7
244 0043: GOTO 02F
245 0044: BTFSC 78.6
246 0045: GOTO 037
247 0046: RETURN
248 ....................
249 ....................
250 .................... void main()
251 .................... {
252 *
253 0574: CLRF 04
254 0575: BCF 03.7
255 0576: MOVLW 1F
256 0577: ANDWF 03,F
257 0578: MOVLW 71
258 0579: BSF 03.5
259 057A: MOVWF 0F
260 057B: MOVF 0F,W
261 057C: BCF 06.3
262 057D: BCF 03.5
263 057E: BSF 06.3
264 057F: BSF 03.5
265 0580: BSF 03.6
266 0581: MOVF 09,W
267 0582: ANDLW C0
268 0583: MOVWF 09
269 0584: BCF 03.6
270 0585: BCF 1F.4
271 0586: BCF 1F.5
272 0587: MOVLW 00
273 0588: BSF 03.6
274 0589: MOVWF 08
275 058A: BCF 03.5
276 058B: CLRF 07
277 058C: CLRF 08
278 058D: CLRF 09
279 ....................
280 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
281 *
282 0591: BSF 03.5
283 0592: BSF 03.6
284 0593: MOVF 09,W
285 0594: ANDLW C0
286 0595: MOVWF 09
287 0596: BCF 03.6
288 0597: BCF 1F.4
289 0598: BCF 1F.5
290 0599: MOVLW 00
291 059A: BSF 03.6
292 059B: MOVWF 08
293 .................... setup_adc(ADC_CLOCK_DIV_2);
294 059C: BCF 03.5
295 059D: BCF 03.6
296 059E: BCF 1F.6
297 059F: BCF 1F.7
298 05A0: BSF 03.5
299 05A1: BCF 1F.7
300 05A2: BCF 03.5
301 05A3: BSF 1F.0
302 .................... setup_spi(SPI_SS_DISABLED);
303 05A4: BCF 14.5
304 05A5: BCF 20.5
305 05A6: MOVF 20,W
306 05A7: BSF 03.5
307 05A8: MOVWF 07
308 05A9: BCF 03.5
309 05AA: BSF 20.4
310 05AB: MOVF 20,W
311 05AC: BSF 03.5
312 05AD: MOVWF 07
313 05AE: BCF 03.5
314 05AF: BCF 20.3
315 05B0: MOVF 20,W
316 05B1: BSF 03.5
317 05B2: MOVWF 07
318 05B3: MOVLW 01
319 05B4: BCF 03.5
320 05B5: MOVWF 14
321 05B6: MOVLW 00
322 05B7: BSF 03.5
323 05B8: MOVWF 14
324 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
325 05B9: MOVF 01,W
326 05BA: ANDLW C7
327 05BB: IORLW 08
328 05BC: MOVWF 01
329 .................... setup_timer_1(T1_DISABLED);
330 05BD: BCF 03.5
331 05BE: CLRF 10
332 .................... setup_timer_2(T2_DISABLED,0,1);
333 05BF: MOVLW 00
334 05C0: MOVWF 78
335 05C1: MOVWF 12
336 05C2: MOVLW 00
337 05C3: BSF 03.5
338 05C4: MOVWF 12
339 .................... setup_ccp1(CCP_OFF);
340 05C5: BCF 03.5
341 05C6: BSF 20.2
342 05C7: MOVF 20,W
343 05C8: BSF 03.5
344 05C9: MOVWF 07
345 05CA: BCF 03.5
346 05CB: CLRF 17
347 05CC: BSF 03.5
348 05CD: CLRF 1B
349 05CE: CLRF 1C
350 05CF: MOVLW 01
351 05D0: MOVWF 1D
352 .................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
353 05D1: BCF 03.5
354 05D2: BSF 03.6
355 05D3: CLRF 07
356 05D4: CLRF 08
357 05D5: CLRF 09
358 ....................
359 .................... printf("Simple Thermomether \r\n",);
360 05D6: MOVLW 04
361 05D7: MOVWF 0D
362 05D8: MOVLW 00
363 05D9: MOVWF 0F
364 05DA: BCF 03.6
365 05DB: CALL 047
366 .................... printf("(c) MLAB 2013 JACHO \r\n",);
367 05DC: MOVLW 10
368 05DD: BSF 03.6
369 05DE: MOVWF 0D
370 05DF: MOVLW 00
371 05E0: MOVWF 0F
372 05E1: BCF 03.6
373 05E2: CALL 047
374 ....................
375 .................... signed int8 MSB;
376 .................... byte LSB;
377 .................... float t;
378 ....................
379 .................... while(TRUE)
380 .................... {
381 ....................
382 ....................
383 ....................
384 .................... i2c_start();
385 05E3: BSF 20.3
386 05E4: MOVF 20,W
387 05E5: BSF 03.5
388 05E6: MOVWF 07
389 05E7: NOP
390 05E8: BCF 03.5
391 05E9: BSF 20.4
392 05EA: MOVF 20,W
393 05EB: BSF 03.5
394 05EC: MOVWF 07
395 05ED: NOP
396 05EE: BCF 03.5
397 05EF: BCF 07.3
398 05F0: BCF 20.3
399 05F1: MOVF 20,W
400 05F2: BSF 03.5
401 05F3: MOVWF 07
402 05F4: NOP
403 05F5: BCF 03.5
404 05F6: BCF 07.4
405 05F7: BCF 20.4
406 05F8: MOVF 20,W
407 05F9: BSF 03.5
408 05FA: MOVWF 07
409 .................... I2C_Write(0x9E);
410 05FB: MOVLW 9E
411 05FC: BCF 03.5
412 05FD: MOVWF 27
413 05FE: CALL 08D
414 .................... I2C_write(0x00);
415 05FF: CLRF 27
416 0600: CALL 08D
417 .................... i2c_stop();
418 0601: BCF 20.3
419 0602: MOVF 20,W
420 0603: BSF 03.5
421 0604: MOVWF 07
422 0605: NOP
423 0606: BCF 03.5
424 0607: BSF 20.4
425 0608: MOVF 20,W
426 0609: BSF 03.5
427 060A: MOVWF 07
428 060B: BCF 03.5
429 060C: BTFSS 07.4
430 060D: GOTO 60C
431 060E: NOP
432 060F: GOTO 610
433 0610: NOP
434 0611: BSF 20.3
435 0612: MOVF 20,W
436 0613: BSF 03.5
437 0614: MOVWF 07
438 0615: NOP
439 .................... i2c_start();
440 0616: BCF 03.5
441 0617: BSF 20.3
442 0618: MOVF 20,W
443 0619: BSF 03.5
444 061A: MOVWF 07
445 061B: NOP
446 061C: BCF 03.5
447 061D: BSF 20.4
448 061E: MOVF 20,W
449 061F: BSF 03.5
450 0620: MOVWF 07
451 0621: NOP
452 0622: BCF 03.5
453 0623: BCF 07.3
454 0624: BCF 20.3
455 0625: MOVF 20,W
456 0626: BSF 03.5
457 0627: MOVWF 07
458 0628: NOP
459 0629: BCF 03.5
460 062A: BCF 07.4
461 062B: BCF 20.4
462 062C: MOVF 20,W
463 062D: BSF 03.5
464 062E: MOVWF 07
465 .................... I2C_Write(0x9F);
466 062F: MOVLW 9F
467 0630: BCF 03.5
468 0631: MOVWF 27
469 0632: CALL 08D
470 .................... MSB=i2c_read(1);
471 0633: MOVLW 01
472 0634: MOVWF 77
473 0635: CALL 0D7
474 0636: MOVF 78,W
475 0637: MOVWF 21
476 .................... LSB=i2c_read(0);
477 0638: CLRF 77
478 0639: CALL 0D7
479 063A: MOVF 78,W
480 063B: MOVWF 22
481 .................... i2c_stop();
482 063C: BCF 20.3
483 063D: MOVF 20,W
484 063E: BSF 03.5
485 063F: MOVWF 07
486 0640: NOP
487 0641: BCF 03.5
488 0642: BSF 20.4
489 0643: MOVF 20,W
490 0644: BSF 03.5
491 0645: MOVWF 07
492 0646: BCF 03.5
493 0647: BTFSS 07.4
494 0648: GOTO 647
495 0649: NOP
496 064A: GOTO 64B
497 064B: NOP
498 064C: BSF 20.3
499 064D: MOVF 20,W
500 064E: BSF 03.5
501 064F: MOVWF 07
502 0650: NOP
503 ....................
504 .................... t = (float)(LSB)/256.0;
505 0651: BCF 03.5
506 0652: CLRF 28
507 0653: MOVF 22,W
508 0654: MOVWF 27
509 0655: GOTO 11C
510 0656: MOVF 77,W
511 0657: MOVWF 27
512 0658: MOVF 78,W
513 0659: MOVWF 28
514 065A: MOVF 79,W
515 065B: MOVWF 29
516 065C: MOVF 7A,W
517 065D: MOVWF 2A
518 065E: MOVWF 2E
519 065F: MOVF 79,W
520 0660: MOVWF 2D
521 0661: MOVF 78,W
522 0662: MOVWF 2C
523 0663: MOVF 77,W
524 0664: MOVWF 2B
525 0665: CLRF 32
526 0666: CLRF 31
527 0667: CLRF 30
528 0668: MOVLW 87
529 0669: MOVWF 2F
530 066A: GOTO 13B
531 066B: MOVF 7A,W
532 066C: MOVWF 26
533 066D: MOVF 79,W
534 066E: MOVWF 25
535 066F: MOVF 78,W
536 0670: MOVWF 24
537 0671: MOVF 77,W
538 0672: MOVWF 23
539 .................... t = (float)(MSB+t);
540 0673: CLRF 29
541 0674: MOVF 21,W
542 0675: MOVWF 28
543 0676: BTFSC 28.7
544 0677: DECF 29,F
545 0678: GOTO 207
546 0679: BCF 03.1
547 067A: MOVF 7A,W
548 067B: MOVWF 2B
549 067C: MOVF 79,W
550 067D: MOVWF 2A
551 067E: MOVF 78,W
552 067F: MOVWF 29
553 0680: MOVF 77,W
554 0681: MOVWF 28
555 0682: MOVF 26,W
556 0683: MOVWF 2F
557 0684: MOVF 25,W
558 0685: MOVWF 2E
559 0686: MOVF 24,W
560 0687: MOVWF 2D
561 0688: MOVF 23,W
562 0689: MOVWF 2C
563 068A: GOTO 22E
564 068B: MOVF 7A,W
565 068C: MOVWF 26
566 068D: MOVF 79,W
567 068E: MOVWF 25
568 068F: MOVF 78,W
569 0690: MOVWF 24
570 0691: MOVF 77,W
571 0692: MOVWF 23
572 ....................
573 .................... printf("Teplota: %f (C)\r\n", t);
574 0693: MOVLW 1C
575 0694: BSF 03.6
576 0695: MOVWF 0D
577 0696: MOVLW 00
578 0697: MOVWF 0F
579 0698: BCF 03.0
580 0699: MOVLW 09
581 069A: BCF 03.6
582 069B: MOVWF 27
583 069C: CALL 371
584 069D: MOVLW 89
585 069E: MOVWF 04
586 069F: MOVF 26,W
587 06A0: MOVWF 2A
588 06A1: MOVF 25,W
589 06A2: MOVWF 29
590 06A3: MOVF 24,W
591 06A4: MOVWF 28
592 06A5: MOVF 23,W
593 06A6: MOVWF 27
594 06A7: MOVLW 02
595 06A8: MOVWF 2B
596 06A9: GOTO 402
597 06AA: MOVLW 21
598 06AB: BSF 03.6
599 06AC: MOVWF 0D
600 06AD: MOVLW 00
601 06AE: MOVWF 0F
602 06AF: BSF 03.0
603 06B0: MOVLW 06
604 06B1: BCF 03.6
605 06B2: MOVWF 27
606 06B3: CALL 371
607 .................... delay_ms(500);
608 06B4: MOVLW 02
609 06B5: MOVWF 27
610 06B6: MOVLW FA
611 06B7: MOVWF 28
612 06B8: GOTO 55E
613 06B9: DECFSZ 27,F
614 06BA: GOTO 6B6
615 .................... }
616 06BB: GOTO 5E3
617 .................... }
618 ....................
619 06BC: SLEEP
620  
621 Configuration Fuses:
622 Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
623 Word 2: 3FFF NOWRT BORV40