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