2988 |
kaklik |
1 |
CCS PCM C Compiler, Version 4.106, 47914 15-V-13 22:58 |
2906 |
jacho |
2 |
|
2988 |
kaklik |
3 |
Filename: Z:\home\kaklik\svnMLAB\Modules\Sensors\SHT25V01A\SW\PIC16F887\main.lst |
2906 |
jacho |
4 |
|
2988 |
kaklik |
5 |
ROM used: 2319 words (28%) |
2906 |
jacho |
6 |
Largest free fragment is 2048 |
2988 |
kaklik |
7 |
RAM used: 17 (5%) at main() level |
|
|
8 |
43 (12%) 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 |
2912 |
kaklik |
16 |
.................... /* |
|
|
17 |
.................... SHT25 sensor demo firmware |
|
|
18 |
.................... */ |
|
|
19 |
.................... |
2908 |
kaklik |
20 |
.................... #include "main.h" |
2906 |
jacho |
21 |
.................... #include <16F887.h> |
|
|
22 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
|
|
23 |
.................... #device PIC16F887 |
|
|
24 |
.................... #list |
|
|
25 |
.................... |
|
|
26 |
.................... #device adc=8 |
|
|
27 |
.................... |
2908 |
kaklik |
28 |
.................... #FUSES NOWDT //No Watch Dog Timer |
2909 |
kaklik |
29 |
.................... #FUSES INTRC_IO //Internal RC Osc |
2908 |
kaklik |
30 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
31 |
.................... #FUSES MCLR //Master Clear pin enabled |
|
|
32 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
33 |
.................... #FUSES NOCPD //No EE protection |
|
|
34 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
35 |
.................... #FUSES IESO //Internal External Switch Over mode enabled |
|
|
36 |
.................... #FUSES FCMEN //Fail-safe clock monitor enabled |
|
|
37 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
38 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
39 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
40 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
2906 |
jacho |
41 |
.................... |
|
|
42 |
.................... #use delay(clock=8000000) |
|
|
43 |
* |
2988 |
kaklik |
44 |
0169: MOVLW 30 |
|
|
45 |
016A: MOVWF 04 |
|
|
46 |
016B: BCF 03.7 |
|
|
47 |
016C: MOVF 00,W |
|
|
48 |
016D: BTFSC 03.2 |
|
|
49 |
016E: GOTO 17C |
|
|
50 |
016F: MOVLW 02 |
|
|
51 |
0170: MOVWF 78 |
|
|
52 |
0171: CLRF 77 |
|
|
53 |
0172: DECFSZ 77,F |
|
|
54 |
0173: GOTO 172 |
|
|
55 |
0174: DECFSZ 78,F |
|
|
56 |
0175: GOTO 171 |
|
|
57 |
0176: MOVLW 97 |
|
|
58 |
0177: MOVWF 77 |
|
|
59 |
0178: DECFSZ 77,F |
|
|
60 |
0179: GOTO 178 |
|
|
61 |
017A: DECFSZ 00,F |
|
|
62 |
017B: GOTO 16F |
|
|
63 |
017C: RETURN |
2906 |
jacho |
64 |
.................... |
2908 |
kaklik |
65 |
.................... #use i2c(master, sda=PIN_C4, scl=PIN_C3) |
2911 |
kaklik |
66 |
* |
2988 |
kaklik |
67 |
002C: MOVLW 08 |
|
|
68 |
002D: MOVWF 78 |
|
|
69 |
002E: NOP |
|
|
70 |
002F: BCF 07.3 |
|
|
71 |
0030: BCF 20.3 |
|
|
72 |
0031: MOVF 20,W |
|
|
73 |
0032: BSF 03.5 |
|
|
74 |
0033: MOVWF 07 |
|
|
75 |
0034: NOP |
|
|
76 |
0035: BCF 03.5 |
|
|
77 |
0036: RLF 30,F |
|
|
78 |
0037: BCF 07.4 |
|
|
79 |
0038: BTFSS 03.0 |
|
|
80 |
0039: GOTO 040 |
|
|
81 |
003A: BSF 20.4 |
|
|
82 |
003B: MOVF 20,W |
|
|
83 |
003C: BSF 03.5 |
|
|
84 |
003D: MOVWF 07 |
|
|
85 |
003E: GOTO 044 |
|
|
86 |
003F: BCF 03.5 |
|
|
87 |
0040: BCF 20.4 |
|
|
88 |
0041: MOVF 20,W |
|
|
89 |
0042: BSF 03.5 |
|
|
90 |
0043: MOVWF 07 |
|
|
91 |
0044: NOP |
|
|
92 |
0045: BCF 03.5 |
|
|
93 |
0046: BSF 20.3 |
|
|
94 |
0047: MOVF 20,W |
|
|
95 |
0048: BSF 03.5 |
|
|
96 |
0049: MOVWF 07 |
2911 |
kaklik |
97 |
004A: BCF 03.5 |
2988 |
kaklik |
98 |
004B: BTFSS 07.3 |
|
|
99 |
004C: GOTO 04B |
|
|
100 |
004D: DECFSZ 78,F |
|
|
101 |
004E: GOTO 02E |
|
|
102 |
004F: NOP |
|
|
103 |
0050: BCF 07.3 |
|
|
104 |
0051: BCF 20.3 |
|
|
105 |
0052: MOVF 20,W |
|
|
106 |
0053: BSF 03.5 |
|
|
107 |
0054: MOVWF 07 |
|
|
108 |
0055: NOP |
|
|
109 |
0056: BCF 03.5 |
|
|
110 |
0057: BSF 20.4 |
|
|
111 |
0058: MOVF 20,W |
|
|
112 |
0059: BSF 03.5 |
|
|
113 |
005A: MOVWF 07 |
|
|
114 |
005B: NOP |
|
|
115 |
005C: NOP |
|
|
116 |
005D: BCF 03.5 |
|
|
117 |
005E: BSF 20.3 |
|
|
118 |
005F: MOVF 20,W |
|
|
119 |
0060: BSF 03.5 |
|
|
120 |
0061: MOVWF 07 |
2912 |
kaklik |
121 |
0062: BCF 03.5 |
2988 |
kaklik |
122 |
0063: BTFSS 07.3 |
|
|
123 |
0064: GOTO 063 |
|
|
124 |
0065: CLRF 78 |
|
|
125 |
0066: NOP |
|
|
126 |
0067: BTFSC 07.4 |
|
|
127 |
0068: BSF 78.0 |
|
|
128 |
0069: BCF 07.3 |
|
|
129 |
006A: BCF 20.3 |
|
|
130 |
006B: MOVF 20,W |
|
|
131 |
006C: BSF 03.5 |
|
|
132 |
006D: MOVWF 07 |
|
|
133 |
006E: BCF 03.5 |
|
|
134 |
006F: BCF 07.4 |
|
|
135 |
0070: BCF 20.4 |
|
|
136 |
0071: MOVF 20,W |
|
|
137 |
0072: BSF 03.5 |
|
|
138 |
0073: MOVWF 07 |
|
|
139 |
0074: BCF 03.5 |
|
|
140 |
0075: RETURN |
2911 |
kaklik |
141 |
* |
2988 |
kaklik |
142 |
017D: MOVLW 08 |
|
|
143 |
017E: MOVWF 31 |
|
|
144 |
017F: MOVF 77,W |
|
|
145 |
0180: MOVWF 32 |
|
|
146 |
0181: BSF 20.4 |
|
|
147 |
0182: MOVF 20,W |
|
|
148 |
0183: BSF 03.5 |
|
|
149 |
0184: MOVWF 07 |
|
|
150 |
0185: NOP |
|
|
151 |
0186: BCF 03.5 |
|
|
152 |
0187: BSF 20.3 |
|
|
153 |
0188: MOVF 20,W |
|
|
154 |
0189: BSF 03.5 |
|
|
155 |
018A: MOVWF 07 |
|
|
156 |
018B: BCF 03.5 |
|
|
157 |
018C: BTFSS 07.3 |
|
|
158 |
018D: GOTO 18C |
|
|
159 |
018E: BTFSC 07.4 |
|
|
160 |
018F: BSF 03.0 |
|
|
161 |
0190: BTFSS 07.4 |
|
|
162 |
0191: BCF 03.0 |
|
|
163 |
0192: RLF 78,F |
|
|
164 |
0193: NOP |
|
|
165 |
0194: BCF 20.3 |
|
|
166 |
0195: MOVF 20,W |
|
|
167 |
0196: BSF 03.5 |
|
|
168 |
0197: MOVWF 07 |
|
|
169 |
0198: BCF 03.5 |
|
|
170 |
0199: BCF 07.3 |
|
|
171 |
019A: DECFSZ 31,F |
|
|
172 |
019B: GOTO 181 |
|
|
173 |
019C: BSF 20.4 |
|
|
174 |
019D: MOVF 20,W |
|
|
175 |
019E: BSF 03.5 |
|
|
176 |
019F: MOVWF 07 |
|
|
177 |
01A0: NOP |
|
|
178 |
01A1: BCF 03.5 |
|
|
179 |
01A2: BCF 07.4 |
|
|
180 |
01A3: MOVF 32,W |
|
|
181 |
01A4: BTFSC 03.2 |
|
|
182 |
01A5: GOTO 1AB |
|
|
183 |
01A6: BCF 20.4 |
|
|
184 |
01A7: MOVF 20,W |
|
|
185 |
01A8: BSF 03.5 |
|
|
186 |
01A9: MOVWF 07 |
|
|
187 |
01AA: BCF 03.5 |
|
|
188 |
01AB: NOP |
|
|
189 |
01AC: BSF 20.3 |
|
|
190 |
01AD: MOVF 20,W |
|
|
191 |
01AE: BSF 03.5 |
|
|
192 |
01AF: MOVWF 07 |
|
|
193 |
01B0: BCF 03.5 |
|
|
194 |
01B1: BTFSS 07.3 |
|
|
195 |
01B2: GOTO 1B1 |
|
|
196 |
01B3: NOP |
|
|
197 |
01B4: BCF 07.3 |
|
|
198 |
01B5: BCF 20.3 |
|
|
199 |
01B6: MOVF 20,W |
|
|
200 |
01B7: BSF 03.5 |
|
|
201 |
01B8: MOVWF 07 |
|
|
202 |
01B9: NOP |
|
|
203 |
01BA: BCF 03.5 |
|
|
204 |
01BB: BCF 07.4 |
|
|
205 |
01BC: BCF 20.4 |
|
|
206 |
01BD: MOVF 20,W |
|
|
207 |
01BE: BSF 03.5 |
|
|
208 |
01BF: MOVWF 07 |
|
|
209 |
01C0: BCF 03.5 |
|
|
210 |
01C1: RETURN |
|
|
211 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD |
2906 |
jacho |
212 |
* |
2988 |
kaklik |
213 |
00AE: BCF 20.7 |
|
|
214 |
00AF: MOVF 20,W |
|
|
215 |
00B0: BSF 03.5 |
|
|
216 |
00B1: MOVWF 07 |
|
|
217 |
00B2: BCF 03.5 |
|
|
218 |
00B3: BCF 07.7 |
|
|
219 |
00B4: MOVLW 08 |
|
|
220 |
00B5: MOVWF 78 |
|
|
221 |
00B6: GOTO 0B7 |
|
|
222 |
00B7: NOP |
|
|
223 |
00B8: BSF 78.7 |
|
|
224 |
00B9: GOTO 0C8 |
|
|
225 |
00BA: BCF 78.7 |
|
|
226 |
00BB: RRF 39,F |
|
|
227 |
00BC: BTFSC 03.0 |
|
|
228 |
00BD: BSF 07.7 |
|
|
229 |
00BE: BTFSS 03.0 |
|
|
230 |
00BF: BCF 07.7 |
|
|
231 |
00C0: BSF 78.6 |
|
|
232 |
00C1: GOTO 0C8 |
|
|
233 |
00C2: BCF 78.6 |
|
|
234 |
00C3: DECFSZ 78,F |
|
|
235 |
00C4: GOTO 0BB |
|
|
236 |
00C5: GOTO 0C6 |
|
|
237 |
00C6: NOP |
|
|
238 |
00C7: BSF 07.7 |
|
|
239 |
00C8: MOVLW 3F |
|
|
240 |
00C9: MOVWF 04 |
|
|
241 |
00CA: DECFSZ 04,F |
|
|
242 |
00CB: GOTO 0CA |
|
|
243 |
00CC: NOP |
|
|
244 |
00CD: BTFSC 78.7 |
|
|
245 |
00CE: GOTO 0BA |
|
|
246 |
00CF: BTFSC 78.6 |
|
|
247 |
00D0: GOTO 0C2 |
|
|
248 |
00D1: RETURN |
2906 |
jacho |
249 |
.................... |
|
|
250 |
.................... |
2912 |
kaklik |
251 |
.................... #include "SHT25.h" |
2908 |
kaklik |
252 |
.................... |
2912 |
kaklik |
253 |
.................... #define SHT25_HEATER_ON 0x04 |
|
|
254 |
.................... #define SHT25_HEATER_OFF 0x00 |
|
|
255 |
.................... #define SHT25_OTP_reload_off 0x02 |
|
|
256 |
.................... #define SHT25_RH12_T14 0x00 |
|
|
257 |
.................... #define SHT25_RH8_T12 0x01 |
|
|
258 |
.................... #define SHT25_RH10_T13 0x80 |
|
|
259 |
.................... #define SHT25_RH11_T11 0x81 |
|
|
260 |
.................... |
|
|
261 |
.................... #define SHT25_ADDR 0x80 |
|
|
262 |
.................... |
|
|
263 |
.................... #include "SHT25.c" |
2909 |
kaklik |
264 |
.................... void SHT25_soft_reset() |
2906 |
jacho |
265 |
.................... { |
2909 |
kaklik |
266 |
.................... i2c_start(); // Start condition |
2911 |
kaklik |
267 |
* |
2988 |
kaklik |
268 |
0076: BSF 20.4 |
|
|
269 |
0077: MOVF 20,W |
|
|
270 |
0078: BSF 03.5 |
|
|
271 |
0079: MOVWF 07 |
|
|
272 |
007A: NOP |
|
|
273 |
007B: BCF 03.5 |
|
|
274 |
007C: BSF 20.3 |
|
|
275 |
007D: MOVF 20,W |
|
|
276 |
007E: BSF 03.5 |
|
|
277 |
007F: MOVWF 07 |
|
|
278 |
0080: NOP |
|
|
279 |
0081: BCF 03.5 |
|
|
280 |
0082: BCF 07.4 |
|
|
281 |
0083: BCF 20.4 |
|
|
282 |
0084: MOVF 20,W |
|
|
283 |
0085: BSF 03.5 |
|
|
284 |
0086: MOVWF 07 |
|
|
285 |
0087: NOP |
|
|
286 |
0088: BCF 03.5 |
|
|
287 |
0089: BCF 07.3 |
|
|
288 |
008A: BCF 20.3 |
|
|
289 |
008B: MOVF 20,W |
|
|
290 |
008C: BSF 03.5 |
|
|
291 |
008D: MOVWF 07 |
2909 |
kaklik |
292 |
.................... i2c_write(0x80); // Device address |
2988 |
kaklik |
293 |
008E: MOVLW 80 |
|
|
294 |
008F: BCF 03.5 |
|
|
295 |
0090: MOVWF 30 |
|
|
296 |
0091: CALL 02C |
2909 |
kaklik |
297 |
.................... i2c_write(0xFE); // Device command |
2988 |
kaklik |
298 |
0092: MOVLW FE |
|
|
299 |
0093: MOVWF 30 |
|
|
300 |
0094: CALL 02C |
2909 |
kaklik |
301 |
.................... i2c_stop(); // Stop condition |
2988 |
kaklik |
302 |
0095: BCF 20.4 |
|
|
303 |
0096: MOVF 20,W |
|
|
304 |
0097: BSF 03.5 |
|
|
305 |
0098: MOVWF 07 |
|
|
306 |
0099: NOP |
|
|
307 |
009A: BCF 03.5 |
|
|
308 |
009B: BSF 20.3 |
|
|
309 |
009C: MOVF 20,W |
|
|
310 |
009D: BSF 03.5 |
|
|
311 |
009E: MOVWF 07 |
2912 |
kaklik |
312 |
009F: BCF 03.5 |
2988 |
kaklik |
313 |
00A0: BTFSS 07.3 |
|
|
314 |
00A1: GOTO 0A0 |
|
|
315 |
00A2: NOP |
|
|
316 |
00A3: GOTO 0A4 |
|
|
317 |
00A4: NOP |
|
|
318 |
00A5: BSF 20.4 |
|
|
319 |
00A6: MOVF 20,W |
|
|
320 |
00A7: BSF 03.5 |
|
|
321 |
00A8: MOVWF 07 |
2912 |
kaklik |
322 |
00A9: NOP |
2909 |
kaklik |
323 |
.................... } |
2988 |
kaklik |
324 |
00AA: BCF 03.5 |
|
|
325 |
00AB: BSF 0A.3 |
|
|
326 |
00AC: BCF 0A.4 |
|
|
327 |
00AD: GOTO 06A (RETURN) |
2906 |
jacho |
328 |
.................... |
2911 |
kaklik |
329 |
.................... unsigned int8 SHT25_setup(unsigned int8 setup_reg ) // writes to status register and returns its value |
2909 |
kaklik |
330 |
.................... { |
|
|
331 |
.................... unsigned int8 reg; |
|
|
332 |
.................... |
|
|
333 |
.................... i2c_start(); // Start condition |
2906 |
jacho |
334 |
* |
2988 |
kaklik |
335 |
05E4: BSF 20.4 |
|
|
336 |
05E5: MOVF 20,W |
|
|
337 |
05E6: BSF 03.5 |
|
|
338 |
05E7: MOVWF 07 |
|
|
339 |
05E8: NOP |
|
|
340 |
05E9: BCF 03.5 |
|
|
341 |
05EA: BSF 20.3 |
|
|
342 |
05EB: MOVF 20,W |
|
|
343 |
05EC: BSF 03.5 |
|
|
344 |
05ED: MOVWF 07 |
|
|
345 |
05EE: NOP |
|
|
346 |
05EF: BCF 03.5 |
|
|
347 |
05F0: BCF 07.4 |
|
|
348 |
05F1: BCF 20.4 |
|
|
349 |
05F2: MOVF 20,W |
|
|
350 |
05F3: BSF 03.5 |
|
|
351 |
05F4: MOVWF 07 |
|
|
352 |
05F5: NOP |
|
|
353 |
05F6: BCF 03.5 |
|
|
354 |
05F7: BCF 07.3 |
|
|
355 |
05F8: BCF 20.3 |
|
|
356 |
05F9: MOVF 20,W |
|
|
357 |
05FA: BSF 03.5 |
|
|
358 |
05FB: MOVWF 07 |
2911 |
kaklik |
359 |
.................... i2c_write(SHT25_ADDR); // Device address |
2988 |
kaklik |
360 |
05FC: MOVLW 80 |
|
|
361 |
05FD: BCF 03.5 |
|
|
362 |
05FE: MOVWF 30 |
|
|
363 |
05FF: CALL 02C |
2909 |
kaklik |
364 |
.................... i2c_write(0xE7); // Device command |
2988 |
kaklik |
365 |
0600: MOVLW E7 |
|
|
366 |
0601: MOVWF 30 |
|
|
367 |
0602: CALL 02C |
2906 |
jacho |
368 |
.................... |
2909 |
kaklik |
369 |
.................... i2c_start(); // Start condition |
2988 |
kaklik |
370 |
0603: BSF 20.4 |
|
|
371 |
0604: MOVF 20,W |
|
|
372 |
0605: BSF 03.5 |
|
|
373 |
0606: MOVWF 07 |
|
|
374 |
0607: NOP |
|
|
375 |
0608: BCF 03.5 |
|
|
376 |
0609: BSF 20.3 |
|
|
377 |
060A: MOVF 20,W |
|
|
378 |
060B: BSF 03.5 |
|
|
379 |
060C: MOVWF 07 |
|
|
380 |
060D: NOP |
|
|
381 |
060E: BCF 03.5 |
|
|
382 |
060F: BTFSS 07.3 |
|
|
383 |
0610: GOTO 60F |
|
|
384 |
0611: BCF 07.4 |
|
|
385 |
0612: BCF 20.4 |
|
|
386 |
0613: MOVF 20,W |
|
|
387 |
0614: BSF 03.5 |
|
|
388 |
0615: MOVWF 07 |
|
|
389 |
0616: NOP |
|
|
390 |
0617: BCF 03.5 |
|
|
391 |
0618: BCF 07.3 |
|
|
392 |
0619: BCF 20.3 |
|
|
393 |
061A: MOVF 20,W |
|
|
394 |
061B: BSF 03.5 |
|
|
395 |
061C: MOVWF 07 |
2911 |
kaklik |
396 |
.................... i2c_write(SHT25_ADDR+1); // Device address |
2988 |
kaklik |
397 |
061D: MOVLW 81 |
|
|
398 |
061E: BCF 03.5 |
|
|
399 |
061F: MOVWF 30 |
|
|
400 |
0620: CALL 02C |
2911 |
kaklik |
401 |
.................... reg=i2c_read(0); // Read status actual status register |
2988 |
kaklik |
402 |
0621: CLRF 77 |
|
|
403 |
0622: CALL 17D |
|
|
404 |
0623: MOVF 78,W |
|
|
405 |
0624: MOVWF 2C |
2911 |
kaklik |
406 |
.................... |
|
|
407 |
.................... reg = (reg & 0x3A) | setup_reg; |
2988 |
kaklik |
408 |
0625: MOVF 2C,W |
|
|
409 |
0626: ANDLW 3A |
|
|
410 |
0627: IORWF 2B,W |
|
|
411 |
0628: MOVWF 2C |
2911 |
kaklik |
412 |
.................... |
|
|
413 |
.................... i2c_start(); // Start condition |
2988 |
kaklik |
414 |
0629: BSF 20.4 |
|
|
415 |
062A: MOVF 20,W |
|
|
416 |
062B: BSF 03.5 |
|
|
417 |
062C: MOVWF 07 |
|
|
418 |
062D: NOP |
|
|
419 |
062E: BCF 03.5 |
|
|
420 |
062F: BSF 20.3 |
|
|
421 |
0630: MOVF 20,W |
|
|
422 |
0631: BSF 03.5 |
|
|
423 |
0632: MOVWF 07 |
|
|
424 |
0633: NOP |
|
|
425 |
0634: BCF 03.5 |
|
|
426 |
0635: BTFSS 07.3 |
|
|
427 |
0636: GOTO 635 |
|
|
428 |
0637: BCF 07.4 |
|
|
429 |
0638: BCF 20.4 |
|
|
430 |
0639: MOVF 20,W |
|
|
431 |
063A: BSF 03.5 |
|
|
432 |
063B: MOVWF 07 |
|
|
433 |
063C: NOP |
|
|
434 |
063D: BCF 03.5 |
|
|
435 |
063E: BCF 07.3 |
|
|
436 |
063F: BCF 20.3 |
|
|
437 |
0640: MOVF 20,W |
|
|
438 |
0641: BSF 03.5 |
|
|
439 |
0642: MOVWF 07 |
2911 |
kaklik |
440 |
.................... i2c_write(SHT25_ADDR); // Device address |
2988 |
kaklik |
441 |
0643: MOVLW 80 |
|
|
442 |
0644: BCF 03.5 |
|
|
443 |
0645: MOVWF 30 |
|
|
444 |
0646: CALL 02C |
2912 |
kaklik |
445 |
.................... i2c_write(0xE6); // Write to status register |
2988 |
kaklik |
446 |
0647: MOVLW E6 |
|
|
447 |
0648: MOVWF 30 |
|
|
448 |
0649: CALL 02C |
2911 |
kaklik |
449 |
.................... i2c_write(reg); // Device command |
2988 |
kaklik |
450 |
064A: MOVF 2C,W |
|
|
451 |
064B: MOVWF 30 |
|
|
452 |
064C: CALL 02C |
2909 |
kaklik |
453 |
.................... i2c_stop(); // Stop condition |
2988 |
kaklik |
454 |
064D: BCF 20.4 |
|
|
455 |
064E: MOVF 20,W |
|
|
456 |
064F: BSF 03.5 |
|
|
457 |
0650: MOVWF 07 |
|
|
458 |
0651: NOP |
|
|
459 |
0652: BCF 03.5 |
|
|
460 |
0653: BSF 20.3 |
|
|
461 |
0654: MOVF 20,W |
|
|
462 |
0655: BSF 03.5 |
|
|
463 |
0656: MOVWF 07 |
|
|
464 |
0657: BCF 03.5 |
|
|
465 |
0658: BTFSS 07.3 |
|
|
466 |
0659: GOTO 658 |
|
|
467 |
065A: NOP |
|
|
468 |
065B: GOTO 65C |
|
|
469 |
065C: NOP |
|
|
470 |
065D: BSF 20.4 |
|
|
471 |
065E: MOVF 20,W |
|
|
472 |
065F: BSF 03.5 |
|
|
473 |
0660: MOVWF 07 |
|
|
474 |
0661: NOP |
2911 |
kaklik |
475 |
.................... |
2912 |
kaklik |
476 |
.................... delay_ms(10); |
2988 |
kaklik |
477 |
0662: MOVLW 0A |
|
|
478 |
0663: BCF 03.5 |
|
|
479 |
0664: MOVWF 30 |
|
|
480 |
0665: CALL 169 |
2912 |
kaklik |
481 |
.................... |
|
|
482 |
.................... i2c_start(); // Start condition |
2988 |
kaklik |
483 |
0666: BSF 20.4 |
|
|
484 |
0667: MOVF 20,W |
|
|
485 |
0668: BSF 03.5 |
|
|
486 |
0669: MOVWF 07 |
|
|
487 |
066A: NOP |
|
|
488 |
066B: BCF 03.5 |
|
|
489 |
066C: BSF 20.3 |
|
|
490 |
066D: MOVF 20,W |
|
|
491 |
066E: BSF 03.5 |
|
|
492 |
066F: MOVWF 07 |
|
|
493 |
0670: NOP |
|
|
494 |
0671: BCF 03.5 |
|
|
495 |
0672: BCF 07.4 |
|
|
496 |
0673: BCF 20.4 |
|
|
497 |
0674: MOVF 20,W |
|
|
498 |
0675: BSF 03.5 |
|
|
499 |
0676: MOVWF 07 |
|
|
500 |
0677: NOP |
|
|
501 |
0678: BCF 03.5 |
|
|
502 |
0679: BCF 07.3 |
|
|
503 |
067A: BCF 20.3 |
|
|
504 |
067B: MOVF 20,W |
|
|
505 |
067C: BSF 03.5 |
|
|
506 |
067D: MOVWF 07 |
2912 |
kaklik |
507 |
.................... i2c_write(SHT25_ADDR); // Device address |
2988 |
kaklik |
508 |
067E: MOVLW 80 |
|
|
509 |
067F: BCF 03.5 |
|
|
510 |
0680: MOVWF 30 |
|
|
511 |
0681: CALL 02C |
2912 |
kaklik |
512 |
.................... i2c_write(0xE7); // Device command |
2988 |
kaklik |
513 |
0682: MOVLW E7 |
|
|
514 |
0683: MOVWF 30 |
|
|
515 |
0684: CALL 02C |
2912 |
kaklik |
516 |
.................... |
|
|
517 |
.................... i2c_start(); // Start condition |
2988 |
kaklik |
518 |
0685: BSF 20.4 |
|
|
519 |
0686: MOVF 20,W |
|
|
520 |
0687: BSF 03.5 |
|
|
521 |
0688: MOVWF 07 |
|
|
522 |
0689: NOP |
|
|
523 |
068A: BCF 03.5 |
|
|
524 |
068B: BSF 20.3 |
|
|
525 |
068C: MOVF 20,W |
|
|
526 |
068D: BSF 03.5 |
|
|
527 |
068E: MOVWF 07 |
|
|
528 |
068F: NOP |
|
|
529 |
0690: BCF 03.5 |
|
|
530 |
0691: BTFSS 07.3 |
|
|
531 |
0692: GOTO 691 |
|
|
532 |
0693: BCF 07.4 |
|
|
533 |
0694: BCF 20.4 |
|
|
534 |
0695: MOVF 20,W |
|
|
535 |
0696: BSF 03.5 |
|
|
536 |
0697: MOVWF 07 |
|
|
537 |
0698: NOP |
|
|
538 |
0699: BCF 03.5 |
|
|
539 |
069A: BCF 07.3 |
|
|
540 |
069B: BCF 20.3 |
|
|
541 |
069C: MOVF 20,W |
|
|
542 |
069D: BSF 03.5 |
|
|
543 |
069E: MOVWF 07 |
2912 |
kaklik |
544 |
.................... i2c_write(SHT25_ADDR+1); // Device address |
2988 |
kaklik |
545 |
069F: MOVLW 81 |
|
|
546 |
06A0: BCF 03.5 |
|
|
547 |
06A1: MOVWF 30 |
|
|
548 |
06A2: CALL 02C |
2912 |
kaklik |
549 |
.................... reg=i2c_read(0); // Read status actual status register |
2988 |
kaklik |
550 |
06A3: CLRF 77 |
|
|
551 |
06A4: CALL 17D |
|
|
552 |
06A5: MOVF 78,W |
|
|
553 |
06A6: MOVWF 2C |
2912 |
kaklik |
554 |
.................... |
2911 |
kaklik |
555 |
.................... return (reg); |
2988 |
kaklik |
556 |
06A7: MOVF 2C,W |
|
|
557 |
06A8: MOVWF 78 |
2909 |
kaklik |
558 |
.................... } |
2988 |
kaklik |
559 |
06A9: BSF 0A.3 |
|
|
560 |
06AA: BCF 0A.4 |
|
|
561 |
06AB: GOTO 0C0 (RETURN) |
2906 |
jacho |
562 |
.................... |
2911 |
kaklik |
563 |
.................... |
2909 |
kaklik |
564 |
.................... float SHT25_get_temp() |
|
|
565 |
.................... { |
|
|
566 |
.................... unsigned int8 MSB, LSB, Check; |
|
|
567 |
.................... unsigned int16 data; |
2906 |
jacho |
568 |
.................... |
2909 |
kaklik |
569 |
.................... i2c_start(); |
|
|
570 |
* |
2988 |
kaklik |
571 |
045F: BSF 20.4 |
|
|
572 |
0460: MOVF 20,W |
|
|
573 |
0461: BSF 03.5 |
|
|
574 |
0462: MOVWF 07 |
|
|
575 |
0463: NOP |
|
|
576 |
0464: BCF 03.5 |
|
|
577 |
0465: BSF 20.3 |
|
|
578 |
0466: MOVF 20,W |
|
|
579 |
0467: BSF 03.5 |
|
|
580 |
0468: MOVWF 07 |
|
|
581 |
0469: NOP |
|
|
582 |
046A: BCF 03.5 |
|
|
583 |
046B: BTFSS 07.3 |
|
|
584 |
046C: GOTO 46B |
|
|
585 |
046D: BCF 07.4 |
|
|
586 |
046E: BCF 20.4 |
|
|
587 |
046F: MOVF 20,W |
|
|
588 |
0470: BSF 03.5 |
|
|
589 |
0471: MOVWF 07 |
|
|
590 |
0472: NOP |
|
|
591 |
0473: BCF 03.5 |
|
|
592 |
0474: BCF 07.3 |
|
|
593 |
0475: BCF 20.3 |
|
|
594 |
0476: MOVF 20,W |
|
|
595 |
0477: BSF 03.5 |
|
|
596 |
0478: MOVWF 07 |
2911 |
kaklik |
597 |
.................... I2C_Write(SHT25_ADDR); |
2988 |
kaklik |
598 |
0479: MOVLW 80 |
|
|
599 |
047A: BCF 03.5 |
|
|
600 |
047B: MOVWF 30 |
|
|
601 |
047C: CALL 02C |
2909 |
kaklik |
602 |
.................... I2C_write(0xE3); |
2988 |
kaklik |
603 |
047D: MOVLW E3 |
|
|
604 |
047E: MOVWF 30 |
|
|
605 |
047F: CALL 02C |
2906 |
jacho |
606 |
.................... i2c_stop(); |
2988 |
kaklik |
607 |
0480: BCF 20.4 |
|
|
608 |
0481: MOVF 20,W |
|
|
609 |
0482: BSF 03.5 |
|
|
610 |
0483: MOVWF 07 |
|
|
611 |
0484: NOP |
|
|
612 |
0485: BCF 03.5 |
|
|
613 |
0486: BSF 20.3 |
|
|
614 |
0487: MOVF 20,W |
|
|
615 |
0488: BSF 03.5 |
|
|
616 |
0489: MOVWF 07 |
|
|
617 |
048A: BCF 03.5 |
|
|
618 |
048B: BTFSS 07.3 |
|
|
619 |
048C: GOTO 48B |
|
|
620 |
048D: NOP |
|
|
621 |
048E: GOTO 48F |
|
|
622 |
048F: NOP |
|
|
623 |
0490: BSF 20.4 |
|
|
624 |
0491: MOVF 20,W |
|
|
625 |
0492: BSF 03.5 |
|
|
626 |
0493: MOVWF 07 |
|
|
627 |
0494: NOP |
2909 |
kaklik |
628 |
.................... |
|
|
629 |
.................... delay_ms(100); |
2988 |
kaklik |
630 |
0495: MOVLW 64 |
|
|
631 |
0496: BCF 03.5 |
|
|
632 |
0497: MOVWF 30 |
|
|
633 |
0498: CALL 169 |
2906 |
jacho |
634 |
.................... |
|
|
635 |
.................... i2c_start(); |
2988 |
kaklik |
636 |
0499: BSF 20.4 |
|
|
637 |
049A: MOVF 20,W |
|
|
638 |
049B: BSF 03.5 |
|
|
639 |
049C: MOVWF 07 |
|
|
640 |
049D: NOP |
|
|
641 |
049E: BCF 03.5 |
|
|
642 |
049F: BSF 20.3 |
|
|
643 |
04A0: MOVF 20,W |
|
|
644 |
04A1: BSF 03.5 |
|
|
645 |
04A2: MOVWF 07 |
|
|
646 |
04A3: NOP |
|
|
647 |
04A4: BCF 03.5 |
|
|
648 |
04A5: BCF 07.4 |
|
|
649 |
04A6: BCF 20.4 |
|
|
650 |
04A7: MOVF 20,W |
|
|
651 |
04A8: BSF 03.5 |
|
|
652 |
04A9: MOVWF 07 |
|
|
653 |
04AA: NOP |
|
|
654 |
04AB: BCF 03.5 |
|
|
655 |
04AC: BCF 07.3 |
|
|
656 |
04AD: BCF 20.3 |
|
|
657 |
04AE: MOVF 20,W |
|
|
658 |
04AF: BSF 03.5 |
|
|
659 |
04B0: MOVWF 07 |
2911 |
kaklik |
660 |
.................... I2C_Write(SHT25_ADDR+1); |
2988 |
kaklik |
661 |
04B1: MOVLW 81 |
|
|
662 |
04B2: BCF 03.5 |
|
|
663 |
04B3: MOVWF 30 |
|
|
664 |
04B4: CALL 02C |
2909 |
kaklik |
665 |
.................... MSB=i2c_read(1); |
2988 |
kaklik |
666 |
04B5: MOVLW 01 |
|
|
667 |
04B6: MOVWF 77 |
|
|
668 |
04B7: CALL 17D |
|
|
669 |
04B8: MOVF 78,W |
|
|
670 |
04B9: MOVWF 2B |
2909 |
kaklik |
671 |
.................... LSB=i2c_read(1); |
2988 |
kaklik |
672 |
04BA: MOVLW 01 |
|
|
673 |
04BB: MOVWF 77 |
|
|
674 |
04BC: CALL 17D |
|
|
675 |
04BD: MOVF 78,W |
|
|
676 |
04BE: MOVWF 2C |
2909 |
kaklik |
677 |
.................... Check=i2c_read(0); |
2988 |
kaklik |
678 |
04BF: CLRF 77 |
|
|
679 |
04C0: CALL 17D |
|
|
680 |
04C1: MOVF 78,W |
|
|
681 |
04C2: MOVWF 2D |
2909 |
kaklik |
682 |
.................... i2c_stop(); |
2988 |
kaklik |
683 |
04C3: BCF 20.4 |
|
|
684 |
04C4: MOVF 20,W |
|
|
685 |
04C5: BSF 03.5 |
|
|
686 |
04C6: MOVWF 07 |
|
|
687 |
04C7: NOP |
|
|
688 |
04C8: BCF 03.5 |
|
|
689 |
04C9: BSF 20.3 |
|
|
690 |
04CA: MOVF 20,W |
|
|
691 |
04CB: BSF 03.5 |
|
|
692 |
04CC: MOVWF 07 |
|
|
693 |
04CD: BCF 03.5 |
|
|
694 |
04CE: BTFSS 07.3 |
|
|
695 |
04CF: GOTO 4CE |
|
|
696 |
04D0: NOP |
|
|
697 |
04D1: GOTO 4D2 |
|
|
698 |
04D2: NOP |
|
|
699 |
04D3: BSF 20.4 |
|
|
700 |
04D4: MOVF 20,W |
|
|
701 |
04D5: BSF 03.5 |
|
|
702 |
04D6: MOVWF 07 |
|
|
703 |
04D7: NOP |
2909 |
kaklik |
704 |
.................... |
|
|
705 |
.................... LSB = LSB >> 2; // trow out status bits |
2988 |
kaklik |
706 |
04D8: BCF 03.5 |
|
|
707 |
04D9: RRF 2C,F |
|
|
708 |
04DA: RRF 2C,F |
|
|
709 |
04DB: MOVLW 3F |
|
|
710 |
04DC: ANDWF 2C,F |
2906 |
jacho |
711 |
.................... |
2909 |
kaklik |
712 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4)); |
2988 |
kaklik |
713 |
04DD: CLRF 31 |
|
|
714 |
04DE: MOVF 2B,W |
|
|
715 |
04DF: MOVWF 30 |
|
|
716 |
04E0: MOVWF 31 |
|
|
717 |
04E1: CLRF 30 |
|
|
718 |
04E2: SWAPF 2C,W |
|
|
719 |
04E3: MOVWF 77 |
|
|
720 |
04E4: MOVLW F0 |
|
|
721 |
04E5: ANDWF 77,F |
|
|
722 |
04E6: MOVF 77,W |
|
|
723 |
04E7: ADDWF 30,W |
|
|
724 |
04E8: MOVWF 2E |
|
|
725 |
04E9: MOVF 31,W |
|
|
726 |
04EA: MOVWF 2F |
|
|
727 |
04EB: BTFSC 03.0 |
|
|
728 |
04EC: INCF 2F,F |
2909 |
kaklik |
729 |
.................... return(-46.85 + 175.72*((float)data/0xFFFF)); |
2988 |
kaklik |
730 |
04ED: MOVF 2F,W |
|
|
731 |
04EE: MOVWF 31 |
|
|
732 |
04EF: MOVF 2E,W |
|
|
733 |
04F0: MOVWF 30 |
|
|
734 |
04F1: CALL 1C2 |
|
|
735 |
04F2: MOVF 77,W |
|
|
736 |
04F3: MOVWF 30 |
|
|
737 |
04F4: MOVF 78,W |
|
|
738 |
04F5: MOVWF 31 |
|
|
739 |
04F6: MOVF 79,W |
|
|
740 |
04F7: MOVWF 32 |
|
|
741 |
04F8: MOVF 7A,W |
|
|
742 |
04F9: MOVWF 33 |
|
|
743 |
04FA: MOVWF 37 |
|
|
744 |
04FB: MOVF 79,W |
|
|
745 |
04FC: MOVWF 36 |
|
|
746 |
04FD: MOVF 78,W |
|
|
747 |
04FE: MOVWF 35 |
|
|
748 |
04FF: MOVF 77,W |
|
|
749 |
0500: MOVWF 34 |
|
|
750 |
0501: CLRF 3B |
|
|
751 |
0502: MOVLW FF |
|
|
752 |
0503: MOVWF 3A |
|
|
753 |
0504: MOVLW 7F |
|
|
754 |
0505: MOVWF 39 |
|
|
755 |
0506: MOVLW 8E |
|
|
756 |
0507: MOVWF 38 |
|
|
757 |
0508: CALL 1DF |
|
|
758 |
0509: MOVLW 52 |
|
|
759 |
050A: MOVWF 3C |
|
|
760 |
050B: MOVLW B8 |
|
|
761 |
050C: MOVWF 3B |
|
|
762 |
050D: MOVLW 2F |
|
|
763 |
050E: MOVWF 3A |
|
|
764 |
050F: MOVLW 86 |
|
|
765 |
0510: MOVWF 39 |
|
|
766 |
0511: MOVF 7A,W |
|
|
767 |
0512: MOVWF 40 |
|
|
768 |
0513: MOVF 79,W |
|
|
769 |
0514: MOVWF 3F |
|
|
770 |
0515: MOVF 78,W |
|
|
771 |
0516: MOVWF 3E |
|
|
772 |
0517: MOVF 77,W |
|
|
773 |
0518: MOVWF 3D |
|
|
774 |
0519: CALL 2A9 |
|
|
775 |
051A: BCF 03.1 |
|
|
776 |
051B: MOVLW 66 |
|
|
777 |
051C: MOVWF 33 |
|
|
778 |
051D: MOVWF 32 |
|
|
779 |
051E: MOVLW BB |
|
|
780 |
051F: MOVWF 31 |
|
|
781 |
0520: MOVLW 84 |
|
|
782 |
0521: MOVWF 30 |
|
|
783 |
0522: MOVF 7A,W |
|
|
784 |
0523: MOVWF 37 |
|
|
785 |
0524: MOVF 79,W |
|
|
786 |
0525: MOVWF 36 |
|
|
787 |
0526: MOVF 78,W |
|
|
788 |
0527: MOVWF 35 |
|
|
789 |
0528: MOVF 77,W |
|
|
790 |
0529: MOVWF 34 |
|
|
791 |
052A: CALL 31E |
2909 |
kaklik |
792 |
.................... } |
2988 |
kaklik |
793 |
052B: BSF 0A.3 |
|
|
794 |
052C: BCF 0A.4 |
|
|
795 |
052D: GOTO 0A8 (RETURN) |
2909 |
kaklik |
796 |
.................... |
|
|
797 |
.................... float SHT25_get_hum() |
|
|
798 |
.................... { |
|
|
799 |
.................... unsigned int8 MSB, LSB, Check; |
|
|
800 |
.................... unsigned int16 data; |
|
|
801 |
.................... |
|
|
802 |
.................... i2c_start(); //RH |
2988 |
kaklik |
803 |
052E: BSF 20.4 |
|
|
804 |
052F: MOVF 20,W |
|
|
805 |
0530: BSF 03.5 |
|
|
806 |
0531: MOVWF 07 |
|
|
807 |
0532: NOP |
|
|
808 |
0533: BCF 03.5 |
|
|
809 |
0534: BSF 20.3 |
|
|
810 |
0535: MOVF 20,W |
|
|
811 |
0536: BSF 03.5 |
|
|
812 |
0537: MOVWF 07 |
|
|
813 |
0538: NOP |
|
|
814 |
0539: BCF 03.5 |
|
|
815 |
053A: BCF 07.4 |
|
|
816 |
053B: BCF 20.4 |
|
|
817 |
053C: MOVF 20,W |
|
|
818 |
053D: BSF 03.5 |
|
|
819 |
053E: MOVWF 07 |
|
|
820 |
053F: NOP |
|
|
821 |
0540: BCF 03.5 |
|
|
822 |
0541: BCF 07.3 |
|
|
823 |
0542: BCF 20.3 |
|
|
824 |
0543: MOVF 20,W |
|
|
825 |
0544: BSF 03.5 |
|
|
826 |
0545: MOVWF 07 |
2911 |
kaklik |
827 |
.................... I2C_Write(SHT25_ADDR); |
2988 |
kaklik |
828 |
0546: MOVLW 80 |
|
|
829 |
0547: BCF 03.5 |
|
|
830 |
0548: MOVWF 30 |
|
|
831 |
0549: CALL 02C |
2909 |
kaklik |
832 |
.................... I2C_write(0xE5); |
2988 |
kaklik |
833 |
054A: MOVLW E5 |
|
|
834 |
054B: MOVWF 30 |
|
|
835 |
054C: CALL 02C |
2909 |
kaklik |
836 |
.................... |
|
|
837 |
.................... delay_ms(100); |
2988 |
kaklik |
838 |
054D: MOVLW 64 |
|
|
839 |
054E: MOVWF 30 |
|
|
840 |
054F: CALL 169 |
2909 |
kaklik |
841 |
.................... |
2906 |
jacho |
842 |
.................... i2c_start(); |
2988 |
kaklik |
843 |
0550: BSF 20.4 |
|
|
844 |
0551: MOVF 20,W |
|
|
845 |
0552: BSF 03.5 |
|
|
846 |
0553: MOVWF 07 |
|
|
847 |
0554: NOP |
|
|
848 |
0555: BCF 03.5 |
|
|
849 |
0556: BSF 20.3 |
|
|
850 |
0557: MOVF 20,W |
|
|
851 |
0558: BSF 03.5 |
|
|
852 |
0559: MOVWF 07 |
|
|
853 |
055A: NOP |
|
|
854 |
055B: BCF 03.5 |
|
|
855 |
055C: BTFSS 07.3 |
|
|
856 |
055D: GOTO 55C |
|
|
857 |
055E: BCF 07.4 |
|
|
858 |
055F: BCF 20.4 |
|
|
859 |
0560: MOVF 20,W |
|
|
860 |
0561: BSF 03.5 |
|
|
861 |
0562: MOVWF 07 |
|
|
862 |
0563: NOP |
|
|
863 |
0564: BCF 03.5 |
|
|
864 |
0565: BCF 07.3 |
|
|
865 |
0566: BCF 20.3 |
|
|
866 |
0567: MOVF 20,W |
|
|
867 |
0568: BSF 03.5 |
|
|
868 |
0569: MOVWF 07 |
2911 |
kaklik |
869 |
.................... I2C_Write(SHT25_ADDR+1); |
2988 |
kaklik |
870 |
056A: MOVLW 81 |
|
|
871 |
056B: BCF 03.5 |
|
|
872 |
056C: MOVWF 30 |
|
|
873 |
056D: CALL 02C |
2909 |
kaklik |
874 |
.................... MSB=i2c_read(1); |
2988 |
kaklik |
875 |
056E: MOVLW 01 |
|
|
876 |
056F: MOVWF 77 |
|
|
877 |
0570: CALL 17D |
|
|
878 |
0571: MOVF 78,W |
|
|
879 |
0572: MOVWF 2B |
2909 |
kaklik |
880 |
.................... LSB=i2c_read(1); |
2988 |
kaklik |
881 |
0573: MOVLW 01 |
|
|
882 |
0574: MOVWF 77 |
|
|
883 |
0575: CALL 17D |
|
|
884 |
0576: MOVF 78,W |
|
|
885 |
0577: MOVWF 2C |
2909 |
kaklik |
886 |
.................... Check=i2c_read(0); |
2988 |
kaklik |
887 |
0578: CLRF 77 |
|
|
888 |
0579: CALL 17D |
|
|
889 |
057A: MOVF 78,W |
|
|
890 |
057B: MOVWF 2D |
2909 |
kaklik |
891 |
.................... i2c_stop(); |
2988 |
kaklik |
892 |
057C: BCF 20.4 |
|
|
893 |
057D: MOVF 20,W |
|
|
894 |
057E: BSF 03.5 |
|
|
895 |
057F: MOVWF 07 |
|
|
896 |
0580: NOP |
|
|
897 |
0581: BCF 03.5 |
|
|
898 |
0582: BSF 20.3 |
|
|
899 |
0583: MOVF 20,W |
|
|
900 |
0584: BSF 03.5 |
|
|
901 |
0585: MOVWF 07 |
|
|
902 |
0586: BCF 03.5 |
|
|
903 |
0587: BTFSS 07.3 |
|
|
904 |
0588: GOTO 587 |
|
|
905 |
0589: NOP |
|
|
906 |
058A: GOTO 58B |
|
|
907 |
058B: NOP |
|
|
908 |
058C: BSF 20.4 |
|
|
909 |
058D: MOVF 20,W |
|
|
910 |
058E: BSF 03.5 |
|
|
911 |
058F: MOVWF 07 |
|
|
912 |
0590: NOP |
2906 |
jacho |
913 |
.................... |
2909 |
kaklik |
914 |
.................... LSB = LSB >> 2; // trow out status bits |
2988 |
kaklik |
915 |
0591: BCF 03.5 |
|
|
916 |
0592: RRF 2C,F |
|
|
917 |
0593: RRF 2C,F |
|
|
918 |
0594: MOVLW 3F |
|
|
919 |
0595: ANDWF 2C,F |
2906 |
jacho |
920 |
.................... |
2909 |
kaklik |
921 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) ); |
2988 |
kaklik |
922 |
0596: CLRF 31 |
|
|
923 |
0597: MOVF 2B,W |
|
|
924 |
0598: MOVWF 30 |
|
|
925 |
0599: MOVWF 31 |
|
|
926 |
059A: CLRF 30 |
|
|
927 |
059B: SWAPF 2C,W |
|
|
928 |
059C: MOVWF 77 |
|
|
929 |
059D: MOVLW F0 |
|
|
930 |
059E: ANDWF 77,F |
|
|
931 |
059F: MOVF 77,W |
|
|
932 |
05A0: ADDWF 30,W |
|
|
933 |
05A1: MOVWF 2E |
|
|
934 |
05A2: MOVF 31,W |
|
|
935 |
05A3: MOVWF 2F |
|
|
936 |
05A4: BTFSC 03.0 |
|
|
937 |
05A5: INCF 2F,F |
2909 |
kaklik |
938 |
.................... return( -6.0 + 125.0*((float)data/0xFFFF)); |
2988 |
kaklik |
939 |
05A6: MOVF 2F,W |
|
|
940 |
05A7: MOVWF 31 |
|
|
941 |
05A8: MOVF 2E,W |
|
|
942 |
05A9: MOVWF 30 |
|
|
943 |
05AA: CALL 1C2 |
|
|
944 |
05AB: MOVF 77,W |
|
|
945 |
05AC: MOVWF 30 |
|
|
946 |
05AD: MOVF 78,W |
|
|
947 |
05AE: MOVWF 31 |
|
|
948 |
05AF: MOVF 79,W |
|
|
949 |
05B0: MOVWF 32 |
|
|
950 |
05B1: MOVF 7A,W |
|
|
951 |
05B2: MOVWF 33 |
|
|
952 |
05B3: MOVWF 37 |
|
|
953 |
05B4: MOVF 79,W |
|
|
954 |
05B5: MOVWF 36 |
|
|
955 |
05B6: MOVF 78,W |
|
|
956 |
05B7: MOVWF 35 |
|
|
957 |
05B8: MOVF 77,W |
|
|
958 |
05B9: MOVWF 34 |
|
|
959 |
05BA: CLRF 3B |
|
|
960 |
05BB: MOVLW FF |
|
|
961 |
05BC: MOVWF 3A |
|
|
962 |
05BD: MOVLW 7F |
|
|
963 |
05BE: MOVWF 39 |
|
|
964 |
05BF: MOVLW 8E |
|
|
965 |
05C0: MOVWF 38 |
|
|
966 |
05C1: CALL 1DF |
|
|
967 |
05C2: CLRF 3C |
|
|
968 |
05C3: CLRF 3B |
|
|
969 |
05C4: MOVLW 7A |
|
|
970 |
05C5: MOVWF 3A |
|
|
971 |
05C6: MOVLW 85 |
|
|
972 |
05C7: MOVWF 39 |
|
|
973 |
05C8: MOVF 7A,W |
|
|
974 |
05C9: MOVWF 40 |
|
|
975 |
05CA: MOVF 79,W |
|
|
976 |
05CB: MOVWF 3F |
|
|
977 |
05CC: MOVF 78,W |
|
|
978 |
05CD: MOVWF 3E |
|
|
979 |
05CE: MOVF 77,W |
|
|
980 |
05CF: MOVWF 3D |
|
|
981 |
05D0: CALL 2A9 |
|
|
982 |
05D1: BCF 03.1 |
|
|
983 |
05D2: CLRF 33 |
|
|
984 |
05D3: CLRF 32 |
|
|
985 |
05D4: MOVLW C0 |
|
|
986 |
05D5: MOVWF 31 |
|
|
987 |
05D6: MOVLW 81 |
|
|
988 |
05D7: MOVWF 30 |
|
|
989 |
05D8: MOVF 7A,W |
|
|
990 |
05D9: MOVWF 37 |
|
|
991 |
05DA: MOVF 79,W |
|
|
992 |
05DB: MOVWF 36 |
|
|
993 |
05DC: MOVF 78,W |
|
|
994 |
05DD: MOVWF 35 |
|
|
995 |
05DE: MOVF 77,W |
|
|
996 |
05DF: MOVWF 34 |
|
|
997 |
05E0: CALL 31E |
2909 |
kaklik |
998 |
.................... } |
2988 |
kaklik |
999 |
05E1: BSF 0A.3 |
|
|
1000 |
05E2: BCF 0A.4 |
|
|
1001 |
05E3: GOTO 0B3 (RETURN) |
2906 |
jacho |
1002 |
.................... |
|
|
1003 |
.................... |
2912 |
kaklik |
1004 |
.................... |
|
|
1005 |
.................... |
|
|
1006 |
.................... |
2909 |
kaklik |
1007 |
.................... void main() |
|
|
1008 |
.................... { |
|
|
1009 |
* |
|
|
1010 |
0800: CLRF 04 |
|
|
1011 |
0801: BCF 03.7 |
|
|
1012 |
0802: MOVLW 1F |
|
|
1013 |
0803: ANDWF 03,F |
|
|
1014 |
0804: MOVLW 71 |
|
|
1015 |
0805: BSF 03.5 |
|
|
1016 |
0806: MOVWF 0F |
|
|
1017 |
0807: MOVF 0F,W |
2988 |
kaklik |
1018 |
0808: BCF 03.5 |
|
|
1019 |
0809: BCF 20.7 |
|
|
1020 |
080A: MOVF 20,W |
2909 |
kaklik |
1021 |
080B: BSF 03.5 |
2988 |
kaklik |
1022 |
080C: MOVWF 07 |
|
|
1023 |
080D: BCF 03.5 |
|
|
1024 |
080E: BSF 07.7 |
|
|
1025 |
080F: BSF 03.5 |
|
|
1026 |
0810: BSF 03.6 |
|
|
1027 |
0811: MOVF 09,W |
|
|
1028 |
0812: ANDLW C0 |
|
|
1029 |
0813: MOVWF 09 |
|
|
1030 |
0814: BCF 03.6 |
|
|
1031 |
0815: BCF 1F.4 |
|
|
1032 |
0816: BCF 1F.5 |
|
|
1033 |
0817: MOVLW 00 |
|
|
1034 |
0818: BSF 03.6 |
|
|
1035 |
0819: MOVWF 08 |
|
|
1036 |
081A: BCF 03.5 |
|
|
1037 |
081B: CLRF 07 |
|
|
1038 |
081C: CLRF 08 |
|
|
1039 |
081D: CLRF 09 |
2911 |
kaklik |
1040 |
* |
2988 |
kaklik |
1041 |
0821: CLRF 21 |
2912 |
kaklik |
1042 |
.................... unsigned int8 i=0, sht_config; |
2988 |
kaklik |
1043 |
.................... float temperature, humidity; |
2906 |
jacho |
1044 |
.................... |
2909 |
kaklik |
1045 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
2988 |
kaklik |
1046 |
0822: BSF 03.5 |
|
|
1047 |
0823: BSF 03.6 |
|
|
1048 |
0824: MOVF 09,W |
|
|
1049 |
0825: ANDLW C0 |
|
|
1050 |
0826: MOVWF 09 |
|
|
1051 |
0827: BCF 03.6 |
|
|
1052 |
0828: BCF 1F.4 |
|
|
1053 |
0829: BCF 1F.5 |
|
|
1054 |
082A: MOVLW 00 |
|
|
1055 |
082B: BSF 03.6 |
|
|
1056 |
082C: MOVWF 08 |
2909 |
kaklik |
1057 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
2988 |
kaklik |
1058 |
082D: BCF 03.5 |
|
|
1059 |
082E: BCF 03.6 |
|
|
1060 |
082F: BCF 1F.6 |
|
|
1061 |
0830: BCF 1F.7 |
|
|
1062 |
0831: BSF 03.5 |
|
|
1063 |
0832: BCF 1F.7 |
|
|
1064 |
0833: BCF 03.5 |
|
|
1065 |
0834: BSF 1F.0 |
2909 |
kaklik |
1066 |
.................... setup_spi(SPI_SS_DISABLED); |
2988 |
kaklik |
1067 |
0835: BCF 14.5 |
|
|
1068 |
0836: BCF 20.5 |
|
|
1069 |
0837: MOVF 20,W |
|
|
1070 |
0838: BSF 03.5 |
|
|
1071 |
0839: MOVWF 07 |
|
|
1072 |
083A: BCF 03.5 |
|
|
1073 |
083B: BSF 20.4 |
|
|
1074 |
083C: MOVF 20,W |
|
|
1075 |
083D: BSF 03.5 |
|
|
1076 |
083E: MOVWF 07 |
|
|
1077 |
083F: BCF 03.5 |
|
|
1078 |
0840: BCF 20.3 |
|
|
1079 |
0841: MOVF 20,W |
|
|
1080 |
0842: BSF 03.5 |
|
|
1081 |
0843: MOVWF 07 |
|
|
1082 |
0844: MOVLW 01 |
|
|
1083 |
0845: BCF 03.5 |
|
|
1084 |
0846: MOVWF 14 |
|
|
1085 |
0847: MOVLW 00 |
|
|
1086 |
0848: BSF 03.5 |
|
|
1087 |
0849: MOVWF 14 |
2909 |
kaklik |
1088 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
2988 |
kaklik |
1089 |
084A: MOVF 01,W |
|
|
1090 |
084B: ANDLW C7 |
|
|
1091 |
084C: IORLW 08 |
|
|
1092 |
084D: MOVWF 01 |
2909 |
kaklik |
1093 |
.................... setup_timer_1(T1_DISABLED); |
2988 |
kaklik |
1094 |
084E: BCF 03.5 |
|
|
1095 |
084F: CLRF 10 |
2909 |
kaklik |
1096 |
.................... setup_timer_2(T2_DISABLED,0,1); |
2988 |
kaklik |
1097 |
0850: MOVLW 00 |
|
|
1098 |
0851: MOVWF 78 |
|
|
1099 |
0852: MOVWF 12 |
|
|
1100 |
0853: MOVLW 00 |
|
|
1101 |
0854: BSF 03.5 |
|
|
1102 |
0855: MOVWF 12 |
2909 |
kaklik |
1103 |
.................... setup_ccp1(CCP_OFF); |
2988 |
kaklik |
1104 |
0856: BCF 03.5 |
|
|
1105 |
0857: BSF 20.2 |
|
|
1106 |
0858: MOVF 20,W |
2911 |
kaklik |
1107 |
0859: BSF 03.5 |
2988 |
kaklik |
1108 |
085A: MOVWF 07 |
|
|
1109 |
085B: BCF 03.5 |
|
|
1110 |
085C: CLRF 17 |
|
|
1111 |
085D: BSF 03.5 |
|
|
1112 |
085E: CLRF 1B |
|
|
1113 |
085F: CLRF 1C |
|
|
1114 |
0860: MOVLW 01 |
|
|
1115 |
0861: MOVWF 1D |
2909 |
kaklik |
1116 |
.................... setup_comparator(NC_NC_NC_NC); |
2988 |
kaklik |
1117 |
0862: BCF 03.5 |
|
|
1118 |
0863: BSF 03.6 |
|
|
1119 |
0864: CLRF 07 |
|
|
1120 |
0865: CLRF 08 |
|
|
1121 |
0866: CLRF 09 |
2909 |
kaklik |
1122 |
.................... |
2911 |
kaklik |
1123 |
.................... SHT25_soft_reset(); |
2988 |
kaklik |
1124 |
0867: BCF 0A.3 |
|
|
1125 |
0868: BCF 03.6 |
|
|
1126 |
0869: GOTO 076 |
|
|
1127 |
086A: BSF 0A.3 |
2909 |
kaklik |
1128 |
.................... printf("SHT25 humidity and temperature sensor example \r\n",); |
2988 |
kaklik |
1129 |
086B: MOVLW 04 |
|
|
1130 |
086C: BSF 03.6 |
|
|
1131 |
086D: MOVWF 0D |
|
|
1132 |
086E: MOVLW 00 |
|
|
1133 |
086F: MOVWF 0F |
|
|
1134 |
0870: BCF 0A.3 |
|
|
1135 |
0871: BCF 03.6 |
|
|
1136 |
0872: GOTO 0D2 |
|
|
1137 |
0873: BSF 0A.3 |
|
|
1138 |
.................... printf("Temperature Humidity[%%] \r\n"); |
|
|
1139 |
0874: MOVLW 1D |
|
|
1140 |
0875: BSF 03.6 |
|
|
1141 |
0876: MOVWF 0D |
|
|
1142 |
0877: MOVLW 00 |
|
|
1143 |
0878: MOVWF 0F |
|
|
1144 |
0879: BCF 03.0 |
|
|
1145 |
087A: MOVLW 16 |
|
|
1146 |
087B: BCF 03.6 |
|
|
1147 |
087C: MOVWF 2B |
|
|
1148 |
087D: BCF 0A.3 |
|
|
1149 |
087E: CALL 11A |
|
|
1150 |
087F: BSF 0A.3 |
|
|
1151 |
0880: MOVLW 25 |
|
|
1152 |
0881: MOVWF 39 |
|
|
1153 |
0882: BCF 0A.3 |
|
|
1154 |
0883: CALL 0AE |
|
|
1155 |
0884: BSF 0A.3 |
|
|
1156 |
0885: MOVLW 29 |
|
|
1157 |
0886: BSF 03.6 |
|
|
1158 |
0887: MOVWF 0D |
|
|
1159 |
0888: MOVLW 00 |
|
|
1160 |
0889: MOVWF 0F |
|
|
1161 |
088A: BCF 03.0 |
|
|
1162 |
088B: MOVLW 05 |
|
|
1163 |
088C: BCF 03.6 |
|
|
1164 |
088D: MOVWF 2B |
|
|
1165 |
088E: BCF 0A.3 |
|
|
1166 |
088F: CALL 11A |
|
|
1167 |
0890: BSF 0A.3 |
2909 |
kaklik |
1168 |
.................... delay_ms (500); |
2988 |
kaklik |
1169 |
0891: MOVLW 02 |
|
|
1170 |
0892: MOVWF 2B |
|
|
1171 |
0893: MOVLW FA |
|
|
1172 |
0894: MOVWF 30 |
|
|
1173 |
0895: BCF 0A.3 |
|
|
1174 |
0896: CALL 169 |
|
|
1175 |
0897: BSF 0A.3 |
|
|
1176 |
0898: DECFSZ 2B,F |
|
|
1177 |
0899: GOTO 093 |
2909 |
kaklik |
1178 |
.................... |
2988 |
kaklik |
1179 |
.................... |
2909 |
kaklik |
1180 |
.................... while(TRUE) |
|
|
1181 |
.................... { |
2988 |
kaklik |
1182 |
.................... if (i<100) sht_config = SHT25_RH12_T14 | SHT25_HEATER_OFF; // loop alters on chip heater on and off to check correct function |
|
|
1183 |
089A: MOVF 21,W |
|
|
1184 |
089B: SUBLW 63 |
|
|
1185 |
089C: BTFSS 03.0 |
|
|
1186 |
089D: GOTO 0A0 |
|
|
1187 |
089E: CLRF 22 |
|
|
1188 |
.................... else |
|
|
1189 |
089F: GOTO 0A6 |
|
|
1190 |
.................... { |
2912 |
kaklik |
1191 |
.................... sht_config = SHT25_RH12_T14 | SHT25_HEATER_ON; |
2988 |
kaklik |
1192 |
08A0: MOVLW 04 |
|
|
1193 |
08A1: MOVWF 22 |
|
|
1194 |
.................... if (i > 120) i = 0; |
|
|
1195 |
08A2: MOVF 21,W |
|
|
1196 |
08A3: SUBLW 78 |
|
|
1197 |
08A4: BTFSS 03.0 |
|
|
1198 |
08A5: CLRF 21 |
|
|
1199 |
.................... } |
|
|
1200 |
.................... |
|
|
1201 |
.................... temperature = SHT25_get_temp(); |
|
|
1202 |
08A6: BCF 0A.3 |
|
|
1203 |
08A7: GOTO 45F |
|
|
1204 |
08A8: BSF 0A.3 |
|
|
1205 |
08A9: MOVF 7A,W |
|
|
1206 |
08AA: MOVWF 26 |
|
|
1207 |
08AB: MOVF 79,W |
|
|
1208 |
08AC: MOVWF 25 |
|
|
1209 |
08AD: MOVF 78,W |
|
|
1210 |
08AE: MOVWF 24 |
|
|
1211 |
08AF: MOVF 77,W |
|
|
1212 |
08B0: MOVWF 23 |
|
|
1213 |
.................... humidity = SHT25_get_hum(); |
|
|
1214 |
08B1: BCF 0A.3 |
|
|
1215 |
08B2: GOTO 52E |
|
|
1216 |
08B3: BSF 0A.3 |
|
|
1217 |
08B4: MOVF 7A,W |
|
|
1218 |
08B5: MOVWF 2A |
|
|
1219 |
08B6: MOVF 79,W |
|
|
1220 |
08B7: MOVWF 29 |
|
|
1221 |
08B8: MOVF 78,W |
|
|
1222 |
08B9: MOVWF 28 |
|
|
1223 |
08BA: MOVF 77,W |
|
|
1224 |
08BB: MOVWF 27 |
|
|
1225 |
.................... |
|
|
1226 |
.................... printf("%f %f %X %X \r\n",temperature, humidity, SHT25_setup(sht_config),sht_config); |
|
|
1227 |
08BC: MOVF 22,W |
|
|
1228 |
08BD: MOVWF 2B |
2912 |
kaklik |
1229 |
08BE: BCF 0A.3 |
2988 |
kaklik |
1230 |
08BF: GOTO 5E4 |
2912 |
kaklik |
1231 |
08C0: BSF 0A.3 |
2988 |
kaklik |
1232 |
08C1: MOVF 78,W |
|
|
1233 |
08C2: MOVWF 2B |
|
|
1234 |
08C3: MOVLW 89 |
|
|
1235 |
08C4: MOVWF 04 |
|
|
1236 |
08C5: MOVF 26,W |
|
|
1237 |
08C6: MOVWF 2F |
|
|
1238 |
08C7: MOVF 25,W |
|
|
1239 |
08C8: MOVWF 2E |
|
|
1240 |
08C9: MOVF 24,W |
|
|
1241 |
08CA: MOVWF 2D |
|
|
1242 |
08CB: MOVF 23,W |
|
|
1243 |
08CC: MOVWF 2C |
|
|
1244 |
08CD: MOVLW 02 |
|
|
1245 |
08CE: MOVWF 30 |
|
|
1246 |
08CF: BCF 0A.3 |
|
|
1247 |
08D0: CALL 6EE |
|
|
1248 |
08D1: BSF 0A.3 |
|
|
1249 |
08D2: MOVLW 20 |
|
|
1250 |
08D3: MOVWF 39 |
|
|
1251 |
08D4: BCF 0A.3 |
|
|
1252 |
08D5: CALL 0AE |
|
|
1253 |
08D6: BSF 0A.3 |
|
|
1254 |
08D7: MOVLW 89 |
|
|
1255 |
08D8: MOVWF 04 |
|
|
1256 |
08D9: MOVF 2A,W |
|
|
1257 |
08DA: MOVWF 2F |
|
|
1258 |
08DB: MOVF 29,W |
|
|
1259 |
08DC: MOVWF 2E |
|
|
1260 |
08DD: MOVF 28,W |
|
|
1261 |
08DE: MOVWF 2D |
|
|
1262 |
08DF: MOVF 27,W |
|
|
1263 |
08E0: MOVWF 2C |
|
|
1264 |
08E1: MOVLW 02 |
|
|
1265 |
08E2: MOVWF 30 |
|
|
1266 |
08E3: BCF 0A.3 |
|
|
1267 |
08E4: CALL 6EE |
|
|
1268 |
08E5: BSF 0A.3 |
|
|
1269 |
08E6: MOVLW 20 |
|
|
1270 |
08E7: MOVWF 39 |
|
|
1271 |
08E8: BCF 0A.3 |
|
|
1272 |
08E9: CALL 0AE |
|
|
1273 |
08EA: BSF 0A.3 |
|
|
1274 |
08EB: MOVF 2B,W |
|
|
1275 |
08EC: MOVWF 2C |
|
|
1276 |
08ED: MOVLW 37 |
|
|
1277 |
08EE: MOVWF 2D |
|
|
1278 |
08EF: BCF 0A.3 |
|
|
1279 |
08F0: CALL 7D5 |
|
|
1280 |
08F1: BSF 0A.3 |
|
|
1281 |
08F2: MOVLW 20 |
|
|
1282 |
08F3: MOVWF 39 |
|
|
1283 |
08F4: BCF 0A.3 |
|
|
1284 |
08F5: CALL 0AE |
|
|
1285 |
08F6: BSF 0A.3 |
|
|
1286 |
08F7: MOVF 22,W |
|
|
1287 |
08F8: MOVWF 2C |
|
|
1288 |
08F9: MOVLW 37 |
|
|
1289 |
08FA: MOVWF 2D |
|
|
1290 |
08FB: BCF 0A.3 |
|
|
1291 |
08FC: CALL 7D5 |
|
|
1292 |
08FD: BSF 0A.3 |
|
|
1293 |
08FE: MOVLW 20 |
|
|
1294 |
08FF: MOVWF 39 |
|
|
1295 |
0900: BCF 0A.3 |
|
|
1296 |
0901: CALL 0AE |
|
|
1297 |
0902: BSF 0A.3 |
|
|
1298 |
0903: MOVLW 0D |
|
|
1299 |
0904: MOVWF 39 |
|
|
1300 |
0905: BCF 0A.3 |
|
|
1301 |
0906: CALL 0AE |
|
|
1302 |
0907: BSF 0A.3 |
|
|
1303 |
0908: MOVLW 0A |
|
|
1304 |
0909: MOVWF 39 |
|
|
1305 |
090A: BCF 0A.3 |
|
|
1306 |
090B: CALL 0AE |
|
|
1307 |
090C: BSF 0A.3 |
|
|
1308 |
.................... i++; |
|
|
1309 |
090D: INCF 21,F |
|
|
1310 |
.................... delay_ms(1000); |
|
|
1311 |
090E: MOVLW 04 |
|
|
1312 |
090F: MOVWF 2B |
|
|
1313 |
0910: MOVLW FA |
|
|
1314 |
0911: MOVWF 30 |
|
|
1315 |
0912: BCF 0A.3 |
|
|
1316 |
0913: CALL 169 |
|
|
1317 |
0914: BSF 0A.3 |
|
|
1318 |
0915: DECFSZ 2B,F |
|
|
1319 |
0916: GOTO 110 |
2909 |
kaklik |
1320 |
.................... } |
2988 |
kaklik |
1321 |
0917: GOTO 09A |
2906 |
jacho |
1322 |
.................... } |
|
|
1323 |
.................... |
2988 |
kaklik |
1324 |
0918: SLEEP |
2906 |
jacho |
1325 |
|
|
|
1326 |
Configuration Fuses: |
2909 |
kaklik |
1327 |
Word 1: 2CF4 INTRC_IO NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
2906 |
jacho |
1328 |
Word 2: 3FFF NOWRT BORV40 |