Rev Author Line No. Line
3180 jacho 1 CCS PCM C Compiler, Version 4.106, 47914 19-7-13 17:14
3095 jacho 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 ....................
3180 jacho 249 .................... //Adresa pro VDD, VDD, VDD W 0x9E R 0x9F
250 .................... //Adresa pro GND GND GND W 0x90 R 0x91
3095 jacho 251 ....................
252 .................... void main()
253 .................... {
254 *
255 0574: CLRF 04
256 0575: BCF 03.7
257 0576: MOVLW 1F
258 0577: ANDWF 03,F
259 0578: MOVLW 71
260 0579: BSF 03.5
261 057A: MOVWF 0F
262 057B: MOVF 0F,W
263 057C: BCF 06.3
264 057D: BCF 03.5
265 057E: BSF 06.3
266 057F: BSF 03.5
267 0580: BSF 03.6
268 0581: MOVF 09,W
269 0582: ANDLW C0
270 0583: MOVWF 09
271 0584: BCF 03.6
272 0585: BCF 1F.4
273 0586: BCF 1F.5
274 0587: MOVLW 00
275 0588: BSF 03.6
276 0589: MOVWF 08
277 058A: BCF 03.5
278 058B: CLRF 07
279 058C: CLRF 08
280 058D: CLRF 09
281 ....................
282 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
283 *
284 0591: BSF 03.5
285 0592: BSF 03.6
286 0593: MOVF 09,W
287 0594: ANDLW C0
288 0595: MOVWF 09
289 0596: BCF 03.6
290 0597: BCF 1F.4
291 0598: BCF 1F.5
292 0599: MOVLW 00
293 059A: BSF 03.6
294 059B: MOVWF 08
295 .................... setup_adc(ADC_CLOCK_DIV_2);
296 059C: BCF 03.5
297 059D: BCF 03.6
298 059E: BCF 1F.6
299 059F: BCF 1F.7
300 05A0: BSF 03.5
301 05A1: BCF 1F.7
302 05A2: BCF 03.5
303 05A3: BSF 1F.0
304 .................... setup_spi(SPI_SS_DISABLED);
305 05A4: BCF 14.5
306 05A5: BCF 20.5
307 05A6: MOVF 20,W
308 05A7: BSF 03.5
309 05A8: MOVWF 07
310 05A9: BCF 03.5
311 05AA: BSF 20.4
312 05AB: MOVF 20,W
313 05AC: BSF 03.5
314 05AD: MOVWF 07
315 05AE: BCF 03.5
316 05AF: BCF 20.3
317 05B0: MOVF 20,W
318 05B1: BSF 03.5
319 05B2: MOVWF 07
320 05B3: MOVLW 01
321 05B4: BCF 03.5
322 05B5: MOVWF 14
323 05B6: MOVLW 00
324 05B7: BSF 03.5
325 05B8: MOVWF 14
326 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
327 05B9: MOVF 01,W
328 05BA: ANDLW C7
329 05BB: IORLW 08
330 05BC: MOVWF 01
331 .................... setup_timer_1(T1_DISABLED);
332 05BD: BCF 03.5
333 05BE: CLRF 10
334 .................... setup_timer_2(T2_DISABLED,0,1);
335 05BF: MOVLW 00
336 05C0: MOVWF 78
337 05C1: MOVWF 12
338 05C2: MOVLW 00
339 05C3: BSF 03.5
340 05C4: MOVWF 12
341 .................... setup_ccp1(CCP_OFF);
342 05C5: BCF 03.5
343 05C6: BSF 20.2
344 05C7: MOVF 20,W
345 05C8: BSF 03.5
346 05C9: MOVWF 07
347 05CA: BCF 03.5
348 05CB: CLRF 17
349 05CC: BSF 03.5
350 05CD: CLRF 1B
351 05CE: CLRF 1C
352 05CF: MOVLW 01
353 05D0: MOVWF 1D
354 .................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
355 05D1: BCF 03.5
356 05D2: BSF 03.6
357 05D3: CLRF 07
358 05D4: CLRF 08
359 05D5: CLRF 09
360 ....................
361 .................... printf("Simple Thermomether \r\n",);
362 05D6: MOVLW 04
363 05D7: MOVWF 0D
364 05D8: MOVLW 00
365 05D9: MOVWF 0F
366 05DA: BCF 03.6
367 05DB: CALL 047
368 .................... printf("(c) MLAB 2013 JACHO \r\n",);
369 05DC: MOVLW 10
370 05DD: BSF 03.6
371 05DE: MOVWF 0D
372 05DF: MOVLW 00
373 05E0: MOVWF 0F
374 05E1: BCF 03.6
375 05E2: CALL 047
376 ....................
377 .................... signed int8 MSB;
378 .................... byte LSB;
379 .................... float t;
380 ....................
381 .................... while(TRUE)
382 .................... {
383 ....................
384 ....................
385 ....................
386 .................... i2c_start();
387 05E3: BSF 20.3
388 05E4: MOVF 20,W
389 05E5: BSF 03.5
390 05E6: MOVWF 07
391 05E7: NOP
392 05E8: BCF 03.5
393 05E9: BSF 20.4
394 05EA: MOVF 20,W
395 05EB: BSF 03.5
396 05EC: MOVWF 07
397 05ED: NOP
398 05EE: BCF 03.5
399 05EF: BCF 07.3
400 05F0: BCF 20.3
401 05F1: MOVF 20,W
402 05F2: BSF 03.5
403 05F3: MOVWF 07
404 05F4: NOP
405 05F5: BCF 03.5
406 05F6: BCF 07.4
407 05F7: BCF 20.4
408 05F8: MOVF 20,W
409 05F9: BSF 03.5
410 05FA: MOVWF 07
3180 jacho 411 .................... I2C_Write(0x90);
412 05FB: MOVLW 90
3095 jacho 413 05FC: BCF 03.5
414 05FD: MOVWF 27
415 05FE: CALL 08D
416 .................... I2C_write(0x00);
417 05FF: CLRF 27
418 0600: CALL 08D
419 .................... i2c_stop();
420 0601: BCF 20.3
421 0602: MOVF 20,W
422 0603: BSF 03.5
423 0604: MOVWF 07
424 0605: NOP
425 0606: BCF 03.5
426 0607: BSF 20.4
427 0608: MOVF 20,W
428 0609: BSF 03.5
429 060A: MOVWF 07
430 060B: BCF 03.5
431 060C: BTFSS 07.4
432 060D: GOTO 60C
433 060E: NOP
434 060F: GOTO 610
435 0610: NOP
436 0611: BSF 20.3
437 0612: MOVF 20,W
438 0613: BSF 03.5
439 0614: MOVWF 07
440 0615: NOP
441 .................... i2c_start();
442 0616: BCF 03.5
443 0617: BSF 20.3
444 0618: MOVF 20,W
445 0619: BSF 03.5
446 061A: MOVWF 07
447 061B: NOP
448 061C: BCF 03.5
449 061D: BSF 20.4
450 061E: MOVF 20,W
451 061F: BSF 03.5
452 0620: MOVWF 07
453 0621: NOP
454 0622: BCF 03.5
455 0623: BCF 07.3
456 0624: BCF 20.3
457 0625: MOVF 20,W
458 0626: BSF 03.5
459 0627: MOVWF 07
460 0628: NOP
461 0629: BCF 03.5
462 062A: BCF 07.4
463 062B: BCF 20.4
464 062C: MOVF 20,W
465 062D: BSF 03.5
466 062E: MOVWF 07
3180 jacho 467 .................... I2C_Write(0x91);
468 062F: MOVLW 91
3095 jacho 469 0630: BCF 03.5
470 0631: MOVWF 27
471 0632: CALL 08D
472 .................... MSB=i2c_read(1);
473 0633: MOVLW 01
474 0634: MOVWF 77
475 0635: CALL 0D7
476 0636: MOVF 78,W
477 0637: MOVWF 21
478 .................... LSB=i2c_read(0);
479 0638: CLRF 77
480 0639: CALL 0D7
481 063A: MOVF 78,W
482 063B: MOVWF 22
483 .................... i2c_stop();
484 063C: BCF 20.3
485 063D: MOVF 20,W
486 063E: BSF 03.5
487 063F: MOVWF 07
488 0640: NOP
489 0641: BCF 03.5
490 0642: BSF 20.4
491 0643: MOVF 20,W
492 0644: BSF 03.5
493 0645: MOVWF 07
494 0646: BCF 03.5
495 0647: BTFSS 07.4
496 0648: GOTO 647
497 0649: NOP
498 064A: GOTO 64B
499 064B: NOP
500 064C: BSF 20.3
501 064D: MOVF 20,W
502 064E: BSF 03.5
503 064F: MOVWF 07
504 0650: NOP
505 ....................
506 .................... t = (float)(LSB)/256.0;
507 0651: BCF 03.5
508 0652: CLRF 28
509 0653: MOVF 22,W
510 0654: MOVWF 27
511 0655: GOTO 11C
512 0656: MOVF 77,W
513 0657: MOVWF 27
514 0658: MOVF 78,W
515 0659: MOVWF 28
516 065A: MOVF 79,W
517 065B: MOVWF 29
518 065C: MOVF 7A,W
519 065D: MOVWF 2A
520 065E: MOVWF 2E
521 065F: MOVF 79,W
522 0660: MOVWF 2D
523 0661: MOVF 78,W
524 0662: MOVWF 2C
525 0663: MOVF 77,W
526 0664: MOVWF 2B
527 0665: CLRF 32
528 0666: CLRF 31
529 0667: CLRF 30
530 0668: MOVLW 87
531 0669: MOVWF 2F
532 066A: GOTO 13B
533 066B: MOVF 7A,W
534 066C: MOVWF 26
535 066D: MOVF 79,W
536 066E: MOVWF 25
537 066F: MOVF 78,W
538 0670: MOVWF 24
539 0671: MOVF 77,W
540 0672: MOVWF 23
541 .................... t = (float)(MSB+t);
542 0673: CLRF 29
543 0674: MOVF 21,W
544 0675: MOVWF 28
545 0676: BTFSC 28.7
546 0677: DECF 29,F
547 0678: GOTO 207
548 0679: BCF 03.1
549 067A: MOVF 7A,W
550 067B: MOVWF 2B
551 067C: MOVF 79,W
552 067D: MOVWF 2A
553 067E: MOVF 78,W
554 067F: MOVWF 29
555 0680: MOVF 77,W
556 0681: MOVWF 28
557 0682: MOVF 26,W
558 0683: MOVWF 2F
559 0684: MOVF 25,W
560 0685: MOVWF 2E
561 0686: MOVF 24,W
562 0687: MOVWF 2D
563 0688: MOVF 23,W
564 0689: MOVWF 2C
565 068A: GOTO 22E
566 068B: MOVF 7A,W
567 068C: MOVWF 26
568 068D: MOVF 79,W
569 068E: MOVWF 25
570 068F: MOVF 78,W
571 0690: MOVWF 24
572 0691: MOVF 77,W
573 0692: MOVWF 23
574 ....................
575 .................... printf("Teplota: %f (C)\r\n", t);
576 0693: MOVLW 1C
577 0694: BSF 03.6
578 0695: MOVWF 0D
579 0696: MOVLW 00
580 0697: MOVWF 0F
581 0698: BCF 03.0
582 0699: MOVLW 09
583 069A: BCF 03.6
584 069B: MOVWF 27
585 069C: CALL 371
586 069D: MOVLW 89
587 069E: MOVWF 04
588 069F: MOVF 26,W
589 06A0: MOVWF 2A
590 06A1: MOVF 25,W
591 06A2: MOVWF 29
592 06A3: MOVF 24,W
593 06A4: MOVWF 28
594 06A5: MOVF 23,W
595 06A6: MOVWF 27
596 06A7: MOVLW 02
597 06A8: MOVWF 2B
598 06A9: GOTO 402
599 06AA: MOVLW 21
600 06AB: BSF 03.6
601 06AC: MOVWF 0D
602 06AD: MOVLW 00
603 06AE: MOVWF 0F
604 06AF: BSF 03.0
605 06B0: MOVLW 06
606 06B1: BCF 03.6
607 06B2: MOVWF 27
608 06B3: CALL 371
609 .................... delay_ms(500);
610 06B4: MOVLW 02
611 06B5: MOVWF 27
612 06B6: MOVLW FA
613 06B7: MOVWF 28
614 06B8: GOTO 55E
615 06B9: DECFSZ 27,F
616 06BA: GOTO 6B6
617 .................... }
618 06BB: GOTO 5E3
619 .................... }
620 ....................
621 06BC: SLEEP
622  
623 Configuration Fuses:
624 Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
625 Word 2: 3FFF NOWRT BORV40