Rev Author Line No. Line
2953 jacho 1 CCS PCM C Compiler, Version 4.106, 47914 30-4-13 23:25
2926 jacho 2  
3 Filename: C:\Users\Honza\Documents\pic\I2C_baterka\main.lst
4  
2953 jacho 5 ROM used: 1313 words (16%)
2926 jacho 6 Largest free fragment is 2048
2953 jacho 7 RAM used: 7 (2%) at main() level
8 19 (5%) worst case
9 Stack: 3 locations
2926 jacho 10  
11 *
2953 jacho 12 0000: MOVLW 03
2926 jacho 13 0001: MOVWF 0A
2953 jacho 14 0002: GOTO 3E1
2926 jacho 15 0003: NOP
2953 jacho 16 .................... //#include "C:\Users\Honza\Documents\pic\I2C_magnetometr\main.h"
17 .................... #include "main.h"
2926 jacho 18 .................... #include <16F887.h>
19 .................... //////// Standard Header file for the PIC16F887 device ////////////////
20 .................... #device PIC16F887
21 .................... #list
22 ....................
23 .................... #device adc=8
24 ....................
25 .................... #FUSES NOWDT //No Watch Dog Timer
26 .................... #FUSES INTRC //Internal RC Osc
27 .................... #FUSES NOPUT //No Power Up Timer
28 .................... #FUSES MCLR //Master Clear pin enabled
29 .................... #FUSES NOPROTECT //Code not protected from reading
30 .................... #FUSES NOCPD //No EE protection
31 .................... #FUSES NOBROWNOUT //No brownout reset
32 .................... #FUSES IESO //Internal External Switch Over mode enabled
33 .................... #FUSES FCMEN //Fail-safe clock monitor enabled
34 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
35 .................... #FUSES NODEBUG //No Debug mode for ICD
36 .................... #FUSES NOWRT //Program memory not write protected
37 .................... #FUSES BORV40 //Brownout reset at 4.0V
38 ....................
39 .................... #use delay(clock=8000000)
40 *
2953 jacho 41 03CB: MOVLW 24
42 03CC: MOVWF 04
43 03CD: BCF 03.7
44 03CE: MOVF 00,W
45 03CF: BTFSC 03.2
46 03D0: GOTO 3DE
47 03D1: MOVLW 02
48 03D2: MOVWF 78
49 03D3: CLRF 77
50 03D4: DECFSZ 77,F
51 03D5: GOTO 3D4
52 03D6: DECFSZ 78,F
53 03D7: GOTO 3D3
54 03D8: MOVLW 97
55 03D9: MOVWF 77
56 03DA: DECFSZ 77,F
57 03DB: GOTO 3DA
58 03DC: DECFSZ 00,F
59 03DD: GOTO 3D1
60 03DE: BCF 0A.3
61 03DF: BCF 0A.4
62 03E0: GOTO 51D (RETURN)
2926 jacho 63 ....................
64 ....................
2953 jacho 65 .................... #define EEPROM_SDA PIN_C4
66 .................... #define EEPROM_SCL PIN_C3
2926 jacho 67 .................... #use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL)
68 *
2953 jacho 69 00F7: MOVLW 08
70 00F8: MOVWF 78
71 00F9: NOP
72 00FA: BCF 07.3
73 00FB: BCF 20.3
74 00FC: MOVF 20,W
75 00FD: BSF 03.5
76 00FE: MOVWF 07
77 00FF: NOP
2926 jacho 78 0100: BCF 03.5
2953 jacho 79 0101: RLF 2B,F
80 0102: BCF 07.4
81 0103: BTFSS 03.0
82 0104: GOTO 10B
83 0105: BSF 20.4
84 0106: MOVF 20,W
85 0107: BSF 03.5
86 0108: MOVWF 07
87 0109: GOTO 10F
88 010A: BCF 03.5
89 010B: BCF 20.4
90 010C: MOVF 20,W
91 010D: BSF 03.5
92 010E: MOVWF 07
93 010F: NOP
94 0110: BCF 03.5
95 0111: BSF 20.3
96 0112: MOVF 20,W
97 0113: BSF 03.5
98 0114: MOVWF 07
99 0115: BCF 03.5
100 0116: BTFSS 07.3
101 0117: GOTO 116
102 0118: DECFSZ 78,F
103 0119: GOTO 0F9
2926 jacho 104 011A: NOP
2953 jacho 105 011B: BCF 07.3
106 011C: BCF 20.3
107 011D: MOVF 20,W
108 011E: BSF 03.5
109 011F: MOVWF 07
2926 jacho 110 0120: NOP
2953 jacho 111 0121: BCF 03.5
112 0122: BSF 20.4
113 0123: MOVF 20,W
114 0124: BSF 03.5
115 0125: MOVWF 07
116 0126: NOP
117 0127: NOP
118 0128: BCF 03.5
119 0129: BSF 20.3
120 012A: MOVF 20,W
121 012B: BSF 03.5
122 012C: MOVWF 07
123 012D: BCF 03.5
124 012E: BTFSS 07.3
125 012F: GOTO 12E
126 0130: CLRF 78
127 0131: NOP
128 0132: BTFSC 07.4
129 0133: BSF 78.0
130 0134: BCF 07.3
131 0135: BCF 20.3
132 0136: MOVF 20,W
133 0137: BSF 03.5
134 0138: MOVWF 07
135 0139: BCF 03.5
136 013A: BCF 07.4
137 013B: BCF 20.4
138 013C: MOVF 20,W
139 013D: BSF 03.5
140 013E: MOVWF 07
141 013F: BCF 03.5
142 0140: RETURN
143 0141: MOVLW 08
144 0142: MOVWF 2C
145 0143: MOVF 77,W
146 0144: MOVWF 2D
147 0145: BSF 20.4
148 0146: MOVF 20,W
149 0147: BSF 03.5
150 0148: MOVWF 07
151 0149: NOP
152 014A: BCF 03.5
153 014B: BSF 20.3
154 014C: MOVF 20,W
155 014D: BSF 03.5
156 014E: MOVWF 07
157 014F: BCF 03.5
158 0150: BTFSS 07.3
159 0151: GOTO 150
160 0152: BTFSC 07.4
161 0153: BSF 03.0
162 0154: BTFSS 07.4
163 0155: BCF 03.0
164 0156: RLF 78,F
165 0157: NOP
166 0158: BCF 20.3
167 0159: MOVF 20,W
168 015A: BSF 03.5
169 015B: MOVWF 07
170 015C: BCF 03.5
171 015D: BCF 07.3
172 015E: DECFSZ 2C,F
173 015F: GOTO 145
174 0160: BSF 20.4
175 0161: MOVF 20,W
176 0162: BSF 03.5
177 0163: MOVWF 07
178 0164: NOP
179 0165: BCF 03.5
180 0166: BCF 07.4
181 0167: MOVF 2D,W
182 0168: BTFSC 03.2
183 0169: GOTO 16F
184 016A: BCF 20.4
185 016B: MOVF 20,W
186 016C: BSF 03.5
187 016D: MOVWF 07
188 016E: BCF 03.5
189 016F: NOP
190 0170: BSF 20.3
191 0171: MOVF 20,W
192 0172: BSF 03.5
193 0173: MOVWF 07
194 0174: BCF 03.5
195 0175: BTFSS 07.3
196 0176: GOTO 175
197 0177: NOP
198 0178: BCF 07.3
199 0179: BCF 20.3
200 017A: MOVF 20,W
201 017B: BSF 03.5
202 017C: MOVWF 07
203 017D: NOP
204 017E: BCF 03.5
205 017F: BCF 07.4
206 0180: BCF 20.4
207 0181: MOVF 20,W
208 0182: BSF 03.5
209 0183: MOVWF 07
210 0184: BCF 03.5
211 0185: RETURN
212 .................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD
2926 jacho 213 *
2953 jacho 214 008D: BCF 20.7
215 008E: MOVF 20,W
216 008F: BSF 03.5
217 0090: MOVWF 07
218 0091: BCF 03.5
219 0092: BCF 07.7
220 0093: MOVLW 08
221 0094: MOVWF 78
222 0095: GOTO 096
223 0096: NOP
224 0097: BSF 78.7
225 0098: GOTO 0A7
226 0099: BCF 78.7
227 009A: RRF 2C,F
228 009B: BTFSC 03.0
229 009C: BSF 07.7
230 009D: BTFSS 03.0
231 009E: BCF 07.7
232 009F: BSF 78.6
233 00A0: GOTO 0A7
234 00A1: BCF 78.6
235 00A2: DECFSZ 78,F
236 00A3: GOTO 09A
237 00A4: GOTO 0A5
238 00A5: NOP
239 00A6: BSF 07.7
240 00A7: MOVLW 3F
241 00A8: MOVWF 04
242 00A9: DECFSZ 04,F
243 00AA: GOTO 0A9
244 00AB: NOP
245 00AC: BTFSC 78.7
246 00AD: GOTO 099
247 00AE: BTFSC 78.6
248 00AF: GOTO 0A1
249 00B0: RETURN
250 .................... #include "BQ34Z100.h"
251 .................... #define BAT_ADDR_R 0xAB //addresa pro cteni
252 .................... #define BAT_ADDR_W 0xAA
2926 jacho 253 ....................
254 ....................
255 ....................
256 ....................
257 ....................
2953 jacho 258 .................... #include "BQ34Z100.c"
259 .................... int16 cteniBAT(byte lsb, byte msb)
2926 jacho 260 .................... {
2953 jacho 261 *
262 0186: CLRF 28
263 0187: CLRF 27
264 .................... int16 data = 0;
265 .................... unsigned int8 h, l;
2926 jacho 266 .................... i2c_start();
2953 jacho 267 0188: BSF 20.4
268 0189: MOVF 20,W
269 018A: BSF 03.5
270 018B: MOVWF 07
271 018C: NOP
272 018D: BCF 03.5
273 018E: BSF 20.3
274 018F: MOVF 20,W
275 0190: BSF 03.5
276 0191: MOVWF 07
277 0192: NOP
278 0193: BCF 03.5
279 0194: BCF 07.4
280 0195: BCF 20.4
281 0196: MOVF 20,W
282 0197: BSF 03.5
283 0198: MOVWF 07
284 0199: NOP
285 019A: BCF 03.5
286 019B: BCF 07.3
287 019C: BCF 20.3
288 019D: MOVF 20,W
289 019E: BSF 03.5
290 019F: MOVWF 07
291 .................... I2C_Write(BAT_ADDR_W);
292 01A0: MOVLW AA
293 01A1: BCF 03.5
294 01A2: MOVWF 2B
295 01A3: CALL 0F7
296 .................... I2C_write(lsb);
297 01A4: MOVF 25,W
298 01A5: MOVWF 2B
299 01A6: CALL 0F7
300 ....................
2926 jacho 301 .................... i2c_start();
2953 jacho 302 01A7: BSF 20.4
303 01A8: MOVF 20,W
304 01A9: BSF 03.5
305 01AA: MOVWF 07
306 01AB: NOP
307 01AC: BCF 03.5
308 01AD: BSF 20.3
309 01AE: MOVF 20,W
310 01AF: BSF 03.5
311 01B0: MOVWF 07
312 01B1: NOP
313 01B2: BCF 03.5
314 01B3: BTFSS 07.3
315 01B4: GOTO 1B3
316 01B5: BCF 07.4
317 01B6: BCF 20.4
318 01B7: MOVF 20,W
319 01B8: BSF 03.5
320 01B9: MOVWF 07
321 01BA: NOP
322 01BB: BCF 03.5
323 01BC: BCF 07.3
324 01BD: BCF 20.3
325 01BE: MOVF 20,W
326 01BF: BSF 03.5
327 01C0: MOVWF 07
328 .................... I2C_Write(BAT_ADDR_R);
329 01C1: MOVLW AB
330 01C2: BCF 03.5
331 01C3: MOVWF 2B
332 01C4: CALL 0F7
333 .................... l=i2c_read(0);
334 01C5: CLRF 77
335 01C6: CALL 141
336 01C7: MOVF 78,W
337 01C8: MOVWF 2A
2926 jacho 338 .................... i2c_stop();
2953 jacho 339 01C9: BCF 20.4
340 01CA: MOVF 20,W
341 01CB: BSF 03.5
342 01CC: MOVWF 07
343 01CD: NOP
344 01CE: BCF 03.5
345 01CF: BSF 20.3
346 01D0: MOVF 20,W
347 01D1: BSF 03.5
348 01D2: MOVWF 07
349 01D3: BCF 03.5
350 01D4: BTFSS 07.3
351 01D5: GOTO 1D4
352 01D6: NOP
353 01D7: GOTO 1D8
354 01D8: NOP
355 01D9: BSF 20.4
356 01DA: MOVF 20,W
357 01DB: BSF 03.5
358 01DC: MOVWF 07
359 01DD: NOP
360 ....................
2926 jacho 361 .................... i2c_start();
2953 jacho 362 01DE: BCF 03.5
363 01DF: BSF 20.4
364 01E0: MOVF 20,W
365 01E1: BSF 03.5
366 01E2: MOVWF 07
367 01E3: NOP
368 01E4: BCF 03.5
369 01E5: BSF 20.3
370 01E6: MOVF 20,W
371 01E7: BSF 03.5
372 01E8: MOVWF 07
373 01E9: NOP
374 01EA: BCF 03.5
375 01EB: BCF 07.4
376 01EC: BCF 20.4
377 01ED: MOVF 20,W
378 01EE: BSF 03.5
379 01EF: MOVWF 07
380 01F0: NOP
381 01F1: BCF 03.5
382 01F2: BCF 07.3
383 01F3: BCF 20.3
384 01F4: MOVF 20,W
385 01F5: BSF 03.5
386 01F6: MOVWF 07
387 .................... I2C_Write(BAT_ADDR_W);
388 01F7: MOVLW AA
389 01F8: BCF 03.5
390 01F9: MOVWF 2B
391 01FA: CALL 0F7
392 .................... I2C_write(msb);
393 01FB: MOVF 26,W
394 01FC: MOVWF 2B
395 01FD: CALL 0F7
2926 jacho 396 .................... i2c_start();
2953 jacho 397 01FE: BSF 20.4
398 01FF: MOVF 20,W
399 0200: BSF 03.5
400 0201: MOVWF 07
401 0202: NOP
402 0203: BCF 03.5
403 0204: BSF 20.3
404 0205: MOVF 20,W
405 0206: BSF 03.5
406 0207: MOVWF 07
407 0208: NOP
408 0209: BCF 03.5
409 020A: BTFSS 07.3
410 020B: GOTO 20A
411 020C: BCF 07.4
412 020D: BCF 20.4
413 020E: MOVF 20,W
414 020F: BSF 03.5
415 0210: MOVWF 07
416 0211: NOP
417 0212: BCF 03.5
418 0213: BCF 07.3
419 0214: BCF 20.3
420 0215: MOVF 20,W
421 0216: BSF 03.5
422 0217: MOVWF 07
423 .................... I2C_Write(BAT_ADDR_R);
424 0218: MOVLW AB
425 0219: BCF 03.5
426 021A: MOVWF 2B
427 021B: CALL 0F7
428 .................... h=i2c_read(0);
429 021C: CLRF 77
430 021D: CALL 141
431 021E: MOVF 78,W
432 021F: MOVWF 29
2926 jacho 433 .................... i2c_stop();
2953 jacho 434 0220: BCF 20.4
435 0221: MOVF 20,W
436 0222: BSF 03.5
437 0223: MOVWF 07
438 0224: NOP
439 0225: BCF 03.5
440 0226: BSF 20.3
441 0227: MOVF 20,W
442 0228: BSF 03.5
443 0229: MOVWF 07
444 022A: BCF 03.5
445 022B: BTFSS 07.3
446 022C: GOTO 22B
447 022D: NOP
448 022E: GOTO 22F
449 022F: NOP
450 0230: BSF 20.4
451 0231: MOVF 20,W
452 0232: BSF 03.5
453 0233: MOVWF 07
454 0234: NOP
2926 jacho 455 ....................
2953 jacho 456 .................... return data = (((unsigned int16) h << 8) + l );
457 0235: BCF 03.5
458 0236: CLRF 2C
459 0237: MOVF 29,W
460 0238: MOVWF 2B
461 0239: MOVWF 2C
462 023A: CLRF 2B
463 023B: MOVF 2A,W
464 023C: ADDWF 2B,W
465 023D: MOVWF 27
466 023E: MOVF 2C,W
467 023F: MOVWF 28
468 0240: BTFSC 03.0
469 0241: INCF 28,F
470 0242: MOVF 27,W
471 0243: MOVWF 78
472 0244: MOVF 28,W
473 0245: MOVWF 79
474 .................... }
475 0246: RETURN
476 ....................
477 .................... int16 batintT(void) //teplota baterie (pri vyrobnim nastaveni, je mozne zmenit na teplotu v IO
478 .................... {
479 0247: MOVLW 0C
480 0248: MOVWF 25
481 0249: MOVLW 0D
482 024A: MOVWF 26
483 024B: CALL 186
484 024C: MOVF 79,W
485 024D: MOVWF 24
486 024E: MOVF 78,W
487 024F: MOVWF 23
488 .................... int16 data = cteniBAT(0x0C, 0x0D);
489 .................... data = (data/10)-273;
490 0250: MOVF 24,W
491 0251: MOVWF 26
492 0252: MOVF 23,W
493 0253: MOVWF 25
494 0254: CLRF 28
495 0255: MOVLW 0A
496 0256: MOVWF 27
497 *
498 027B: MOVLW 11
499 027C: SUBWF 78,W
500 027D: MOVWF 23
501 027E: MOVF 79,W
502 027F: MOVWF 24
503 0280: MOVLW 01
504 0281: BTFSS 03.0
505 0282: MOVLW 02
506 0283: SUBWF 24,F
507 .................... return data;
508 0284: MOVF 23,W
509 0285: MOVWF 78
510 0286: MOVF 24,W
511 0287: MOVWF 79
2926 jacho 512 ....................
2953 jacho 513 .................... }
514 0288: BCF 0A.3
515 0289: BCF 0A.4
516 028A: GOTO 455 (RETURN)
2926 jacho 517 ....................
2953 jacho 518 .................... int16 batNAP(void) //napeti baterie
519 .................... {
520 *
521 032C: MOVLW 08
522 032D: MOVWF 25
523 032E: MOVLW 09
524 032F: MOVWF 26
525 0330: CALL 186
526 0331: MOVF 79,W
527 0332: MOVWF 24
528 0333: MOVF 78,W
529 0334: MOVWF 23
530 .................... int16 data = cteniBAT(0x08, 0x09);
531 .................... return data;
532 0335: MOVF 23,W
533 0336: MOVWF 78
534 0337: MOVF 24,W
535 0338: MOVWF 79
2926 jacho 536 ....................
2953 jacho 537 .................... }
538 0339: BCF 0A.3
539 033A: BCF 0A.4
540 033B: GOTO 473 (RETURN)
2926 jacho 541 ....................
2953 jacho 542 .................... int16 batPROUD(void) //proud z nebo do baterie
543 .................... {
544 *
545 038B: MOVLW 0A
546 038C: MOVWF 25
547 038D: MOVLW 0B
548 038E: MOVWF 26
549 038F: CALL 186
550 0390: MOVF 79,W
551 0391: MOVWF 24
552 0392: MOVF 78,W
553 0393: MOVWF 23
554 .................... int16 data = cteniBAT(0x0A, 0x0B);
555 .................... return data;
556 0394: MOVF 23,W
557 0395: MOVWF 78
558 0396: MOVF 24,W
559 0397: MOVWF 79
2926 jacho 560 ....................
2953 jacho 561 .................... }
562 0398: BCF 0A.3
563 0399: BCF 0A.4
564 039A: GOTO 493 (RETURN)
2926 jacho 565 ....................
2953 jacho 566 .................... int16 batKAPAKT(void) //zbyvajici kapacita
567 .................... {
568 039B: MOVLW 04
569 039C: MOVWF 25
570 039D: MOVLW 05
571 039E: MOVWF 26
572 039F: CALL 186
573 03A0: MOVF 79,W
574 03A1: MOVWF 24
575 03A2: MOVF 78,W
576 03A3: MOVWF 23
577 .................... int16 data = cteniBAT(0x04, 0x05);
578 .................... return data;
579 03A4: MOVF 23,W
580 03A5: MOVWF 78
581 03A6: MOVF 24,W
582 03A7: MOVWF 79
2926 jacho 583 ....................
2953 jacho 584 .................... }
585 03A8: BCF 0A.3
586 03A9: BCF 0A.4
587 03AA: GOTO 4B3 (RETURN)
588 .................... int16 batKAPMAX(void) //max. kapacita
589 .................... {
590 03AB: MOVLW 06
591 03AC: MOVWF 25
592 03AD: MOVLW 07
593 03AE: MOVWF 26
594 03AF: CALL 186
595 03B0: MOVF 79,W
596 03B1: MOVWF 24
597 03B2: MOVF 78,W
598 03B3: MOVWF 23
599 .................... int16 data = cteniBAT(0x06, 0x07);
600 .................... return data;
601 03B4: MOVF 23,W
602 03B5: MOVWF 78
603 03B6: MOVF 24,W
604 03B7: MOVWF 79
2926 jacho 605 ....................
2953 jacho 606 .................... }
607 03B8: BCF 0A.3
608 03B9: BCF 0A.4
609 03BA: GOTO 4D3 (RETURN)
2926 jacho 610 ....................
2953 jacho 611 .................... int16 batSTAV(void) //zbytek energie v baterii v %
612 .................... {
613 03BB: MOVLW 02
614 03BC: MOVWF 25
615 03BD: MOVLW 03
616 03BE: MOVWF 26
617 03BF: CALL 186
618 03C0: MOVF 79,W
619 03C1: MOVWF 24
620 03C2: MOVF 78,W
621 03C3: MOVWF 23
622 .................... int16 data = cteniBAT(0x02, 0x03);
623 .................... return data;
624 03C4: MOVF 23,W
625 03C5: MOVWF 78
626 03C6: MOVF 24,W
627 03C7: MOVWF 79
2926 jacho 628 ....................
2953 jacho 629 .................... }
630 03C8: BCF 0A.3
631 03C9: BCF 0A.4
632 03CA: GOTO 4F3 (RETURN)
2926 jacho 633 ....................
634 ....................
2953 jacho 635 ....................
636 ....................
637 ....................
638 .................... void main()
639 .................... {
640 *
641 03E1: CLRF 04
642 03E2: BCF 03.7
643 03E3: MOVLW 1F
644 03E4: ANDWF 03,F
645 03E5: MOVLW 71
646 03E6: BSF 03.5
647 03E7: MOVWF 0F
648 03E8: MOVF 0F,W
649 03E9: BCF 03.5
650 03EA: BCF 20.7
651 03EB: MOVF 20,W
652 03EC: BSF 03.5
653 03ED: MOVWF 07
654 03EE: BCF 03.5
655 03EF: BSF 07.7
656 03F0: BSF 03.5
657 03F1: BSF 03.6
658 03F2: MOVF 09,W
659 03F3: ANDLW C0
660 03F4: MOVWF 09
661 03F5: BCF 03.6
662 03F6: BCF 1F.4
663 03F7: BCF 1F.5
664 03F8: MOVLW 00
665 03F9: BSF 03.6
666 03FA: MOVWF 08
667 03FB: BCF 03.5
668 03FC: CLRF 07
669 03FD: CLRF 08
670 03FE: CLRF 09
671 ....................
672 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
673 *
674 0402: BSF 03.5
675 0403: BSF 03.6
676 0404: MOVF 09,W
677 0405: ANDLW C0
678 0406: MOVWF 09
679 0407: BCF 03.6
680 0408: BCF 1F.4
681 0409: BCF 1F.5
682 040A: MOVLW 00
683 040B: BSF 03.6
684 040C: MOVWF 08
685 .................... setup_adc(ADC_CLOCK_DIV_2);
686 040D: BCF 03.5
687 040E: BCF 03.6
688 040F: BCF 1F.6
689 0410: BCF 1F.7
690 0411: BSF 03.5
691 0412: BCF 1F.7
692 0413: BCF 03.5
693 0414: BSF 1F.0
694 .................... setup_spi(SPI_SS_DISABLED);
695 0415: BCF 14.5
696 0416: BCF 20.5
697 0417: MOVF 20,W
698 0418: BSF 03.5
699 0419: MOVWF 07
700 041A: BCF 03.5
701 041B: BSF 20.4
702 041C: MOVF 20,W
703 041D: BSF 03.5
704 041E: MOVWF 07
705 041F: BCF 03.5
706 0420: BCF 20.3
707 0421: MOVF 20,W
708 0422: BSF 03.5
709 0423: MOVWF 07
710 0424: MOVLW 01
711 0425: BCF 03.5
712 0426: MOVWF 14
713 0427: MOVLW 00
714 0428: BSF 03.5
715 0429: MOVWF 14
716 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
717 042A: MOVF 01,W
718 042B: ANDLW C7
719 042C: IORLW 08
720 042D: MOVWF 01
721 .................... setup_timer_1(T1_DISABLED);
722 042E: BCF 03.5
723 042F: CLRF 10
724 .................... setup_timer_2(T2_DISABLED,0,1);
725 0430: MOVLW 00
726 0431: MOVWF 78
727 0432: MOVWF 12
728 0433: MOVLW 00
729 0434: BSF 03.5
730 0435: MOVWF 12
731 .................... setup_ccp1(CCP_OFF);
732 0436: BCF 03.5
733 0437: BSF 20.2
734 0438: MOVF 20,W
735 0439: BSF 03.5
736 043A: MOVWF 07
737 043B: BCF 03.5
738 043C: CLRF 17
739 043D: BSF 03.5
740 043E: CLRF 1B
741 043F: CLRF 1C
742 0440: MOVLW 01
743 0441: MOVWF 1D
744 .................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
745 0442: BCF 03.5
746 0443: BSF 03.6
747 0444: CLRF 07
748 0445: CLRF 08
749 0446: CLRF 09
750 ....................
751 .................... printf("Vycitani zakladnich dat z modulu LION1CELL01B \r\n",);
752 0447: MOVLW 04
753 0448: MOVWF 0D
754 0449: MOVLW 00
755 044A: MOVWF 0F
756 044B: BCF 03.6
757 044C: CALL 0B1
758 .................... printf("(c) MLAB 2013 JACHO \r\n",);
759 044D: MOVLW 1D
760 044E: BSF 03.6
761 044F: MOVWF 0D
762 0450: MOVLW 00
763 0451: MOVWF 0F
764 0452: BCF 03.6
765 0453: CALL 0B1
766 .................... int16 data;
767 ....................
768 ....................
769 .................... while(TRUE)
770 .................... {
771 .................... data=batintT();
772 0454: GOTO 247
773 0455: MOVF 79,W
774 0456: MOVWF 22
775 0457: MOVF 78,W
776 0458: MOVWF 21
777 .................... printf("Teplota baterie: %Ld (°C)\r\n", data);
778 0459: MOVLW 29
779 045A: BSF 03.6
780 045B: MOVWF 0D
781 045C: MOVLW 00
782 045D: MOVWF 0F
783 045E: MOVLW 11
784 045F: BCF 03.6
785 0460: MOVWF 23
786 0461: CALL 28B
787 0462: MOVLW 10
788 0463: MOVWF 04
789 0464: MOVF 22,W
790 0465: MOVWF 24
791 0466: MOVF 21,W
792 0467: MOVWF 23
793 0468: CALL 2AC
794 0469: MOVLW 3D
795 046A: BSF 03.6
796 046B: MOVWF 0D
797 046C: MOVLW 00
798 046D: MOVWF 0F
799 046E: MOVLW 07
800 046F: BCF 03.6
801 0470: MOVWF 23
802 0471: CALL 28B
803 .................... data=batNAP();
804 0472: GOTO 32C
805 0473: MOVF 79,W
806 0474: MOVWF 22
807 0475: MOVF 78,W
808 0476: MOVWF 21
809 .................... printf("Napeti clanku: %Ld (mV)\r\n", data);
810 0477: MOVLW 45
811 0478: BSF 03.6
812 0479: MOVWF 0D
813 047A: MOVLW 00
814 047B: MOVWF 0F
815 047C: BCF 03.0
816 047D: MOVLW 0F
817 047E: BCF 03.6
818 047F: MOVWF 23
819 0480: CALL 33C
820 0481: MOVLW 10
821 0482: MOVWF 04
822 0483: MOVF 22,W
823 0484: MOVWF 24
824 0485: MOVF 21,W
825 0486: MOVWF 23
826 0487: CALL 2AC
827 0488: MOVLW 4E
828 0489: BSF 03.6
829 048A: MOVWF 0D
830 048B: MOVLW 00
831 048C: MOVWF 0F
832 048D: BCF 03.0
833 048E: MOVLW 07
834 048F: BCF 03.6
835 0490: MOVWF 23
836 0491: CALL 33C
837 .................... data=batPROUD();
838 0492: GOTO 38B
839 0493: MOVF 79,W
840 0494: MOVWF 22
841 0495: MOVF 78,W
842 0496: MOVWF 21
843 .................... printf("Proud clankem: %Ld (mA)\r\n", data);
844 0497: MOVLW 52
845 0498: BSF 03.6
846 0499: MOVWF 0D
847 049A: MOVLW 00
848 049B: MOVWF 0F
849 049C: BCF 03.0
850 049D: MOVLW 0F
851 049E: BCF 03.6
852 049F: MOVWF 23
853 04A0: CALL 33C
854 04A1: MOVLW 10
855 04A2: MOVWF 04
856 04A3: MOVF 22,W
857 04A4: MOVWF 24
858 04A5: MOVF 21,W
859 04A6: MOVWF 23
860 04A7: CALL 2AC
861 04A8: MOVLW 5B
862 04A9: BSF 03.6
863 04AA: MOVWF 0D
864 04AB: MOVLW 00
865 04AC: MOVWF 0F
866 04AD: BCF 03.0
867 04AE: MOVLW 07
868 04AF: BCF 03.6
869 04B0: MOVWF 23
870 04B1: CALL 33C
871 .................... data=batKAPAKT();
872 04B2: GOTO 39B
873 04B3: MOVF 79,W
874 04B4: MOVWF 22
875 04B5: MOVF 78,W
876 04B6: MOVWF 21
877 .................... printf("Zbyvajici kapacita: %Ld (mAh)\r\n", data);
878 04B7: MOVLW 5F
879 04B8: BSF 03.6
880 04B9: MOVWF 0D
881 04BA: MOVLW 00
882 04BB: MOVWF 0F
883 04BC: BCF 03.0
884 04BD: MOVLW 14
885 04BE: BCF 03.6
886 04BF: MOVWF 23
887 04C0: CALL 33C
888 04C1: MOVLW 10
889 04C2: MOVWF 04
890 04C3: MOVF 22,W
891 04C4: MOVWF 24
892 04C5: MOVF 21,W
893 04C6: MOVWF 23
894 04C7: CALL 2AC
895 04C8: MOVLW 6A
896 04C9: BSF 03.6
897 04CA: MOVWF 0D
898 04CB: MOVLW 00
899 04CC: MOVWF 0F
900 04CD: BSF 03.0
901 04CE: MOVLW 08
902 04CF: BCF 03.6
903 04D0: MOVWF 23
904 04D1: CALL 33C
905 .................... data=batKAPMAX();
906 04D2: GOTO 3AB
907 04D3: MOVF 79,W
908 04D4: MOVWF 22
909 04D5: MOVF 78,W
910 04D6: MOVWF 21
911 .................... printf("Max. kapacita: %Ld (mAh)\r\n", data);
912 04D7: MOVLW 6F
913 04D8: BSF 03.6
914 04D9: MOVWF 0D
915 04DA: MOVLW 00
916 04DB: MOVWF 0F
917 04DC: BCF 03.0
918 04DD: MOVLW 0F
919 04DE: BCF 03.6
920 04DF: MOVWF 23
921 04E0: CALL 33C
922 04E1: MOVLW 10
923 04E2: MOVWF 04
924 04E3: MOVF 22,W
925 04E4: MOVWF 24
926 04E5: MOVF 21,W
927 04E6: MOVWF 23
928 04E7: CALL 2AC
929 04E8: MOVLW 78
930 04E9: BSF 03.6
931 04EA: MOVWF 0D
932 04EB: MOVLW 00
933 04EC: MOVWF 0F
934 04ED: BCF 03.0
935 04EE: MOVLW 08
936 04EF: BCF 03.6
937 04F0: MOVWF 23
938 04F1: CALL 33C
939 .................... data=batSTAV();
940 04F2: GOTO 3BB
941 04F3: MOVF 79,W
942 04F4: MOVWF 22
943 04F5: MOVF 78,W
944 04F6: MOVWF 21
945 .................... printf("Stav baterie: %Ld (procenta)\r\n", data);
946 04F7: MOVLW 7D
947 04F8: BSF 03.6
948 04F9: MOVWF 0D
949 04FA: MOVLW 00
950 04FB: MOVWF 0F
951 04FC: BCF 03.0
952 04FD: MOVLW 0E
953 04FE: BCF 03.6
954 04FF: MOVWF 23
955 0500: CALL 33C
956 0501: MOVLW 10
957 0502: MOVWF 04
958 0503: MOVF 22,W
959 0504: MOVWF 24
960 0505: MOVF 21,W
961 0506: MOVWF 23
962 0507: CALL 2AC
963 0508: MOVLW 85
964 0509: BSF 03.6
965 050A: MOVWF 0D
966 050B: MOVLW 00
967 050C: MOVWF 0F
968 050D: BSF 03.0
969 050E: MOVLW 0D
970 050F: BCF 03.6
971 0510: MOVWF 23
972 0511: CALL 33C
973 .................... printf("\r\n");
974 0512: MOVLW 0D
975 0513: MOVWF 2C
976 0514: CALL 08D
977 0515: MOVLW 0A
978 0516: MOVWF 2C
979 0517: CALL 08D
980 .................... delay_ms (2000);
981 0518: MOVLW 08
982 0519: MOVWF 23
983 051A: MOVLW FA
984 051B: MOVWF 24
985 051C: GOTO 3CB
986 051D: DECFSZ 23,F
987 051E: GOTO 51A
2926 jacho 988 .................... }
2953 jacho 989 051F: GOTO 454
2926 jacho 990 .................... }
2953 jacho 991 0520: SLEEP
2926 jacho 992  
993 Configuration Fuses:
994 Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
995 Word 2: 3FFF NOWRT BORV40