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