Rev Author Line No. Line
1045 jacho 1 CCS PCM C Compiler, Version 4.106, 47914 03-4-13 09:45
2  
3 Filename: C:\Users\Honza\Documents\pic\I2C_vlhkost\main.lst
4  
5 ROM used: 1019 words (12%)
6 Largest free fragment is 2048
7 RAM used: 8 (2%) at main() level
8 29 (8%) worst case
9 Stack: 2 locations
10  
11 *
12 0000: MOVLW 02
13 0001: MOVWF 0A
14 0002: GOTO 263
15 0003: NOP
16 .................... #include "C:\Users\Honza\Documents\pic\I2C_vlhkost\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 024D: MOVLW 2F
41 024E: MOVWF 04
42 024F: BCF 03.7
43 0250: MOVF 00,W
44 0251: BTFSC 03.2
45 0252: GOTO 260
46 0253: MOVLW 02
47 0254: MOVWF 78
48 0255: CLRF 77
49 0256: DECFSZ 77,F
50 0257: GOTO 256
51 0258: DECFSZ 78,F
52 0259: GOTO 255
53 025A: MOVLW 97
54 025B: MOVWF 77
55 025C: DECFSZ 77,F
56 025D: GOTO 25C
57 025E: DECFSZ 00,F
58 025F: GOTO 253
59 0260: BCF 0A.3
60 0261: BCF 0A.4
61 0262: GOTO 3F7 (RETURN)
62 ....................
63 ....................
64 ....................
65 .................... #define EEPROM_SDA PIN_B0
66 .................... #define EEPROM_SCL PIN_B1
67 .................... #use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL)
68 *
69 009B: MOVLW 08
70 009C: MOVWF 78
71 009D: NOP
72 009E: BCF 06.1
73 009F: BSF 03.5
74 00A0: BCF 06.1
75 00A1: NOP
76 00A2: BCF 03.5
77 00A3: RLF 2E,F
78 00A4: BCF 06.0
79 00A5: BTFSS 03.0
80 00A6: GOTO 0AA
81 00A7: BSF 03.5
82 00A8: BSF 06.0
83 00A9: BCF 03.5
84 00AA: BTFSC 03.0
85 00AB: GOTO 0AF
86 00AC: BSF 03.5
87 00AD: BCF 06.0
88 00AE: BCF 03.5
89 00AF: BSF 03.5
90 00B0: BSF 06.1
91 00B1: BCF 03.5
92 00B2: BTFSS 06.1
93 00B3: GOTO 0B2
94 00B4: DECFSZ 78,F
95 00B5: GOTO 09D
96 00B6: NOP
97 00B7: BCF 06.1
98 00B8: BSF 03.5
99 00B9: BCF 06.1
100 00BA: NOP
101 00BB: BSF 06.0
102 00BC: NOP
103 00BD: NOP
104 00BE: BSF 06.1
105 00BF: BCF 03.5
106 00C0: BTFSS 06.1
107 00C1: GOTO 0C0
108 00C2: CLRF 78
109 00C3: NOP
110 00C4: BTFSC 06.0
111 00C5: BSF 78.0
112 00C6: BCF 06.1
113 00C7: BSF 03.5
114 00C8: BCF 06.1
115 00C9: BCF 03.5
116 00CA: BCF 06.0
117 00CB: BSF 03.5
118 00CC: BCF 06.0
119 00CD: BCF 03.5
120 00CE: RETURN
121 00CF: MOVLW 08
122 00D0: MOVWF 2F
123 00D1: MOVF 77,W
124 00D2: MOVWF 30
125 00D3: BSF 03.5
126 00D4: BSF 06.0
127 00D5: NOP
128 00D6: BSF 06.1
129 00D7: BCF 03.5
130 00D8: BTFSS 06.1
131 00D9: GOTO 0D8
132 00DA: BTFSC 06.0
133 00DB: BSF 03.0
134 00DC: BTFSS 06.0
135 00DD: BCF 03.0
136 00DE: RLF 78,F
137 00DF: NOP
138 00E0: BSF 03.5
139 00E1: BCF 06.1
140 00E2: BCF 03.5
141 00E3: BCF 06.1
142 00E4: DECFSZ 2F,F
143 00E5: GOTO 0D3
144 00E6: BSF 03.5
145 00E7: BSF 06.0
146 00E8: NOP
147 00E9: BCF 03.5
148 00EA: BCF 06.0
149 00EB: MOVF 30,W
150 00EC: BTFSC 03.2
151 00ED: GOTO 0F1
152 00EE: BSF 03.5
153 00EF: BCF 06.0
154 00F0: BCF 03.5
155 00F1: NOP
156 00F2: BSF 03.5
157 00F3: BSF 06.1
158 00F4: BCF 03.5
159 00F5: BTFSS 06.1
160 00F6: GOTO 0F5
161 00F7: NOP
162 00F8: BCF 06.1
163 00F9: BSF 03.5
164 00FA: BCF 06.1
165 00FB: NOP
166 00FC: BCF 03.5
167 00FD: BCF 06.0
168 00FE: BSF 03.5
169 00FF: BCF 06.0
170 0100: BCF 03.5
171 0101: RETURN
172 .................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD
173 *
174 0031: BSF 03.5
175 0032: BCF 06.3
176 0033: BCF 03.5
177 0034: BCF 06.3
178 0035: MOVLW 08
179 0036: MOVWF 78
180 0037: GOTO 038
181 0038: NOP
182 0039: BSF 78.7
183 003A: GOTO 049
184 003B: BCF 78.7
185 003C: RRF 37,F
186 003D: BTFSC 03.0
187 003E: BSF 06.3
188 003F: BTFSS 03.0
189 0040: BCF 06.3
190 0041: BSF 78.6
191 0042: GOTO 049
192 0043: BCF 78.6
193 0044: DECFSZ 78,F
194 0045: GOTO 03C
195 0046: GOTO 047
196 0047: NOP
197 0048: BSF 06.3
198 0049: MOVLW 3F
199 004A: MOVWF 04
200 004B: DECFSZ 04,F
201 004C: GOTO 04B
202 004D: NOP
203 004E: BTFSC 78.7
204 004F: GOTO 03B
205 0050: BTFSC 78.6
206 0051: GOTO 043
207 0052: RETURN
208 ....................
209 ....................
210 .................... void main()
211 .................... {
212 *
213 0263: CLRF 04
214 0264: BCF 03.7
215 0265: MOVLW 1F
216 0266: ANDWF 03,F
217 0267: MOVLW 71
218 0268: BSF 03.5
219 0269: MOVWF 0F
220 026A: MOVF 0F,W
221 026B: BCF 06.3
222 026C: BCF 03.5
223 026D: BSF 06.3
224 026E: BSF 03.5
225 026F: BSF 03.6
226 0270: MOVF 09,W
227 0271: ANDLW C0
228 0272: MOVWF 09
229 0273: BCF 03.6
230 0274: BCF 1F.4
231 0275: BCF 1F.5
232 0276: MOVLW 00
233 0277: BSF 03.6
234 0278: MOVWF 08
235 0279: BCF 03.5
236 027A: CLRF 07
237 027B: CLRF 08
238 027C: CLRF 09
239 ....................
240 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
241 *
242 0280: BSF 03.5
243 0281: BSF 03.6
244 0282: MOVF 09,W
245 0283: ANDLW C0
246 0284: MOVWF 09
247 0285: BCF 03.6
248 0286: BCF 1F.4
249 0287: BCF 1F.5
250 0288: MOVLW 00
251 0289: BSF 03.6
252 028A: MOVWF 08
253 .................... setup_adc(ADC_CLOCK_DIV_2);
254 028B: BCF 03.5
255 028C: BCF 03.6
256 028D: BCF 1F.6
257 028E: BCF 1F.7
258 028F: BSF 03.5
259 0290: BCF 1F.7
260 0291: BCF 03.5
261 0292: BSF 1F.0
262 .................... setup_spi(SPI_SS_DISABLED);
263 0293: BCF 14.5
264 0294: BCF 20.5
265 0295: MOVF 20,W
266 0296: BSF 03.5
267 0297: MOVWF 07
268 0298: BCF 03.5
269 0299: BSF 20.4
270 029A: MOVF 20,W
271 029B: BSF 03.5
272 029C: MOVWF 07
273 029D: BCF 03.5
274 029E: BCF 20.3
275 029F: MOVF 20,W
276 02A0: BSF 03.5
277 02A1: MOVWF 07
278 02A2: MOVLW 01
279 02A3: BCF 03.5
280 02A4: MOVWF 14
281 02A5: MOVLW 00
282 02A6: BSF 03.5
283 02A7: MOVWF 14
284 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
285 02A8: MOVF 01,W
286 02A9: ANDLW C7
287 02AA: IORLW 08
288 02AB: MOVWF 01
289 .................... setup_timer_1(T1_DISABLED);
290 02AC: BCF 03.5
291 02AD: CLRF 10
292 .................... setup_timer_2(T2_DISABLED,0,1);
293 02AE: MOVLW 00
294 02AF: MOVWF 78
295 02B0: MOVWF 12
296 02B1: MOVLW 00
297 02B2: BSF 03.5
298 02B3: MOVWF 12
299 .................... setup_ccp1(CCP_OFF);
300 02B4: BCF 03.5
301 02B5: BSF 20.2
302 02B6: MOVF 20,W
303 02B7: BSF 03.5
304 02B8: MOVWF 07
305 02B9: BCF 03.5
306 02BA: CLRF 17
307 02BB: BSF 03.5
308 02BC: CLRF 1B
309 02BD: CLRF 1C
310 02BE: MOVLW 01
311 02BF: MOVWF 1D
312 .................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
313 02C0: BCF 03.5
314 02C1: BSF 03.6
315 02C2: CLRF 07
316 02C3: CLRF 08
317 02C4: CLRF 09
318 ....................
319 .................... printf("Simple Thermomether \r\n",);
320 02C5: MOVLW 04
321 02C6: MOVWF 0D
322 02C7: MOVLW 00
323 02C8: MOVWF 0F
324 02C9: BCF 03.6
325 02CA: GOTO 053
326 ....................
327 .................... int16 data1, data2, data3;
328 ....................
329 .................... int XL,XH,YL,YH,ZL,ZH;
330 ....................
331 .................... while(TRUE)
332 .................... {
333 ....................
334 .................... data1=0;
335 02CB: CLRF 22
336 02CC: CLRF 21
337 .................... data2=0 ;
338 02CD: CLRF 24
339 02CE: CLRF 23
340 ....................
341 ....................
342 .................... //akcelerometr
343 .................... int1 ack;
344 .................... i2c_start(); // If the write command is acknowledged,
345 02CF: BSF 03.5
346 02D0: BSF 06.0
347 02D1: NOP
348 02D2: BSF 06.1
349 02D3: NOP
350 02D4: BCF 03.5
351 02D5: BCF 06.0
352 02D6: BSF 03.5
353 02D7: BCF 06.0
354 02D8: NOP
355 02D9: BCF 03.5
356 02DA: BCF 06.1
357 02DB: BSF 03.5
358 02DC: BCF 06.1
359 .................... ack = i2c_write(0x81);//hen the device is ready.
360 02DD: MOVLW 81
361 02DE: BCF 03.5
362 02DF: MOVWF 2E
363 02E0: CALL 09B
364 02E1: MOVF 78,W
365 02E2: BCF 2D.0
366 02E3: BTFSC 78.0
367 02E4: BSF 2D.0
368 .................... i2c_stop();
369 02E5: BSF 03.5
370 02E6: BCF 06.0
371 02E7: NOP
372 02E8: BSF 06.1
373 02E9: BCF 03.5
374 02EA: BTFSS 06.1
375 02EB: GOTO 2EA
376 02EC: NOP
377 02ED: GOTO 2EE
378 02EE: NOP
379 02EF: BSF 03.5
380 02F0: BSF 06.0
381 02F1: NOP
382 .................... ack=!ack;
383 02F2: MOVLW 01
384 02F3: BCF 03.5
385 02F4: XORWF 2D,F
386 ....................
387 ....................
388 ....................
389 .................... i2c_stop(); //T
390 02F5: BSF 03.5
391 02F6: BCF 06.0
392 02F7: NOP
393 02F8: BSF 06.1
394 02F9: BCF 03.5
395 02FA: BTFSS 06.1
396 02FB: GOTO 2FA
397 02FC: NOP
398 02FD: GOTO 2FE
399 02FE: NOP
400 02FF: BSF 03.5
401 0300: BSF 06.0
402 0301: NOP
403 ....................
404 .................... i2c_start();
405 0302: BSF 06.0
406 0303: NOP
407 0304: BSF 06.1
408 0305: NOP
409 0306: BCF 03.5
410 0307: BCF 06.0
411 0308: BSF 03.5
412 0309: BCF 06.0
413 030A: NOP
414 030B: BCF 03.5
415 030C: BCF 06.1
416 030D: BSF 03.5
417 030E: BCF 06.1
418 .................... I2C_Write(0x80);
419 030F: MOVLW 80
420 0310: BCF 03.5
421 0311: MOVWF 2E
422 0312: CALL 09B
423 .................... I2C_write(0xF3);
424 0313: MOVLW F3
425 0314: MOVWF 2E
426 0315: CALL 09B
427 .................... // i2c_stop();
428 .................... i2c_start();
429 0316: BSF 03.5
430 0317: BSF 06.0
431 0318: NOP
432 0319: BSF 06.1
433 031A: NOP
434 031B: BCF 03.5
435 031C: BTFSS 06.1
436 031D: GOTO 31C
437 031E: BCF 06.0
438 031F: BSF 03.5
439 0320: BCF 06.0
440 0321: NOP
441 0322: BCF 03.5
442 0323: BCF 06.1
443 0324: BSF 03.5
444 0325: BCF 06.1
445 .................... I2C_Write(0x81);
446 0326: MOVLW 81
447 0327: BCF 03.5
448 0328: MOVWF 2E
449 0329: CALL 09B
450 .................... XH=i2c_read(0);
451 032A: CLRF 77
452 032B: CALL 0CF
453 032C: MOVF 78,W
454 032D: MOVWF 28
455 .................... XL=i2c_read(0);
456 032E: CLRF 77
457 032F: CALL 0CF
458 0330: MOVF 78,W
459 0331: MOVWF 27
460 .................... i2c_stop();
461 0332: BSF 03.5
462 0333: BCF 06.0
463 0334: NOP
464 0335: BSF 06.1
465 0336: BCF 03.5
466 0337: BTFSS 06.1
467 0338: GOTO 337
468 0339: NOP
469 033A: GOTO 33B
470 033B: NOP
471 033C: BSF 03.5
472 033D: BSF 06.0
473 033E: NOP
474 ....................
475 ....................
476 .................... i2c_start(); //RH
477 033F: BSF 06.0
478 0340: NOP
479 0341: BSF 06.1
480 0342: NOP
481 0343: BCF 03.5
482 0344: BCF 06.0
483 0345: BSF 03.5
484 0346: BCF 06.0
485 0347: NOP
486 0348: BCF 03.5
487 0349: BCF 06.1
488 034A: BSF 03.5
489 034B: BCF 06.1
490 .................... I2C_Write(0x80);
491 034C: MOVLW 80
492 034D: BCF 03.5
493 034E: MOVWF 2E
494 034F: CALL 09B
495 .................... I2C_write(0xF5);
496 0350: MOVLW F5
497 0351: MOVWF 2E
498 0352: CALL 09B
499 .................... // i2c_stop();
500 .................... i2c_start();
501 0353: BSF 03.5
502 0354: BSF 06.0
503 0355: NOP
504 0356: BSF 06.1
505 0357: NOP
506 0358: BCF 03.5
507 0359: BTFSS 06.1
508 035A: GOTO 359
509 035B: BCF 06.0
510 035C: BSF 03.5
511 035D: BCF 06.0
512 035E: NOP
513 035F: BCF 03.5
514 0360: BCF 06.1
515 0361: BSF 03.5
516 0362: BCF 06.1
517 .................... I2C_Write(0x81);
518 0363: MOVLW 81
519 0364: BCF 03.5
520 0365: MOVWF 2E
521 0366: CALL 09B
522 .................... YH=i2c_read(0);
523 0367: CLRF 77
524 0368: CALL 0CF
525 0369: MOVF 78,W
526 036A: MOVWF 2A
527 .................... YL=i2c_read(0);
528 036B: CLRF 77
529 036C: CALL 0CF
530 036D: MOVF 78,W
531 036E: MOVWF 29
532 .................... i2c_stop();
533 036F: BSF 03.5
534 0370: BCF 06.0
535 0371: NOP
536 0372: BSF 06.1
537 0373: BCF 03.5
538 0374: BTFSS 06.1
539 0375: GOTO 374
540 0376: NOP
541 0377: GOTO 378
542 0378: NOP
543 0379: BSF 03.5
544 037A: BSF 06.0
545 037B: NOP
546 ....................
547 ....................
548 ....................
549 .................... data1 = (((unsigned int16) XH << 8) + XL>>2 );
550 037C: BCF 03.5
551 037D: CLRF 2F
552 037E: MOVF 28,W
553 037F: MOVWF 2E
554 0380: MOVWF 2F
555 0381: CLRF 2E
556 0382: MOVF 27,W
557 0383: ADDWF 2E,F
558 0384: BTFSC 03.0
559 0385: INCF 2F,F
560 0386: RRF 2F,W
561 0387: MOVWF 22
562 0388: RRF 2E,W
563 0389: MOVWF 21
564 038A: RRF 22,F
565 038B: RRF 21,F
566 038C: MOVLW 3F
567 038D: ANDWF 22,F
568 .................... data2 = (((unsigned int16) YH << 8) + YL>>2);
569 038E: CLRF 2F
570 038F: MOVF 2A,W
571 0390: MOVWF 2E
572 0391: MOVWF 2F
573 0392: CLRF 2E
574 0393: MOVF 29,W
575 0394: ADDWF 2E,F
576 0395: BTFSC 03.0
577 0396: INCF 2F,F
578 0397: RRF 2F,W
579 0398: MOVWF 24
580 0399: RRF 2E,W
581 039A: MOVWF 23
582 039B: RRF 24,F
583 039C: RRF 23,F
584 039D: MOVLW 3F
585 039E: ANDWF 24,F
586 ....................
587 ....................
588 .................... printf("Stav: %d (procenta)\r\n", ack);
589 039F: MOVLW 00
590 03A0: BTFSC 2D.0
591 03A1: MOVLW 01
592 03A2: MOVWF 2E
593 03A3: MOVLW 10
594 03A4: BSF 03.6
595 03A5: MOVWF 0D
596 03A6: MOVLW 00
597 03A7: MOVWF 0F
598 03A8: BCF 03.0
599 03A9: MOVLW 06
600 03AA: BCF 03.6
601 03AB: MOVWF 2F
602 03AC: CALL 102
603 03AD: MOVF 2E,W
604 03AE: MOVWF 2F
605 03AF: MOVLW 1F
606 03B0: MOVWF 30
607 03B1: GOTO 166
608 03B2: MOVLW 14
609 03B3: BSF 03.6
610 03B4: MOVWF 0D
611 03B5: MOVLW 00
612 03B6: MOVWF 0F
613 03B7: BCF 03.0
614 03B8: MOVLW 0D
615 03B9: BCF 03.6
616 03BA: MOVWF 2F
617 03BB: CALL 102
618 ....................
619 .................... printf("Stav: %Ld(procenta)\r\n", data1);
620 03BC: MOVLW 1B
621 03BD: BSF 03.6
622 03BE: MOVWF 0D
623 03BF: MOVLW 00
624 03C0: MOVWF 0F
625 03C1: BCF 03.0
626 03C2: MOVLW 06
627 03C3: BCF 03.6
628 03C4: MOVWF 2F
629 03C5: CALL 102
630 03C6: MOVLW 10
631 03C7: MOVWF 04
632 03C8: MOVF 22,W
633 03C9: MOVWF 2F
634 03CA: MOVF 21,W
635 03CB: MOVWF 2E
636 03CC: CALL 1CD
637 03CD: MOVLW 1F
638 03CE: BSF 03.6
639 03CF: MOVWF 0D
640 03D0: MOVLW 00
641 03D1: MOVWF 0F
642 03D2: BSF 03.0
643 03D3: MOVLW 0C
644 03D4: BCF 03.6
645 03D5: MOVWF 2F
646 03D6: CALL 102
647 .................... printf("Stav: %Ld(procenta)\r\n", data2);
648 03D7: MOVLW 26
649 03D8: BSF 03.6
650 03D9: MOVWF 0D
651 03DA: MOVLW 00
652 03DB: MOVWF 0F
653 03DC: BCF 03.0
654 03DD: MOVLW 06
655 03DE: BCF 03.6
656 03DF: MOVWF 2F
657 03E0: CALL 102
658 03E1: MOVLW 10
659 03E2: MOVWF 04
660 03E3: MOVF 24,W
661 03E4: MOVWF 2F
662 03E5: MOVF 23,W
663 03E6: MOVWF 2E
664 03E7: CALL 1CD
665 03E8: MOVLW 2A
666 03E9: BSF 03.6
667 03EA: MOVWF 0D
668 03EB: MOVLW 00
669 03EC: MOVWF 0F
670 03ED: BSF 03.0
671 03EE: MOVLW 0C
672 03EF: BCF 03.6
673 03F0: MOVWF 2F
674 03F1: CALL 102
675 ....................
676 .................... delay_ms (2000);
677 03F2: MOVLW 08
678 03F3: MOVWF 2E
679 03F4: MOVLW FA
680 03F5: MOVWF 2F
681 03F6: GOTO 24D
682 03F7: DECFSZ 2E,F
683 03F8: GOTO 3F4
684 ....................
685 .................... }
686 03F9: GOTO 2CB
687 .................... }
688 ....................
689 03FA: SLEEP
690  
691 Configuration Fuses:
692 Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
693 Word 2: 3FFF NOWRT BORV40