Rev Author Line No. Line
1045 jacho 1 CCS PCM C Compiler, Version 4.106, 47914 15-4-13 19:59
2  
3 Filename: C:\Users\Honza\Documents\pic\I2C_altimet\main.lst
4  
5 ROM used: 2236 words (27%)
6 Largest free fragment is 2048
7 RAM used: 18 (5%) at main() level
8 55 (15%) worst case
9 Stack: 3 locations
10  
11 *
12 0000: MOVLW 08
13 0001: MOVWF 0A
14 0002: GOTO 000
15 0003: NOP
16 .................... //Jan Chroust 15.4.2013
17 ....................
18 ....................
19 .................... #include "C:\Users\Honza\Documents\pic\I2C_altimet\main.h"
20 .................... #include <16F887.h>
21 .................... //////// Standard Header file for the PIC16F887 device ////////////////
22 .................... #device PIC16F887
23 .................... #list
24 ....................
25 .................... #device adc=8
26 ....................
27 .................... #FUSES NOWDT //No Watch Dog Timer
28 .................... #FUSES INTRC //Internal RC Osc
29 .................... #FUSES NOPUT //No Power Up Timer
30 .................... #FUSES MCLR //Master Clear pin enabled
31 .................... #FUSES NOPROTECT //Code not protected from reading
32 .................... #FUSES NOCPD //No EE protection
33 .................... #FUSES NOBROWNOUT //No brownout reset
34 .................... #FUSES IESO //Internal External Switch Over mode enabled
35 .................... #FUSES FCMEN //Fail-safe clock monitor enabled
36 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
37 .................... #FUSES NODEBUG //No Debug mode for ICD
38 .................... #FUSES NOWRT //Program memory not write protected
39 .................... #FUSES BORV40 //Brownout reset at 4.0V
40 ....................
41 .................... #use delay(clock=8000000)
42 *
43 014A: MOVLW 2E
44 014B: MOVWF 04
45 014C: BCF 03.7
46 014D: MOVF 00,W
47 014E: BTFSC 03.2
48 014F: GOTO 15D
49 0150: MOVLW 02
50 0151: MOVWF 78
51 0152: CLRF 77
52 0153: DECFSZ 77,F
53 0154: GOTO 153
54 0155: DECFSZ 78,F
55 0156: GOTO 152
56 0157: MOVLW 97
57 0158: MOVWF 77
58 0159: DECFSZ 77,F
59 015A: GOTO 159
60 015B: DECFSZ 00,F
61 015C: GOTO 150
62 015D: RETURN
63 ....................
64 ....................
65 ....................
66 .................... #define EEPROM_SDA PIN_B0
67 .................... #define EEPROM_SCL PIN_B1
68 .................... #use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL)
69 *
70 00A5: MOVLW 08
71 00A6: MOVWF 78
72 00A7: NOP
73 00A8: BCF 06.1
74 00A9: BSF 03.5
75 00AA: BCF 06.1
76 00AB: NOP
77 00AC: BCF 03.5
78 00AD: RLF 3E,F
79 00AE: BCF 06.0
80 00AF: BTFSS 03.0
81 00B0: GOTO 0B4
82 00B1: BSF 03.5
83 00B2: BSF 06.0
84 00B3: BCF 03.5
85 00B4: BTFSC 03.0
86 00B5: GOTO 0B9
87 00B6: BSF 03.5
88 00B7: BCF 06.0
89 00B8: BCF 03.5
90 00B9: BSF 03.5
91 00BA: BSF 06.1
92 00BB: BCF 03.5
93 00BC: BTFSS 06.1
94 00BD: GOTO 0BC
95 00BE: DECFSZ 78,F
96 00BF: GOTO 0A7
97 00C0: NOP
98 00C1: BCF 06.1
99 00C2: BSF 03.5
100 00C3: BCF 06.1
101 00C4: NOP
102 00C5: BSF 06.0
103 00C6: NOP
104 00C7: NOP
105 00C8: BSF 06.1
106 00C9: BCF 03.5
107 00CA: BTFSS 06.1
108 00CB: GOTO 0CA
109 00CC: CLRF 78
110 00CD: NOP
111 00CE: BTFSC 06.0
112 00CF: BSF 78.0
113 00D0: BCF 06.1
114 00D1: BSF 03.5
115 00D2: BCF 06.1
116 00D3: BCF 03.5
117 00D4: BCF 06.0
118 00D5: BSF 03.5
119 00D6: BCF 06.0
120 00D7: BCF 03.5
121 00D8: RETURN
122 *
123 0188: MOVLW 08
124 0189: MOVWF 3F
125 018A: MOVF 77,W
126 018B: MOVWF 40
127 018C: BSF 03.5
128 018D: BSF 06.0
129 018E: NOP
130 018F: BSF 06.1
131 0190: BCF 03.5
132 0191: BTFSS 06.1
133 0192: GOTO 191
134 0193: BTFSC 06.0
135 0194: BSF 03.0
136 0195: BTFSS 06.0
137 0196: BCF 03.0
138 0197: RLF 78,F
139 0198: NOP
140 0199: BSF 03.5
141 019A: BCF 06.1
142 019B: BCF 03.5
143 019C: BCF 06.1
144 019D: DECFSZ 3F,F
145 019E: GOTO 18C
146 019F: BSF 03.5
147 01A0: BSF 06.0
148 01A1: NOP
149 01A2: BCF 03.5
150 01A3: BCF 06.0
151 01A4: MOVF 40,W
152 01A5: BTFSC 03.2
153 01A6: GOTO 1AA
154 01A7: BSF 03.5
155 01A8: BCF 06.0
156 01A9: BCF 03.5
157 01AA: NOP
158 01AB: BSF 03.5
159 01AC: BSF 06.1
160 01AD: BCF 03.5
161 01AE: BTFSS 06.1
162 01AF: GOTO 1AE
163 01B0: NOP
164 01B1: BCF 06.1
165 01B2: BSF 03.5
166 01B3: BCF 06.1
167 01B4: NOP
168 01B5: BCF 03.5
169 01B6: BCF 06.0
170 01B7: BSF 03.5
171 01B8: BCF 06.0
172 .................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD
173 *
174 003B: BSF 03.5
175 003C: BCF 06.3
176 003D: BCF 03.5
177 003E: BCF 06.3
178 003F: MOVLW 08
179 0040: MOVWF 78
180 0041: GOTO 042
181 0042: NOP
182 0043: BSF 78.7
183 0044: GOTO 053
184 0045: BCF 78.7
185 0046: RRF 3A,F
186 0047: BTFSC 03.0
187 0048: BSF 06.3
188 0049: BTFSS 03.0
189 004A: BCF 06.3
190 004B: BSF 78.6
191 004C: GOTO 053
192 004D: BCF 78.6
193 004E: DECFSZ 78,F
194 004F: GOTO 046
195 0050: GOTO 051
196 0051: NOP
197 0052: BSF 06.3
198 0053: MOVLW 3F
199 0054: MOVWF 04
200 0055: DECFSZ 04,F
201 0056: GOTO 055
202 0057: NOP
203 0058: BTFSC 78.7
204 0059: GOTO 045
205 005A: BTFSC 78.6
206 005B: GOTO 04D
207 005C: RETURN
208 ....................
209 .................... #define MPL3115_ADDR_R 0xC1 //addresa pro cteni
210 .................... #define MPL3115_ADDR_W 0xC0
211 ....................
212 ....................
213 .................... void mpl3115_setA (void) //nastavení pro výšku
214 .................... {
215 ....................
216 ....................
217 .................... i2c_start(); //STANDBY mode
218 *
219 04F9: BSF 03.5
220 04FA: BSF 06.0
221 04FB: NOP
222 04FC: BSF 06.1
223 04FD: NOP
224 04FE: BCF 03.5
225 04FF: BCF 06.0
226 0500: BSF 03.5
227 0501: BCF 06.0
228 0502: NOP
229 0503: BCF 03.5
230 0504: BCF 06.1
231 0505: BSF 03.5
232 0506: BCF 06.1
233 .................... I2C_Write(MPL3115_ADDR_W);
234 0507: MOVLW C0
235 0508: BCF 03.5
236 0509: MOVWF 3E
237 050A: CALL 0A5
238 .................... I2C_write(0x26);
239 050B: MOVLW 26
240 050C: MOVWF 3E
241 050D: CALL 0A5
242 .................... I2C_write(0xB8);
243 050E: MOVLW B8
244 050F: MOVWF 3E
245 0510: CALL 0A5
246 .................... i2c_stop();
247 0511: BSF 03.5
248 0512: BCF 06.0
249 0513: NOP
250 0514: BSF 06.1
251 0515: BCF 03.5
252 0516: BTFSS 06.1
253 0517: GOTO 516
254 0518: NOP
255 0519: GOTO 51A
256 051A: NOP
257 051B: BSF 03.5
258 051C: BSF 06.0
259 051D: NOP
260 ....................
261 .................... i2c_start(); //PT_DATA_CFG set
262 051E: BSF 06.0
263 051F: NOP
264 0520: BSF 06.1
265 0521: NOP
266 0522: BCF 03.5
267 0523: BCF 06.0
268 0524: BSF 03.5
269 0525: BCF 06.0
270 0526: NOP
271 0527: BCF 03.5
272 0528: BCF 06.1
273 0529: BSF 03.5
274 052A: BCF 06.1
275 .................... I2C_Write(MPL3115_ADDR_W);
276 052B: MOVLW C0
277 052C: BCF 03.5
278 052D: MOVWF 3E
279 052E: CALL 0A5
280 .................... I2C_write(0x13);
281 052F: MOVLW 13
282 0530: MOVWF 3E
283 0531: CALL 0A5
284 .................... I2C_write(0x07); //hodnota
285 0532: MOVLW 07
286 0533: MOVWF 3E
287 0534: CALL 0A5
288 .................... i2c_stop();
289 0535: BSF 03.5
290 0536: BCF 06.0
291 0537: NOP
292 0538: BSF 06.1
293 0539: BCF 03.5
294 053A: BTFSS 06.1
295 053B: GOTO 53A
296 053C: NOP
297 053D: GOTO 53E
298 053E: NOP
299 053F: BSF 03.5
300 0540: BSF 06.0
301 0541: NOP
302 ....................
303 .................... i2c_start(); //ACTIVE mode
304 0542: BSF 06.0
305 0543: NOP
306 0544: BSF 06.1
307 0545: NOP
308 0546: BCF 03.5
309 0547: BCF 06.0
310 0548: BSF 03.5
311 0549: BCF 06.0
312 054A: NOP
313 054B: BCF 03.5
314 054C: BCF 06.1
315 054D: BSF 03.5
316 054E: BCF 06.1
317 .................... I2C_Write(MPL3115_ADDR_W);
318 054F: MOVLW C0
319 0550: BCF 03.5
320 0551: MOVWF 3E
321 0552: CALL 0A5
322 .................... I2C_write(0x26);
323 0553: MOVLW 26
324 0554: MOVWF 3E
325 0555: CALL 0A5
326 .................... I2C_write(0xB9);
327 0556: MOVLW B9
328 0557: MOVWF 3E
329 0558: CALL 0A5
330 .................... i2c_stop();
331 0559: BSF 03.5
332 055A: BCF 06.0
333 055B: NOP
334 055C: BSF 06.1
335 055D: BCF 03.5
336 055E: BTFSS 06.1
337 055F: GOTO 55E
338 0560: NOP
339 0561: GOTO 562
340 0562: NOP
341 0563: BSF 03.5
342 0564: BSF 06.0
343 0565: NOP
344 .................... }
345 0566: BCF 03.5
346 0567: BSF 0A.3
347 0568: BCF 0A.4
348 0569: GOTO 046 (RETURN)
349 ....................
350 .................... void mpl3115_setP (void) //nastavení pro tlak
351 .................... {
352 ....................
353 ....................
354 .................... i2c_start(); //STANDBY mode
355 *
356 00D9: BSF 03.5
357 00DA: BSF 06.0
358 00DB: NOP
359 00DC: BSF 06.1
360 00DD: NOP
361 00DE: BCF 03.5
362 00DF: BCF 06.0
363 00E0: BSF 03.5
364 00E1: BCF 06.0
365 00E2: NOP
366 00E3: BCF 03.5
367 00E4: BCF 06.1
368 00E5: BSF 03.5
369 00E6: BCF 06.1
370 .................... I2C_Write(MPL3115_ADDR_W);
371 00E7: MOVLW C0
372 00E8: BCF 03.5
373 00E9: MOVWF 3E
374 00EA: CALL 0A5
375 .................... I2C_write(0x26);
376 00EB: MOVLW 26
377 00EC: MOVWF 3E
378 00ED: CALL 0A5
379 .................... I2C_write(0xB8);
380 00EE: MOVLW B8
381 00EF: MOVWF 3E
382 00F0: CALL 0A5
383 .................... i2c_stop();
384 00F1: BSF 03.5
385 00F2: BCF 06.0
386 00F3: NOP
387 00F4: BSF 06.1
388 00F5: BCF 03.5
389 00F6: BTFSS 06.1
390 00F7: GOTO 0F6
391 00F8: NOP
392 00F9: GOTO 0FA
393 00FA: NOP
394 00FB: BSF 03.5
395 00FC: BSF 06.0
396 00FD: NOP
397 ....................
398 .................... i2c_start(); //PT_DATA_CFG set
399 00FE: BSF 06.0
400 00FF: NOP
401 0100: BSF 06.1
402 0101: NOP
403 0102: BCF 03.5
404 0103: BCF 06.0
405 0104: BSF 03.5
406 0105: BCF 06.0
407 0106: NOP
408 0107: BCF 03.5
409 0108: BCF 06.1
410 0109: BSF 03.5
411 010A: BCF 06.1
412 .................... I2C_Write(MPL3115_ADDR_W);
413 010B: MOVLW C0
414 010C: BCF 03.5
415 010D: MOVWF 3E
416 010E: CALL 0A5
417 .................... I2C_write(0x13);
418 010F: MOVLW 13
419 0110: MOVWF 3E
420 0111: CALL 0A5
421 .................... I2C_write(0x07); //hodnota
422 0112: MOVLW 07
423 0113: MOVWF 3E
424 0114: CALL 0A5
425 .................... i2c_stop();
426 0115: BSF 03.5
427 0116: BCF 06.0
428 0117: NOP
429 0118: BSF 06.1
430 0119: BCF 03.5
431 011A: BTFSS 06.1
432 011B: GOTO 11A
433 011C: NOP
434 011D: GOTO 11E
435 011E: NOP
436 011F: BSF 03.5
437 0120: BSF 06.0
438 0121: NOP
439 ....................
440 .................... i2c_start(); //ACTIVE mode
441 0122: BSF 06.0
442 0123: NOP
443 0124: BSF 06.1
444 0125: NOP
445 0126: BCF 03.5
446 0127: BCF 06.0
447 0128: BSF 03.5
448 0129: BCF 06.0
449 012A: NOP
450 012B: BCF 03.5
451 012C: BCF 06.1
452 012D: BSF 03.5
453 012E: BCF 06.1
454 .................... I2C_Write(MPL3115_ADDR_W);
455 012F: MOVLW C0
456 0130: BCF 03.5
457 0131: MOVWF 3E
458 0132: CALL 0A5
459 .................... I2C_write(0x26);
460 0133: MOVLW 26
461 0134: MOVWF 3E
462 0135: CALL 0A5
463 .................... I2C_write(0x39);
464 0136: MOVLW 39
465 0137: MOVWF 3E
466 0138: CALL 0A5
467 .................... i2c_stop();
468 0139: BSF 03.5
469 013A: BCF 06.0
470 013B: NOP
471 013C: BSF 06.1
472 013D: BCF 03.5
473 013E: BTFSS 06.1
474 013F: GOTO 13E
475 0140: NOP
476 0141: GOTO 142
477 0142: NOP
478 0143: BSF 03.5
479 0144: BSF 06.0
480 0145: NOP
481 .................... }
482 0146: BCF 03.5
483 0147: BSF 0A.3
484 0148: BCF 0A.4
485 0149: GOTO 024 (RETURN)
486 ....................
487 ....................
488 .................... byte mpl3115_read (byte reg)
489 .................... {
490 .................... byte i;
491 ....................
492 .................... i2c_start();
493 *
494 015E: BSF 03.5
495 015F: BSF 06.0
496 0160: NOP
497 0161: BSF 06.1
498 0162: NOP
499 0163: BCF 03.5
500 0164: BCF 06.0
501 0165: BSF 03.5
502 0166: BCF 06.0
503 0167: NOP
504 0168: BCF 03.5
505 0169: BCF 06.1
506 016A: BSF 03.5
507 016B: BCF 06.1
508 .................... I2C_Write(MPL3115_ADDR_W);
509 016C: MOVLW C0
510 016D: BCF 03.5
511 016E: MOVWF 3E
512 016F: CALL 0A5
513 .................... I2C_write(reg);
514 0170: MOVF 3C,W
515 0171: MOVWF 3E
516 0172: CALL 0A5
517 .................... i2c_start();
518 0173: BSF 03.5
519 0174: BSF 06.0
520 0175: NOP
521 0176: BSF 06.1
522 0177: NOP
523 0178: BCF 03.5
524 0179: BTFSS 06.1
525 017A: GOTO 179
526 017B: BCF 06.0
527 017C: BSF 03.5
528 017D: BCF 06.0
529 017E: NOP
530 017F: BCF 03.5
531 0180: BCF 06.1
532 0181: BSF 03.5
533 0182: BCF 06.1
534 .................... I2C_Write(MPL3115_ADDR_R);
535 0183: MOVLW C1
536 0184: BCF 03.5
537 0185: MOVWF 3E
538 0186: CALL 0A5
539 .................... i=i2c_read(0);
540 0187: CLRF 77
541 *
542 01B9: MOVF 78,W
543 01BA: BCF 03.5
544 01BB: MOVWF 3D
545 .................... i2c_stop();
546 01BC: BSF 03.5
547 01BD: BCF 06.0
548 01BE: NOP
549 01BF: BSF 06.1
550 01C0: BCF 03.5
551 01C1: BTFSS 06.1
552 01C2: GOTO 1C1
553 01C3: NOP
554 01C4: GOTO 1C5
555 01C5: NOP
556 01C6: BSF 03.5
557 01C7: BSF 06.0
558 01C8: NOP
559 ....................
560 .................... return i;
561 01C9: BCF 03.5
562 01CA: MOVF 3D,W
563 01CB: MOVWF 78
564 .................... }
565 01CC: RETURN
566 ....................
567 ....................
568 .................... float mpl3115_T (void) //teplota ve stupnich
569 .................... {
570 .................... int m;
571 .................... float l, t;
572 ....................
573 .................... m= mpl3115_read (0x04);
574 *
575 03F5: MOVLW 04
576 03F6: MOVWF 3C
577 03F7: CALL 15E
578 03F8: MOVF 78,W
579 03F9: MOVWF 2D
580 .................... l= (float)(mpl3115_read(0x05)>>4)/16.0;
581 03FA: MOVLW 05
582 03FB: MOVWF 3C
583 03FC: CALL 15E
584 03FD: SWAPF 78,W
585 03FE: MOVWF 77
586 03FF: MOVLW 0F
587 0400: ANDWF 77,F
588 0401: MOVF 77,W
589 0402: CLRF 3E
590 0403: MOVWF 3D
591 0404: CALL 1CD
592 0405: MOVF 77,W
593 0406: MOVWF 36
594 0407: MOVF 78,W
595 0408: MOVWF 37
596 0409: MOVF 79,W
597 040A: MOVWF 38
598 040B: MOVF 7A,W
599 040C: MOVWF 39
600 040D: MOVWF 44
601 040E: MOVF 79,W
602 040F: MOVWF 43
603 0410: MOVF 78,W
604 0411: MOVWF 42
605 0412: MOVF 77,W
606 0413: MOVWF 41
607 0414: CLRF 48
608 0415: CLRF 47
609 0416: CLRF 46
610 0417: MOVLW 83
611 0418: MOVWF 45
612 0419: CALL 1EA
613 041A: MOVF 7A,W
614 041B: MOVWF 31
615 041C: MOVF 79,W
616 041D: MOVWF 30
617 041E: MOVF 78,W
618 041F: MOVWF 2F
619 0420: MOVF 77,W
620 0421: MOVWF 2E
621 .................... t = (float)(M + L);
622 0422: CLRF 3E
623 0423: MOVF 2D,W
624 0424: MOVWF 3D
625 0425: CALL 1CD
626 0426: BCF 03.1
627 0427: MOVF 7A,W
628 0428: MOVWF 46
629 0429: MOVF 79,W
630 042A: MOVWF 45
631 042B: MOVF 78,W
632 042C: MOVWF 44
633 042D: MOVF 77,W
634 042E: MOVWF 43
635 042F: MOVF 31,W
636 0430: MOVWF 4A
637 0431: MOVF 30,W
638 0432: MOVWF 49
639 0433: MOVF 2F,W
640 0434: MOVWF 48
641 0435: MOVF 2E,W
642 0436: MOVWF 47
643 0437: CALL 2B4
644 0438: MOVF 7A,W
645 0439: MOVWF 35
646 043A: MOVF 79,W
647 043B: MOVWF 34
648 043C: MOVF 78,W
649 043D: MOVWF 33
650 043E: MOVF 77,W
651 043F: MOVWF 32
652 .................... return t;
653 0440: MOVF 32,W
654 0441: MOVWF 77
655 0442: MOVF 33,W
656 0443: MOVWF 78
657 0444: MOVF 34,W
658 0445: MOVWF 79
659 0446: MOVF 35,W
660 0447: MOVWF 7A
661 .................... }
662 0448: BSF 0A.3
663 0449: BCF 0A.4
664 044A: GOTO 030 (RETURN)
665 ....................
666 .................... float mpl3115_A (void) //vyska v m
667 .................... {
668 ....................
669 .................... int16 m;
670 .................... unsigned int8 c;
671 .................... float l, a;
672 ....................
673 .................... m= mpl3115_read (0x01);
674 *
675 056A: MOVLW 01
676 056B: MOVWF 3C
677 056C: CALL 15E
678 056D: CLRF 2E
679 056E: MOVF 78,W
680 056F: MOVWF 2D
681 .................... c= mpl3115_read (0x02);
682 0570: MOVLW 02
683 0571: MOVWF 3C
684 0572: CALL 15E
685 0573: MOVF 78,W
686 0574: MOVWF 2F
687 .................... l= (float)(mpl3115_read(0x03)>>4)/16.0;
688 0575: MOVLW 03
689 0576: MOVWF 3C
690 0577: CALL 15E
691 0578: SWAPF 78,W
692 0579: MOVWF 77
693 057A: MOVLW 0F
694 057B: ANDWF 77,F
695 057C: MOVF 77,W
696 057D: CLRF 3E
697 057E: MOVWF 3D
698 057F: CALL 1CD
699 0580: MOVF 77,W
700 0581: MOVWF 38
701 0582: MOVF 78,W
702 0583: MOVWF 39
703 0584: MOVF 79,W
704 0585: MOVWF 3A
705 0586: MOVF 7A,W
706 0587: MOVWF 3B
707 0588: MOVWF 44
708 0589: MOVF 79,W
709 058A: MOVWF 43
710 058B: MOVF 78,W
711 058C: MOVWF 42
712 058D: MOVF 77,W
713 058E: MOVWF 41
714 058F: CLRF 48
715 0590: CLRF 47
716 0591: CLRF 46
717 0592: MOVLW 83
718 0593: MOVWF 45
719 0594: CALL 1EA
720 0595: MOVF 7A,W
721 0596: MOVWF 33
722 0597: MOVF 79,W
723 0598: MOVWF 32
724 0599: MOVF 78,W
725 059A: MOVWF 31
726 059B: MOVF 77,W
727 059C: MOVWF 30
728 .................... a = (float)((m << 8)|c) + l;
729 059D: MOVF 2D,W
730 059E: MOVWF 3A
731 059F: CLRF 39
732 05A0: MOVF 39,W
733 05A1: IORWF 2F,W
734 05A2: MOVWF 77
735 05A3: MOVF 2D,W
736 05A4: MOVWF 7A
737 05A5: MOVF 77,W
738 05A6: MOVWF 3D
739 05A7: MOVF 2D,W
740 05A8: MOVWF 3E
741 05A9: CALL 1CD
742 05AA: MOVF 77,W
743 05AB: MOVWF 39
744 05AC: MOVF 78,W
745 05AD: MOVWF 3A
746 05AE: MOVF 79,W
747 05AF: MOVWF 3B
748 05B0: MOVF 7A,W
749 05B1: MOVWF 3C
750 05B2: BCF 03.1
751 05B3: MOVF 7A,W
752 05B4: MOVWF 46
753 05B5: MOVF 79,W
754 05B6: MOVWF 45
755 05B7: MOVF 78,W
756 05B8: MOVWF 44
757 05B9: MOVF 77,W
758 05BA: MOVWF 43
759 05BB: MOVF 33,W
760 05BC: MOVWF 4A
761 05BD: MOVF 32,W
762 05BE: MOVWF 49
763 05BF: MOVF 31,W
764 05C0: MOVWF 48
765 05C1: MOVF 30,W
766 05C2: MOVWF 47
767 05C3: CALL 2B4
768 05C4: MOVF 7A,W
769 05C5: MOVWF 37
770 05C6: MOVF 79,W
771 05C7: MOVWF 36
772 05C8: MOVF 78,W
773 05C9: MOVWF 35
774 05CA: MOVF 77,W
775 05CB: MOVWF 34
776 .................... return a;
777 05CC: MOVF 34,W
778 05CD: MOVWF 77
779 05CE: MOVF 35,W
780 05CF: MOVWF 78
781 05D0: MOVF 36,W
782 05D1: MOVWF 79
783 05D2: MOVF 37,W
784 05D3: MOVWF 7A
785 .................... }
786 05D4: BSF 0A.3
787 05D5: BCF 0A.4
788 05D6: GOTO 052 (RETURN)
789 ....................
790 ....................
791 .................... float mpl3115_P (void) //tlak v Pa
792 .................... {
793 .................... unsigned int32 m;
794 .................... unsigned int16 c;
795 .................... unsigned int l;
796 .................... float p, l1;
797 ....................
798 .................... m= mpl3115_read (0x01);
799 *
800 044B: MOVLW 01
801 044C: MOVWF 3C
802 044D: CALL 15E
803 044E: CLRF 30
804 044F: CLRF 2F
805 0450: CLRF 2E
806 0451: MOVF 78,W
807 0452: MOVWF 2D
808 .................... c= mpl3115_read (0x02);
809 0453: MOVLW 02
810 0454: MOVWF 3C
811 0455: CALL 15E
812 0456: CLRF 32
813 0457: MOVF 78,W
814 0458: MOVWF 31
815 .................... l=mpl3115_read(0x03);
816 0459: MOVLW 03
817 045A: MOVWF 3C
818 045B: CALL 15E
819 045C: MOVF 78,W
820 045D: MOVWF 33
821 ....................
822 .................... l1= (float)(l>>4)/4.0;
823 045E: SWAPF 33,W
824 045F: MOVWF 77
825 0460: MOVLW 0F
826 0461: ANDWF 77,F
827 0462: MOVF 77,W
828 0463: CLRF 3E
829 0464: MOVWF 3D
830 0465: CALL 1CD
831 0466: MOVF 77,W
832 0467: MOVWF 3D
833 0468: MOVF 78,W
834 0469: MOVWF 3E
835 046A: MOVF 79,W
836 046B: MOVWF 3F
837 046C: MOVF 7A,W
838 046D: MOVWF 40
839 046E: MOVWF 44
840 046F: MOVF 79,W
841 0470: MOVWF 43
842 0471: MOVF 78,W
843 0472: MOVWF 42
844 0473: MOVF 77,W
845 0474: MOVWF 41
846 0475: CLRF 48
847 0476: CLRF 47
848 0477: CLRF 46
849 0478: MOVLW 81
850 0479: MOVWF 45
851 047A: CALL 1EA
852 047B: MOVF 7A,W
853 047C: MOVWF 3B
854 047D: MOVF 79,W
855 047E: MOVWF 3A
856 047F: MOVF 78,W
857 0480: MOVWF 39
858 0481: MOVF 77,W
859 0482: MOVWF 38
860 .................... p = (float)((m << 10)|(c<<2)|(l>>6)) + l1;
861 0483: CLRF 3D
862 0484: RLF 2D,W
863 0485: MOVWF 3E
864 0486: RLF 2E,W
865 0487: MOVWF 3F
866 0488: RLF 2F,W
867 0489: MOVWF 40
868 048A: RLF 3E,F
869 048B: RLF 3F,F
870 048C: RLF 40,F
871 048D: MOVLW FC
872 048E: ANDWF 3E,F
873 048F: RLF 31,W
874 0490: MOVWF 79
875 0491: RLF 32,W
876 0492: MOVWF 7A
877 0493: RLF 79,F
878 0494: RLF 7A,F
879 0495: MOVLW FC
880 0496: ANDWF 79,F
881 0497: MOVF 79,W
882 0498: IORWF 3D,F
883 0499: MOVF 7A,W
884 049A: IORWF 3E,F
885 049B: SWAPF 33,W
886 049C: MOVWF 77
887 049D: RRF 77,F
888 049E: RRF 77,F
889 049F: MOVLW 03
890 04A0: ANDWF 77,F
891 04A1: MOVF 77,W
892 04A2: IORWF 3D,W
893 04A3: MOVWF 77
894 04A4: MOVF 3E,W
895 04A5: MOVWF 78
896 04A6: MOVF 3F,W
897 04A7: MOVWF 79
898 04A8: MOVF 40,W
899 04A9: MOVWF 7A
900 04AA: MOVF 7A,W
901 04AB: MOVWF 46
902 04AC: MOVF 79,W
903 04AD: MOVWF 45
904 04AE: MOVF 78,W
905 04AF: MOVWF 44
906 04B0: MOVF 77,W
907 04B1: MOVWF 43
908 *
909 04CC: MOVF 77,W
910 04CD: MOVWF 3D
911 04CE: MOVF 78,W
912 04CF: MOVWF 3E
913 04D0: MOVF 79,W
914 04D1: MOVWF 3F
915 04D2: MOVF 7A,W
916 04D3: MOVWF 40
917 04D4: BCF 03.1
918 04D5: MOVF 7A,W
919 04D6: MOVWF 46
920 04D7: MOVF 79,W
921 04D8: MOVWF 45
922 04D9: MOVF 78,W
923 04DA: MOVWF 44
924 04DB: MOVF 77,W
925 04DC: MOVWF 43
926 04DD: MOVF 3B,W
927 04DE: MOVWF 4A
928 04DF: MOVF 3A,W
929 04E0: MOVWF 49
930 04E1: MOVF 39,W
931 04E2: MOVWF 48
932 04E3: MOVF 38,W
933 04E4: MOVWF 47
934 04E5: CALL 2B4
935 04E6: MOVF 7A,W
936 04E7: MOVWF 37
937 04E8: MOVF 79,W
938 04E9: MOVWF 36
939 04EA: MOVF 78,W
940 04EB: MOVWF 35
941 04EC: MOVF 77,W
942 04ED: MOVWF 34
943 ....................
944 .................... return p;
945 04EE: MOVF 34,W
946 04EF: MOVWF 77
947 04F0: MOVF 35,W
948 04F1: MOVWF 78
949 04F2: MOVF 36,W
950 04F3: MOVWF 79
951 04F4: MOVF 37,W
952 04F5: MOVWF 7A
953 .................... }
954 04F6: BSF 0A.3
955 04F7: BCF 0A.4
956 04F8: GOTO 03B (RETURN)
957 ....................
958 .................... void main()
959 .................... {
960 *
961 0800: CLRF 04
962 0801: BCF 03.7
963 0802: MOVLW 1F
964 0803: ANDWF 03,F
965 0804: MOVLW 71
966 0805: BSF 03.5
967 0806: MOVWF 0F
968 0807: MOVF 0F,W
969 0808: BCF 06.3
970 0809: BCF 03.5
971 080A: BSF 06.3
972 080B: BSF 03.5
973 080C: BSF 03.6
974 080D: MOVF 09,W
975 080E: ANDLW C0
976 080F: MOVWF 09
977 0810: BCF 03.6
978 0811: BCF 1F.4
979 0812: BCF 1F.5
980 0813: MOVLW 00
981 0814: BSF 03.6
982 0815: MOVWF 08
983 0816: BCF 03.5
984 0817: CLRF 07
985 0818: CLRF 08
986 0819: CLRF 09
987 ....................
988 .................... float p, t, a;
989 .................... printf("Tlakomer nebo vyskomer \r\n",);
990 081A: MOVLW 04
991 081B: MOVWF 0D
992 081C: MOVLW 00
993 081D: MOVWF 0F
994 081E: BCF 0A.3
995 081F: BCF 03.6
996 0820: GOTO 05D
997 0821: BSF 0A.3
998 ....................
999 .................... while(TRUE)
1000 .................... {
1001 .................... mpl3115_setP(); //nastaveni pro tlak a teplotu
1002 0822: BCF 0A.3
1003 0823: GOTO 0D9
1004 0824: BSF 0A.3
1005 .................... delay_ms (500);
1006 0825: MOVLW 02
1007 0826: MOVWF 2D
1008 0827: MOVLW FA
1009 0828: MOVWF 2E
1010 0829: BCF 0A.3
1011 082A: CALL 14A
1012 082B: BSF 0A.3
1013 082C: DECFSZ 2D,F
1014 082D: GOTO 027
1015 .................... t=mpl3115_T();
1016 082E: BCF 0A.3
1017 082F: GOTO 3F5
1018 0830: BSF 0A.3
1019 0831: MOVF 7A,W
1020 0832: MOVWF 28
1021 0833: MOVF 79,W
1022 0834: MOVWF 27
1023 0835: MOVF 78,W
1024 0836: MOVWF 26
1025 0837: MOVF 77,W
1026 0838: MOVWF 25
1027 .................... p=mpl3115_P();
1028 0839: BCF 0A.3
1029 083A: GOTO 44B
1030 083B: BSF 0A.3
1031 083C: MOVF 7A,W
1032 083D: MOVWF 24
1033 083E: MOVF 79,W
1034 083F: MOVWF 23
1035 0840: MOVF 78,W
1036 0841: MOVWF 22
1037 0842: MOVF 77,W
1038 0843: MOVWF 21
1039 ....................
1040 .................... mpl3115_setA(); //nastaveni pro vysku a teplotu
1041 0844: BCF 0A.3
1042 0845: GOTO 4F9
1043 0846: BSF 0A.3
1044 .................... delay_ms (500);
1045 0847: MOVLW 02
1046 0848: MOVWF 2D
1047 0849: MOVLW FA
1048 084A: MOVWF 2E
1049 084B: BCF 0A.3
1050 084C: CALL 14A
1051 084D: BSF 0A.3
1052 084E: DECFSZ 2D,F
1053 084F: GOTO 049
1054 .................... a=mpl3115_A();
1055 0850: BCF 0A.3
1056 0851: GOTO 56A
1057 0852: BSF 0A.3
1058 0853: MOVF 7A,W
1059 0854: MOVWF 2C
1060 0855: MOVF 79,W
1061 0856: MOVWF 2B
1062 0857: MOVF 78,W
1063 0858: MOVWF 2A
1064 0859: MOVF 77,W
1065 085A: MOVWF 29
1066 ....................
1067 ....................
1068 .................... printf("Teplota: %10.4f(stupne)\r\n", t);
1069 085B: MOVLW 11
1070 085C: BSF 03.6
1071 085D: MOVWF 0D
1072 085E: MOVLW 00
1073 085F: MOVWF 0F
1074 0860: BCF 03.0
1075 0861: MOVLW 09
1076 0862: BCF 03.6
1077 0863: MOVWF 2D
1078 0864: BCF 0A.3
1079 0865: CALL 5D7
1080 0866: BSF 0A.3
1081 0867: MOVLW 09
1082 0868: MOVWF 04
1083 0869: MOVF 28,W
1084 086A: MOVWF 30
1085 086B: MOVF 27,W
1086 086C: MOVWF 2F
1087 086D: MOVF 26,W
1088 086E: MOVWF 2E
1089 086F: MOVF 25,W
1090 0870: MOVWF 2D
1091 0871: MOVLW 04
1092 0872: MOVWF 31
1093 0873: BCF 0A.3
1094 0874: CALL 668
1095 0875: BSF 0A.3
1096 0876: MOVLW 18
1097 0877: BSF 03.6
1098 0878: MOVWF 0D
1099 0879: MOVLW 00
1100 087A: MOVWF 0F
1101 087B: BSF 03.0
1102 087C: MOVLW 0A
1103 087D: BCF 03.6
1104 087E: MOVWF 2D
1105 087F: BCF 0A.3
1106 0880: CALL 5D7
1107 0881: BSF 0A.3
1108 .................... printf("Tlak: %10.4f(Pa)\r\n", p);
1109 0882: MOVLW 1E
1110 0883: BSF 03.6
1111 0884: MOVWF 0D
1112 0885: MOVLW 00
1113 0886: MOVWF 0F
1114 0887: BCF 03.0
1115 0888: MOVLW 06
1116 0889: BCF 03.6
1117 088A: MOVWF 2D
1118 088B: BCF 0A.3
1119 088C: CALL 5D7
1120 088D: BSF 0A.3
1121 088E: MOVLW 09
1122 088F: MOVWF 04
1123 0890: MOVF 24,W
1124 0891: MOVWF 30
1125 0892: MOVF 23,W
1126 0893: MOVWF 2F
1127 0894: MOVF 22,W
1128 0895: MOVWF 2E
1129 0896: MOVF 21,W
1130 0897: MOVWF 2D
1131 0898: MOVLW 04
1132 0899: MOVWF 31
1133 089A: BCF 0A.3
1134 089B: CALL 668
1135 089C: BSF 0A.3
1136 089D: MOVLW 24
1137 089E: BSF 03.6
1138 089F: MOVWF 0D
1139 08A0: MOVLW 00
1140 08A1: MOVWF 0F
1141 08A2: BCF 03.0
1142 08A3: MOVLW 06
1143 08A4: BCF 03.6
1144 08A5: MOVWF 2D
1145 08A6: BCF 0A.3
1146 08A7: CALL 5D7
1147 08A8: BSF 0A.3
1148 .................... printf("Výška: %10.4f(m)\r\n", a);
1149 08A9: MOVLW 28
1150 08AA: BSF 03.6
1151 08AB: MOVWF 0D
1152 08AC: MOVLW 00
1153 08AD: MOVWF 0F
1154 08AE: MOVLW 07
1155 08AF: BCF 03.6
1156 08B0: MOVWF 2D
1157 08B1: BCF 0A.3
1158 08B2: CALL 7C2
1159 08B3: BSF 0A.3
1160 08B4: MOVLW 09
1161 08B5: MOVWF 04
1162 08B6: MOVF 2C,W
1163 08B7: MOVWF 30
1164 08B8: MOVF 2B,W
1165 08B9: MOVWF 2F
1166 08BA: MOVF 2A,W
1167 08BB: MOVWF 2E
1168 08BC: MOVF 29,W
1169 08BD: MOVWF 2D
1170 08BE: MOVLW 04
1171 08BF: MOVWF 31
1172 08C0: BCF 0A.3
1173 08C1: CALL 668
1174 08C2: BSF 0A.3
1175 08C3: MOVLW 35
1176 08C4: BSF 03.6
1177 08C5: MOVWF 0D
1178 08C6: MOVLW 00
1179 08C7: MOVWF 0F
1180 08C8: MOVLW 05
1181 08C9: BCF 03.6
1182 08CA: MOVWF 2D
1183 08CB: BCF 0A.3
1184 08CC: CALL 7C2
1185 08CD: BSF 0A.3
1186 ....................
1187 .................... delay_ms (1000);
1188 08CE: MOVLW 04
1189 08CF: MOVWF 2D
1190 08D0: MOVLW FA
1191 08D1: MOVWF 2E
1192 08D2: BCF 0A.3
1193 08D3: CALL 14A
1194 08D4: BSF 0A.3
1195 08D5: DECFSZ 2D,F
1196 08D6: GOTO 0D0
1197 .................... }
1198 08D7: GOTO 022
1199 ....................
1200 ....................
1201 .................... }
1202 ....................
1203 ....................
1204 08D8: SLEEP
1205  
1206 Configuration Fuses:
1207 Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
1208 Word 2: 3FFF NOWRT BORV40