Rev Author Line No. Line
2909 kaklik 1 CCS PCM C Compiler, Version 4.106, 47914 14-IV-13 01:31
2906 jacho 2  
2909 kaklik 3 Filename: D:\MLAB\Modules\Sensors\SHT25V01A\SW\PIC16F887\main.lst
2906 jacho 4  
2909 kaklik 5 ROM used: 2165 words (26%)
2906 jacho 6 Largest free fragment is 2048
2909 kaklik 7 RAM used: 10 (3%) at main() level
8 36 (10%) worst case
2906 jacho 9 Stack: 2 locations
10  
11 *
2909 kaklik 12 0000: MOVLW 08
2906 jacho 13 0001: MOVWF 0A
2909 kaklik 14 0002: GOTO 000
2906 jacho 15 0003: NOP
2908 kaklik 16 .................... #include "main.h"
2906 jacho 17 .................... #include <16F887.h>
18 .................... //////// Standard Header file for the PIC16F887 device ////////////////
19 .................... #device PIC16F887
20 .................... #list
21 ....................
22 .................... #device adc=8
23 ....................
2908 kaklik 24 .................... #FUSES NOWDT //No Watch Dog Timer
2909 kaklik 25 .................... #FUSES INTRC_IO //Internal RC Osc
2908 kaklik 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
2906 jacho 37 ....................
38 .................... #use delay(clock=8000000)
39 *
2909 kaklik 40 009A: MOVLW 26
41 009B: MOVWF 04
42 009C: BCF 03.7
43 009D: MOVF 00,W
44 009E: BTFSC 03.2
45 009F: GOTO 0AD
46 00A0: MOVLW 02
47 00A1: MOVWF 78
48 00A2: CLRF 77
49 00A3: DECFSZ 77,F
50 00A4: GOTO 0A3
51 00A5: DECFSZ 78,F
52 00A6: GOTO 0A2
53 00A7: MOVLW 97
54 00A8: MOVWF 77
55 00A9: DECFSZ 77,F
56 00AA: GOTO 0A9
57 00AB: DECFSZ 00,F
58 00AC: GOTO 0A0
59 00AD: RETURN
2906 jacho 60 ....................
2908 kaklik 61 .................... #use i2c(master, sda=PIN_C4, scl=PIN_C3)
2909 kaklik 62 00AE: MOVLW 08
63 00AF: MOVWF 78
64 00B0: NOP
65 00B1: BCF 07.3
66 00B2: BCF 20.3
67 00B3: MOVF 20,W
68 00B4: BSF 03.5
69 00B5: MOVWF 07
70 00B6: NOP
71 00B7: BCF 03.5
72 00B8: RLF 26,F
73 00B9: BCF 07.4
74 00BA: BTFSS 03.0
75 00BB: GOTO 0C2
76 00BC: BSF 20.4
77 00BD: MOVF 20,W
78 00BE: BSF 03.5
79 00BF: MOVWF 07
80 00C0: GOTO 0C6
81 00C1: BCF 03.5
82 00C2: BCF 20.4
83 00C3: MOVF 20,W
84 00C4: BSF 03.5
85 00C5: MOVWF 07
86 00C6: NOP
87 00C7: BCF 03.5
88 00C8: BSF 20.3
89 00C9: MOVF 20,W
90 00CA: BSF 03.5
91 00CB: MOVWF 07
2908 kaklik 92 00CC: BCF 03.5
2909 kaklik 93 00CD: BTFSS 07.3
94 00CE: GOTO 0CD
95 00CF: DECFSZ 78,F
96 00D0: GOTO 0B0
97 00D1: NOP
98 00D2: BCF 07.3
99 00D3: BCF 20.3
100 00D4: MOVF 20,W
101 00D5: BSF 03.5
102 00D6: MOVWF 07
103 00D7: NOP
104 00D8: BCF 03.5
105 00D9: BSF 20.4
2908 kaklik 106 00DA: MOVF 20,W
107 00DB: BSF 03.5
108 00DC: MOVWF 07
2909 kaklik 109 00DD: NOP
110 00DE: NOP
111 00DF: BCF 03.5
112 00E0: BSF 20.3
113 00E1: MOVF 20,W
114 00E2: BSF 03.5
115 00E3: MOVWF 07
116 00E4: BCF 03.5
117 00E5: BTFSS 07.3
118 00E6: GOTO 0E5
119 00E7: CLRF 78
120 00E8: NOP
121 00E9: BTFSC 07.4
122 00EA: BSF 78.0
123 00EB: BCF 07.3
124 00EC: BCF 20.3
125 00ED: MOVF 20,W
126 00EE: BSF 03.5
127 00EF: MOVWF 07
128 00F0: BCF 03.5
129 00F1: BCF 07.4
130 00F2: BCF 20.4
131 00F3: MOVF 20,W
132 00F4: BSF 03.5
133 00F5: MOVWF 07
134 00F6: BCF 03.5
135 00F7: RETURN
136 00F8: MOVLW 08
137 00F9: MOVWF 27
138 00FA: MOVF 77,W
139 00FB: MOVWF 28
140 00FC: BSF 20.4
2908 kaklik 141 00FD: MOVF 20,W
2906 jacho 142 00FE: BSF 03.5
2908 kaklik 143 00FF: MOVWF 07
2909 kaklik 144 0100: NOP
145 0101: BCF 03.5
146 0102: BSF 20.3
147 0103: MOVF 20,W
148 0104: BSF 03.5
149 0105: MOVWF 07
150 0106: BCF 03.5
151 0107: BTFSS 07.3
152 0108: GOTO 107
153 0109: BTFSC 07.4
154 010A: BSF 03.0
155 010B: BTFSS 07.4
156 010C: BCF 03.0
157 010D: RLF 78,F
158 010E: NOP
159 010F: BCF 20.3
160 0110: MOVF 20,W
161 0111: BSF 03.5
162 0112: MOVWF 07
163 0113: BCF 03.5
164 0114: BCF 07.3
165 0115: DECFSZ 27,F
166 0116: GOTO 0FC
167 0117: BSF 20.4
168 0118: MOVF 20,W
169 0119: BSF 03.5
170 011A: MOVWF 07
2908 kaklik 171 011B: NOP
2909 kaklik 172 011C: BCF 03.5
173 011D: BCF 07.4
174 011E: MOVF 28,W
175 011F: BTFSC 03.2
176 0120: GOTO 126
177 0121: BCF 20.4
178 0122: MOVF 20,W
179 0123: BSF 03.5
180 0124: MOVWF 07
181 0125: BCF 03.5
182 0126: NOP
183 0127: BSF 20.3
184 0128: MOVF 20,W
185 0129: BSF 03.5
186 012A: MOVWF 07
187 012B: BCF 03.5
188 012C: BTFSS 07.3
189 012D: GOTO 12C
190 012E: NOP
191 012F: BCF 07.3
192 0130: BCF 20.3
193 0131: MOVF 20,W
194 0132: BSF 03.5
195 0133: MOVWF 07
196 0134: NOP
197 0135: BCF 03.5
198 0136: BCF 07.4
199 0137: BCF 20.4
200 0138: MOVF 20,W
201 0139: BSF 03.5
202 013A: MOVWF 07
203 013B: BCF 03.5
204 013C: RETURN
205 .................... #use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8) //rcv TXD xmit RXD
2906 jacho 206 *
2909 kaklik 207 0030: BSF 03.5
208 0031: BCF 06.7
209 0032: BCF 03.5
210 0033: BCF 06.7
211 0034: MOVLW 08
212 0035: MOVWF 78
213 0036: GOTO 037
214 0037: NOP
215 0038: BSF 78.7
216 0039: GOTO 048
217 003A: BCF 78.7
218 003B: RRF 32,F
219 003C: BTFSC 03.0
220 003D: BSF 06.7
221 003E: BTFSS 03.0
222 003F: BCF 06.7
223 0040: BSF 78.6
224 0041: GOTO 048
225 0042: BCF 78.6
226 0043: DECFSZ 78,F
227 0044: GOTO 03B
228 0045: GOTO 046
229 0046: NOP
230 0047: BSF 06.7
231 0048: MOVLW 3F
232 0049: MOVWF 04
233 004A: DECFSZ 04,F
234 004B: GOTO 04A
235 004C: NOP
236 004D: BTFSC 78.7
237 004E: GOTO 03A
238 004F: BTFSC 78.6
239 0050: GOTO 042
240 0051: RETURN
2906 jacho 241 ....................
242 ....................
2908 kaklik 243 ....................
2909 kaklik 244 .................... void SHT25_soft_reset()
2906 jacho 245 .................... {
2909 kaklik 246 .................... i2c_start(); // Start condition
247 .................... i2c_write(0x80); // Device address
248 .................... i2c_write(0xFE); // Device command
249 .................... i2c_stop(); // Stop condition
250 .................... }
2906 jacho 251 ....................
2909 kaklik 252 .................... unsigned int8 SHT25_setup()
253 .................... {
254 .................... unsigned int8 reg;
255 ....................
256 .................... i2c_start(); // Start condition
2906 jacho 257 *
2909 kaklik 258 013D: BSF 20.4
259 013E: MOVF 20,W
260 013F: BSF 03.5
261 0140: MOVWF 07
262 0141: NOP
263 0142: BCF 03.5
264 0143: BSF 20.3
265 0144: MOVF 20,W
266 0145: BSF 03.5
267 0146: MOVWF 07
268 0147: NOP
269 0148: BCF 03.5
270 0149: BCF 07.4
271 014A: BCF 20.4
272 014B: MOVF 20,W
273 014C: BSF 03.5
274 014D: MOVWF 07
275 014E: NOP
276 014F: BCF 03.5
277 0150: BCF 07.3
278 0151: BCF 20.3
279 0152: MOVF 20,W
280 0153: BSF 03.5
281 0154: MOVWF 07
282 .................... i2c_write(0x80); // Device address
283 0155: MOVLW 80
284 0156: BCF 03.5
285 0157: MOVWF 26
286 0158: CALL 0AE
287 .................... i2c_write(0xE7); // Device command
288 0159: MOVLW E7
289 015A: MOVWF 26
290 015B: CALL 0AE
291 .................... // i2c_stop(); // Stop condition
2906 jacho 292 ....................
2909 kaklik 293 .................... i2c_start(); // Start condition
294 015C: BSF 20.4
295 015D: MOVF 20,W
296 015E: BSF 03.5
297 015F: MOVWF 07
298 0160: NOP
299 0161: BCF 03.5
300 0162: BSF 20.3
301 0163: MOVF 20,W
302 0164: BSF 03.5
303 0165: MOVWF 07
304 0166: NOP
305 0167: BCF 03.5
306 0168: BTFSS 07.3
307 0169: GOTO 168
308 016A: BCF 07.4
309 016B: BCF 20.4
310 016C: MOVF 20,W
311 016D: BSF 03.5
312 016E: MOVWF 07
313 016F: NOP
314 0170: BCF 03.5
315 0171: BCF 07.3
316 0172: BCF 20.3
317 0173: MOVF 20,W
318 0174: BSF 03.5
319 0175: MOVWF 07
320 .................... i2c_write(0x81); // Device address
321 0176: MOVLW 81
322 0177: BCF 03.5
323 0178: MOVWF 26
324 0179: CALL 0AE
325 .................... reg=i2c_read(0); // Device command
326 017A: CLRF 77
327 017B: CALL 0F8
328 017C: MOVF 78,W
329 017D: MOVWF 21
330 .................... i2c_stop(); // Stop condition
331 017E: BCF 20.4
332 017F: MOVF 20,W
333 0180: BSF 03.5
334 0181: MOVWF 07
335 0182: NOP
336 0183: BCF 03.5
337 0184: BSF 20.3
338 0185: MOVF 20,W
339 0186: BSF 03.5
340 0187: MOVWF 07
341 0188: BCF 03.5
342 0189: BTFSS 07.3
343 018A: GOTO 189
344 018B: NOP
345 018C: GOTO 18D
346 018D: NOP
347 018E: BSF 20.4
348 018F: MOVF 20,W
349 0190: BSF 03.5
350 0191: MOVWF 07
351 0192: NOP
2906 jacho 352 ....................
2909 kaklik 353 .................... return (reg);
354 0193: BCF 03.5
355 0194: MOVF 21,W
356 0195: MOVWF 78
357 .................... }
358 0196: BSF 0A.3
359 0197: BCF 0A.4
360 0198: GOTO 075 (RETURN)
2906 jacho 361 ....................
2909 kaklik 362 .................... float SHT25_get_temp()
363 .................... {
364 .................... unsigned int8 MSB, LSB, Check;
365 .................... unsigned int16 data;
2906 jacho 366 ....................
2909 kaklik 367 .................... i2c_start();
368 *
369 04A8: BSF 20.4
370 04A9: MOVF 20,W
371 04AA: BSF 03.5
372 04AB: MOVWF 07
373 04AC: NOP
374 04AD: BCF 03.5
375 04AE: BSF 20.3
376 04AF: MOVF 20,W
377 04B0: BSF 03.5
378 04B1: MOVWF 07
379 04B2: NOP
380 04B3: BCF 03.5
381 04B4: BCF 07.4
382 04B5: BCF 20.4
383 04B6: MOVF 20,W
384 04B7: BSF 03.5
385 04B8: MOVWF 07
386 04B9: NOP
387 04BA: BCF 03.5
388 04BB: BCF 07.3
389 04BC: BCF 20.3
390 04BD: MOVF 20,W
391 04BE: BSF 03.5
392 04BF: MOVWF 07
393 .................... I2C_Write(0x80);
394 04C0: MOVLW 80
395 04C1: BCF 03.5
396 04C2: MOVWF 26
397 04C3: CALL 0AE
398 .................... I2C_write(0xE3);
399 04C4: MOVLW E3
400 04C5: MOVWF 26
401 04C6: CALL 0AE
2906 jacho 402 .................... i2c_stop();
2909 kaklik 403 04C7: BCF 20.4
404 04C8: MOVF 20,W
405 04C9: BSF 03.5
406 04CA: MOVWF 07
407 04CB: NOP
408 04CC: BCF 03.5
409 04CD: BSF 20.3
410 04CE: MOVF 20,W
411 04CF: BSF 03.5
412 04D0: MOVWF 07
413 04D1: BCF 03.5
414 04D2: BTFSS 07.3
415 04D3: GOTO 4D2
416 04D4: NOP
417 04D5: GOTO 4D6
418 04D6: NOP
419 04D7: BSF 20.4
420 04D8: MOVF 20,W
421 04D9: BSF 03.5
422 04DA: MOVWF 07
423 04DB: NOP
424 ....................
425 .................... delay_ms(100);
426 04DC: MOVLW 64
427 04DD: BCF 03.5
428 04DE: MOVWF 26
429 04DF: CALL 09A
2906 jacho 430 ....................
431 .................... i2c_start();
2909 kaklik 432 04E0: BSF 20.4
433 04E1: MOVF 20,W
434 04E2: BSF 03.5
435 04E3: MOVWF 07
436 04E4: NOP
437 04E5: BCF 03.5
438 04E6: BSF 20.3
439 04E7: MOVF 20,W
440 04E8: BSF 03.5
441 04E9: MOVWF 07
442 04EA: NOP
443 04EB: BCF 03.5
444 04EC: BCF 07.4
445 04ED: BCF 20.4
446 04EE: MOVF 20,W
447 04EF: BSF 03.5
448 04F0: MOVWF 07
449 04F1: NOP
450 04F2: BCF 03.5
451 04F3: BCF 07.3
452 04F4: BCF 20.3
453 04F5: MOVF 20,W
454 04F6: BSF 03.5
455 04F7: MOVWF 07
2906 jacho 456 .................... I2C_Write(0x81);
2909 kaklik 457 04F8: MOVLW 81
458 04F9: BCF 03.5
459 04FA: MOVWF 26
460 04FB: CALL 0AE
461 .................... MSB=i2c_read(1);
462 04FC: MOVLW 01
463 04FD: MOVWF 77
464 04FE: CALL 0F8
465 04FF: MOVF 78,W
466 0500: MOVWF 21
467 .................... LSB=i2c_read(1);
468 0501: MOVLW 01
469 0502: MOVWF 77
470 0503: CALL 0F8
471 0504: MOVF 78,W
472 0505: MOVWF 22
473 .................... Check=i2c_read(0);
474 0506: CLRF 77
475 0507: CALL 0F8
476 0508: MOVF 78,W
477 0509: MOVWF 23
478 .................... i2c_stop();
479 050A: BCF 20.4
480 050B: MOVF 20,W
481 050C: BSF 03.5
482 050D: MOVWF 07
483 050E: NOP
484 050F: BCF 03.5
485 0510: BSF 20.3
486 0511: MOVF 20,W
487 0512: BSF 03.5
488 0513: MOVWF 07
489 0514: BCF 03.5
490 0515: BTFSS 07.3
491 0516: GOTO 515
492 0517: NOP
493 0518: GOTO 519
494 0519: NOP
495 051A: BSF 20.4
496 051B: MOVF 20,W
497 051C: BSF 03.5
498 051D: MOVWF 07
499 051E: NOP
500 ....................
501 .................... LSB = LSB >> 2; // trow out status bits
502 051F: BCF 03.5
503 0520: RRF 22,F
504 0521: RRF 22,F
505 0522: MOVLW 3F
506 0523: ANDWF 22,F
2906 jacho 507 ....................
2909 kaklik 508 .................... data = (((unsigned int16) MSB << 8) + (LSB << 4));
509 0524: CLRF 27
510 0525: MOVF 21,W
511 0526: MOVWF 26
512 0527: MOVWF 27
513 0528: CLRF 26
514 0529: SWAPF 22,W
515 052A: MOVWF 77
516 052B: MOVLW F0
517 052C: ANDWF 77,F
518 052D: MOVF 77,W
519 052E: ADDWF 26,W
520 052F: MOVWF 24
521 0530: MOVF 27,W
522 0531: MOVWF 25
523 0532: BTFSC 03.0
524 0533: INCF 25,F
525 .................... return(-46.85 + 175.72*((float)data/0xFFFF));
526 0534: MOVF 25,W
527 0535: MOVWF 27
528 0536: MOVF 24,W
529 0537: MOVWF 26
530 0538: CALL 20B
531 0539: MOVF 77,W
532 053A: MOVWF 26
533 053B: MOVF 78,W
534 053C: MOVWF 27
535 053D: MOVF 79,W
536 053E: MOVWF 28
537 053F: MOVF 7A,W
538 0540: MOVWF 29
539 0541: MOVWF 2D
540 0542: MOVF 79,W
541 0543: MOVWF 2C
542 0544: MOVF 78,W
543 0545: MOVWF 2B
544 0546: MOVF 77,W
545 0547: MOVWF 2A
546 0548: CLRF 31
547 0549: MOVLW FF
548 054A: MOVWF 30
549 054B: MOVLW 7F
550 054C: MOVWF 2F
551 054D: MOVLW 8E
552 054E: MOVWF 2E
553 054F: CALL 228
554 0550: MOVLW 52
555 0551: MOVWF 35
556 0552: MOVLW B8
557 0553: MOVWF 34
558 0554: MOVLW 2F
559 0555: MOVWF 33
560 0556: MOVLW 86
561 0557: MOVWF 32
562 0558: MOVF 7A,W
563 0559: MOVWF 39
564 055A: MOVF 79,W
565 055B: MOVWF 38
566 055C: MOVF 78,W
567 055D: MOVWF 37
568 055E: MOVF 77,W
569 055F: MOVWF 36
570 0560: CALL 2F2
571 0561: BCF 03.1
572 0562: MOVLW 66
573 0563: MOVWF 29
574 0564: MOVWF 28
575 0565: MOVLW BB
576 0566: MOVWF 27
577 0567: MOVLW 84
578 0568: MOVWF 26
579 0569: MOVF 7A,W
580 056A: MOVWF 2D
581 056B: MOVF 79,W
582 056C: MOVWF 2C
583 056D: MOVF 78,W
584 056E: MOVWF 2B
585 056F: MOVF 77,W
586 0570: MOVWF 2A
587 0571: CALL 367
588 .................... }
589 0572: BSF 0A.3
590 0573: BCF 0A.4
591 0574: GOTO 0A5 (RETURN)
592 ....................
593 .................... float SHT25_get_hum()
594 .................... {
595 .................... unsigned int8 MSB, LSB, Check;
596 .................... unsigned int16 data;
597 ....................
598 .................... i2c_start(); //RH
599 *
600 069E: BSF 20.4
601 069F: MOVF 20,W
602 06A0: BSF 03.5
603 06A1: MOVWF 07
604 06A2: NOP
605 06A3: BCF 03.5
606 06A4: BSF 20.3
607 06A5: MOVF 20,W
608 06A6: BSF 03.5
609 06A7: MOVWF 07
610 06A8: NOP
611 06A9: BCF 03.5
612 06AA: BCF 07.4
613 06AB: BCF 20.4
614 06AC: MOVF 20,W
615 06AD: BSF 03.5
616 06AE: MOVWF 07
617 06AF: NOP
618 06B0: BCF 03.5
619 06B1: BCF 07.3
620 06B2: BCF 20.3
621 06B3: MOVF 20,W
622 06B4: BSF 03.5
623 06B5: MOVWF 07
2906 jacho 624 .................... I2C_Write(0x80);
2909 kaklik 625 06B6: MOVLW 80
626 06B7: BCF 03.5
627 06B8: MOVWF 26
628 06B9: CALL 0AE
629 .................... I2C_write(0xE5);
630 06BA: MOVLW E5
631 06BB: MOVWF 26
632 06BC: CALL 0AE
633 .................... // i2c_stop();
634 ....................
635 .................... delay_ms(100);
636 06BD: MOVLW 64
637 06BE: MOVWF 26
638 06BF: CALL 09A
639 ....................
2906 jacho 640 .................... i2c_start();
2909 kaklik 641 06C0: BSF 20.4
642 06C1: MOVF 20,W
643 06C2: BSF 03.5
644 06C3: MOVWF 07
645 06C4: NOP
646 06C5: BCF 03.5
647 06C6: BSF 20.3
648 06C7: MOVF 20,W
649 06C8: BSF 03.5
650 06C9: MOVWF 07
651 06CA: NOP
652 06CB: BCF 03.5
653 06CC: BTFSS 07.3
654 06CD: GOTO 6CC
655 06CE: BCF 07.4
656 06CF: BCF 20.4
657 06D0: MOVF 20,W
658 06D1: BSF 03.5
659 06D2: MOVWF 07
660 06D3: NOP
661 06D4: BCF 03.5
662 06D5: BCF 07.3
663 06D6: BCF 20.3
664 06D7: MOVF 20,W
665 06D8: BSF 03.5
666 06D9: MOVWF 07
2906 jacho 667 .................... I2C_Write(0x81);
2909 kaklik 668 06DA: MOVLW 81
669 06DB: BCF 03.5
670 06DC: MOVWF 26
671 06DD: CALL 0AE
672 .................... MSB=i2c_read(1);
673 06DE: MOVLW 01
674 06DF: MOVWF 77
675 06E0: CALL 0F8
676 06E1: MOVF 78,W
677 06E2: MOVWF 21
678 .................... LSB=i2c_read(1);
679 06E3: MOVLW 01
680 06E4: MOVWF 77
681 06E5: CALL 0F8
682 06E6: MOVF 78,W
683 06E7: MOVWF 22
684 .................... Check=i2c_read(0);
685 06E8: CLRF 77
686 06E9: CALL 0F8
687 06EA: MOVF 78,W
688 06EB: MOVWF 23
689 .................... i2c_stop();
690 06EC: BCF 20.4
691 06ED: MOVF 20,W
692 06EE: BSF 03.5
693 06EF: MOVWF 07
694 06F0: NOP
695 06F1: BCF 03.5
696 06F2: BSF 20.3
697 06F3: MOVF 20,W
698 06F4: BSF 03.5
699 06F5: MOVWF 07
700 06F6: BCF 03.5
701 06F7: BTFSS 07.3
702 06F8: GOTO 6F7
703 06F9: NOP
704 06FA: GOTO 6FB
705 06FB: NOP
706 06FC: BSF 20.4
707 06FD: MOVF 20,W
708 06FE: BSF 03.5
709 06FF: MOVWF 07
710 0700: NOP
2906 jacho 711 ....................
2909 kaklik 712 .................... // printf("%X %X %X\r\n",MSB, LSB, Check);
2906 jacho 713 ....................
2909 kaklik 714 .................... LSB = LSB >> 2; // trow out status bits
715 0701: BCF 03.5
716 0702: RRF 22,F
717 0703: RRF 22,F
718 0704: MOVLW 3F
719 0705: ANDWF 22,F
2906 jacho 720 ....................
2909 kaklik 721 .................... data = (((unsigned int16) MSB << 8) + (LSB << 4) );
722 0706: CLRF 27
723 0707: MOVF 21,W
724 0708: MOVWF 26
725 0709: MOVWF 27
726 070A: CLRF 26
727 070B: SWAPF 22,W
728 070C: MOVWF 77
729 070D: MOVLW F0
730 070E: ANDWF 77,F
731 070F: MOVF 77,W
732 0710: ADDWF 26,W
733 0711: MOVWF 24
734 0712: MOVF 27,W
735 0713: MOVWF 25
736 0714: BTFSC 03.0
737 0715: INCF 25,F
738 .................... return( -6.0 + 125.0*((float)data/0xFFFF));
739 0716: MOVF 25,W
740 0717: MOVWF 27
741 0718: MOVF 24,W
742 0719: MOVWF 26
743 071A: CALL 20B
744 071B: MOVF 77,W
745 071C: MOVWF 26
746 071D: MOVF 78,W
747 071E: MOVWF 27
748 071F: MOVF 79,W
749 0720: MOVWF 28
750 0721: MOVF 7A,W
751 0722: MOVWF 29
752 0723: MOVWF 2D
753 0724: MOVF 79,W
754 0725: MOVWF 2C
755 0726: MOVF 78,W
756 0727: MOVWF 2B
757 0728: MOVF 77,W
758 0729: MOVWF 2A
759 072A: CLRF 31
760 072B: MOVLW FF
761 072C: MOVWF 30
762 072D: MOVLW 7F
763 072E: MOVWF 2F
764 072F: MOVLW 8E
765 0730: MOVWF 2E
766 0731: CALL 228
767 0732: CLRF 35
768 0733: CLRF 34
769 0734: MOVLW 7A
770 0735: MOVWF 33
771 0736: MOVLW 85
772 0737: MOVWF 32
773 0738: MOVF 7A,W
774 0739: MOVWF 39
775 073A: MOVF 79,W
776 073B: MOVWF 38
777 073C: MOVF 78,W
778 073D: MOVWF 37
779 073E: MOVF 77,W
780 073F: MOVWF 36
781 0740: CALL 2F2
782 0741: BCF 03.1
783 0742: CLRF 29
784 0743: CLRF 28
785 0744: MOVLW C0
786 0745: MOVWF 27
787 0746: MOVLW 81
788 0747: MOVWF 26
789 0748: MOVF 7A,W
790 0749: MOVWF 2D
791 074A: MOVF 79,W
792 074B: MOVWF 2C
793 074C: MOVF 78,W
794 074D: MOVWF 2B
795 074E: MOVF 77,W
796 074F: MOVWF 2A
797 0750: CALL 367
798 .................... }
799 0751: BSF 0A.3
800 0752: BCF 0A.4
801 0753: GOTO 0E3 (RETURN)
2906 jacho 802 ....................
803 ....................
2909 kaklik 804 .................... void main()
805 .................... {
806 *
807 002F: DATA 00,00
808 *
809 0800: CLRF 04
810 0801: BCF 03.7
811 0802: MOVLW 1F
812 0803: ANDWF 03,F
813 0804: MOVLW 71
814 0805: BSF 03.5
815 0806: MOVWF 0F
816 0807: MOVF 0F,W
817 0808: BCF 06.7
818 0809: BCF 03.5
819 080A: BSF 06.7
820 080B: BSF 03.5
821 080C: BSF 03.6
822 080D: MOVF 09,W
823 080E: ANDLW C0
824 080F: MOVWF 09
825 0810: BCF 03.6
826 0811: BCF 1F.4
827 0812: BCF 1F.5
828 0813: MOVLW 00
829 0814: BSF 03.6
830 0815: MOVWF 08
831 0816: BCF 03.5
832 0817: CLRF 07
833 0818: CLRF 08
834 0819: CLRF 09
2906 jacho 835 ....................
2909 kaklik 836 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
837 *
838 081D: BSF 03.5
839 081E: BSF 03.6
840 081F: MOVF 09,W
841 0820: ANDLW C0
842 0821: MOVWF 09
843 0822: BCF 03.6
844 0823: BCF 1F.4
845 0824: BCF 1F.5
846 0825: MOVLW 00
847 0826: BSF 03.6
848 0827: MOVWF 08
849 .................... setup_adc(ADC_CLOCK_DIV_2);
850 0828: BCF 03.5
851 0829: BCF 03.6
852 082A: BCF 1F.6
853 082B: BCF 1F.7
854 082C: BSF 03.5
855 082D: BCF 1F.7
856 082E: BCF 03.5
857 082F: BSF 1F.0
858 .................... setup_spi(SPI_SS_DISABLED);
859 0830: BCF 14.5
860 0831: BCF 20.5
861 0832: MOVF 20,W
862 0833: BSF 03.5
863 0834: MOVWF 07
864 0835: BCF 03.5
865 0836: BSF 20.4
866 0837: MOVF 20,W
867 0838: BSF 03.5
868 0839: MOVWF 07
869 083A: BCF 03.5
870 083B: BCF 20.3
871 083C: MOVF 20,W
872 083D: BSF 03.5
873 083E: MOVWF 07
874 083F: MOVLW 01
875 0840: BCF 03.5
876 0841: MOVWF 14
877 0842: MOVLW 00
878 0843: BSF 03.5
879 0844: MOVWF 14
880 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
881 0845: MOVF 01,W
882 0846: ANDLW C7
883 0847: IORLW 08
884 0848: MOVWF 01
885 .................... setup_timer_1(T1_DISABLED);
886 0849: BCF 03.5
887 084A: CLRF 10
888 .................... setup_timer_2(T2_DISABLED,0,1);
889 084B: MOVLW 00
890 084C: MOVWF 78
891 084D: MOVWF 12
892 084E: MOVLW 00
893 084F: BSF 03.5
894 0850: MOVWF 12
895 .................... setup_ccp1(CCP_OFF);
896 0851: BCF 03.5
897 0852: BSF 20.2
898 0853: MOVF 20,W
899 0854: BSF 03.5
900 0855: MOVWF 07
901 0856: BCF 03.5
902 0857: CLRF 17
903 0858: BSF 03.5
904 0859: CLRF 1B
905 085A: CLRF 1C
906 085B: MOVLW 01
907 085C: MOVWF 1D
908 .................... setup_comparator(NC_NC_NC_NC);
909 085D: BCF 03.5
910 085E: BSF 03.6
911 085F: CLRF 07
912 0860: CLRF 08
913 0861: CLRF 09
914 ....................
915 .................... void SHT25_soft_reset();
916 .................... printf("SHT25 humidity and temperature sensor example \r\n",);
917 0862: MOVLW 04
918 0863: MOVWF 0D
919 0864: MOVLW 00
920 0865: MOVWF 0F
921 0866: BCF 0A.3
922 0867: BCF 03.6
923 0868: GOTO 052
924 0869: BSF 0A.3
925 .................... delay_ms (500);
926 086A: MOVLW 02
927 086B: MOVWF 21
928 086C: MOVLW FA
929 086D: MOVWF 26
930 086E: BCF 0A.3
931 086F: CALL 09A
932 0870: BSF 0A.3
933 0871: DECFSZ 21,F
934 0872: GOTO 06C
935 ....................
936 .................... while(TRUE)
937 .................... {
938 .................... printf("setup: %X \r\n",SHT25_setup());
939 0873: BCF 0A.3
940 0874: GOTO 13D
941 0875: BSF 0A.3
942 0876: MOVF 78,W
943 0877: MOVWF 21
944 0878: MOVLW 1D
945 0879: BSF 03.6
946 087A: MOVWF 0D
947 087B: MOVLW 00
948 087C: MOVWF 0F
949 087D: BCF 03.0
950 087E: MOVLW 07
951 087F: BCF 03.6
952 0880: MOVWF 25
953 0881: BCF 0A.3
954 0882: CALL 199
955 0883: BSF 0A.3
956 0884: MOVF 21,W
957 0885: MOVWF 22
958 0886: MOVLW 37
959 0887: MOVWF 23
960 0888: BCF 0A.3
961 0889: GOTO 1E8
962 088A: BSF 0A.3
963 088B: MOVLW 20
964 088C: MOVWF 32
965 088D: BCF 0A.3
966 088E: CALL 030
967 088F: BSF 0A.3
968 0890: MOVLW 0D
969 0891: MOVWF 32
970 0892: BCF 0A.3
971 0893: CALL 030
972 0894: BSF 0A.3
973 0895: MOVLW 0A
974 0896: MOVWF 32
975 0897: BCF 0A.3
976 0898: CALL 030
977 0899: BSF 0A.3
978 .................... delay_ms (500);
979 089A: MOVLW 02
980 089B: MOVWF 21
981 089C: MOVLW FA
982 089D: MOVWF 26
983 089E: BCF 0A.3
984 089F: CALL 09A
985 08A0: BSF 0A.3
986 08A1: DECFSZ 21,F
987 08A2: GOTO 09C
988 .................... printf("Temp: %f \r\n",SHT25_get_temp());
989 08A3: BCF 0A.3
990 08A4: GOTO 4A8
991 08A5: BSF 0A.3
992 08A6: MOVF 77,W
993 08A7: MOVWF 21
994 08A8: MOVF 78,W
995 08A9: MOVWF 22
996 08AA: MOVF 79,W
997 08AB: MOVWF 23
998 08AC: MOVF 7A,W
999 08AD: MOVWF 24
1000 08AE: MOVLW 24
1001 08AF: BSF 03.6
1002 08B0: MOVWF 0D
1003 08B1: MOVLW 00
1004 08B2: MOVWF 0F
1005 08B3: BCF 03.0
1006 08B4: MOVLW 06
1007 08B5: BCF 03.6
1008 08B6: MOVWF 25
1009 08B7: BCF 0A.3
1010 08B8: CALL 199
1011 08B9: BSF 0A.3
1012 08BA: MOVLW 89
1013 08BB: MOVWF 04
1014 08BC: MOVF 24,W
1015 08BD: MOVWF 28
1016 08BE: MOVF 23,W
1017 08BF: MOVWF 27
1018 08C0: MOVF 22,W
1019 08C1: MOVWF 26
1020 08C2: MOVF 21,W
1021 08C3: MOVWF 25
1022 08C4: MOVLW 02
1023 08C5: MOVWF 29
1024 08C6: BCF 0A.3
1025 08C7: CALL 5B7
1026 08C8: BSF 0A.3
1027 08C9: MOVLW 20
1028 08CA: MOVWF 32
1029 08CB: BCF 0A.3
1030 08CC: CALL 030
1031 08CD: BSF 0A.3
1032 08CE: MOVLW 0D
1033 08CF: MOVWF 32
1034 08D0: BCF 0A.3
1035 08D1: CALL 030
1036 08D2: BSF 0A.3
1037 08D3: MOVLW 0A
1038 08D4: MOVWF 32
1039 08D5: BCF 0A.3
1040 08D6: CALL 030
1041 08D7: BSF 0A.3
1042 .................... delay_ms (500);
1043 08D8: MOVLW 02
1044 08D9: MOVWF 21
1045 08DA: MOVLW FA
1046 08DB: MOVWF 26
1047 08DC: BCF 0A.3
1048 08DD: CALL 09A
1049 08DE: BSF 0A.3
1050 08DF: DECFSZ 21,F
1051 08E0: GOTO 0DA
1052 .................... printf("Hum: %f \r\n",SHT25_get_hum());
1053 08E1: BCF 0A.3
1054 08E2: GOTO 69E
1055 08E3: BSF 0A.3
1056 08E4: MOVF 77,W
1057 08E5: MOVWF 21
1058 08E6: MOVF 78,W
1059 08E7: MOVWF 22
1060 08E8: MOVF 79,W
1061 08E9: MOVWF 23
1062 08EA: MOVF 7A,W
1063 08EB: MOVWF 24
1064 08EC: MOVLW 2A
1065 08ED: BSF 03.6
1066 08EE: MOVWF 0D
1067 08EF: MOVLW 00
1068 08F0: MOVWF 0F
1069 08F1: BCF 03.0
1070 08F2: MOVLW 05
1071 08F3: BCF 03.6
1072 08F4: MOVWF 25
1073 08F5: BCF 0A.3
1074 08F6: CALL 199
1075 08F7: BSF 0A.3
1076 08F8: MOVLW 89
1077 08F9: MOVWF 04
1078 08FA: MOVF 24,W
1079 08FB: MOVWF 28
1080 08FC: MOVF 23,W
1081 08FD: MOVWF 27
1082 08FE: MOVF 22,W
1083 08FF: MOVWF 26
1084 0900: MOVF 21,W
1085 0901: MOVWF 25
1086 0902: MOVLW 02
1087 0903: MOVWF 29
1088 0904: BCF 0A.3
1089 0905: CALL 5B7
1090 0906: BSF 0A.3
1091 0907: MOVLW 20
1092 0908: MOVWF 32
1093 0909: BCF 0A.3
1094 090A: CALL 030
1095 090B: BSF 0A.3
1096 090C: MOVLW 0D
1097 090D: MOVWF 32
1098 090E: BCF 0A.3
1099 090F: CALL 030
1100 0910: BSF 0A.3
1101 0911: MOVLW 0A
1102 0912: MOVWF 32
1103 0913: BCF 0A.3
1104 0914: CALL 030
1105 0915: BSF 0A.3
1106 .................... delay_ms (1000);
1107 0916: MOVLW 04
1108 0917: MOVWF 21
1109 0918: MOVLW FA
1110 0919: MOVWF 26
1111 091A: BCF 0A.3
1112 091B: CALL 09A
1113 091C: BSF 0A.3
1114 091D: DECFSZ 21,F
1115 091E: GOTO 118
1116 .................... }
1117 091F: GOTO 073
2906 jacho 1118 .................... }
1119 ....................
2909 kaklik 1120 0920: SLEEP
2906 jacho 1121  
1122 Configuration Fuses:
2909 kaklik 1123 Word 1: 2CF4 INTRC_IO NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
2906 jacho 1124 Word 2: 3FFF NOWRT BORV40