Mercurial > public > hwos_code
comparison src/ms5541.asm @ 368:57e349960ef4
Additional temperature calibration via PC interface
author | heinrichsweikamp |
---|---|
date | Sun, 16 Aug 2015 15:16:23 +0200 |
parents | 573f2251cf49 |
children | ca4556fb60b9 |
comparison
equal
deleted
inserted
replaced
367:20e2c68e9a04 | 368:57e349960ef4 |
---|---|
62 subwfb xdT+1,W | 62 subwfb xdT+1,W |
63 movwf xdT2+1 | 63 movwf xdT2+1 |
64 | 64 |
65 ; Calculate OFF = C2 + ((C4-250)*dT2)/2^12 + 10000 | 65 ; Calculate OFF = C2 + ((C4-250)*dT2)/2^12 + 10000 |
66 ; (range +9.246 .. +18.887) | 66 ; (range +9.246 .. +18.887) |
67 movff C4+0,isr_xA+0 | 67 movff C4+0,isr_xA+0 ; C4 - 250 --> A |
68 movff C4+1,isr_xA+1 | 68 movff C4+1,isr_xA+1 |
69 ; movlw LOW(-.250) ; C4 - 250 --> A | |
70 ; addwf C4+0,W | |
71 ; movwf isr_xA+0 | |
72 ; movlw -1 ; HIGH(- .250) is not understood... | |
73 ; addwfc C4+1,W | |
74 ; movwf isr_xA+1 | |
75 | |
76 movff xdT2+0,isr_xB+0 ; dT2 --> B | 69 movff xdT2+0,isr_xB+0 ; dT2 --> B |
77 movff xdT2+1,isr_xB+1 | 70 movff xdT2+1,isr_xB+1 |
78 call isr_signed_mult16x16 | 71 call isr_signed_mult16x16 |
72 | |
79 movlw .12-.8 ; A 12bit shift = 1 byte + 4 bits. | 73 movlw .12-.8 ; A 12bit shift = 1 byte + 4 bits. |
80 call isr_shift_C31 | 74 call isr_shift_C31 |
81 | 75 |
82 movlw LOW(.10000) ; Add 10000 | 76 movlw LOW(.10000) ; Add 10000 |
83 addwf isr_xC+1,F | 77 addwf isr_xC+1,F |
145 bra pressure_extra_add ; No | 139 bra pressure_extra_add ; No |
146 ; Yes | 140 ; Yes |
147 comf isr_xC+0,F | 141 comf isr_xC+0,F |
148 incf isr_xC+0,F | 142 incf isr_xC+0,F |
149 ; Check for max. of 20mbar | 143 ; Check for max. of 20mbar |
150 movlw .21 | 144 movlw .22 |
151 cpfslt isr_xC+0 | 145 cpfslt isr_xC+0 |
152 clrf isr_xC+0 | 146 clrf isr_xC+0 |
153 ; Subtract | 147 ; Subtract |
154 movf isr_xC+0,W | 148 movf isr_xC+0,W |
155 subwf isr_xC+1,F | 149 subwf isr_xC+1,F |
210 | 204 |
211 movlw LOW(.200) ; Add 200 | 205 movlw LOW(.200) ; Add 200 |
212 addwf isr_xC+1,F | 206 addwf isr_xC+1,F |
213 movlw HIGH(.200) | 207 movlw HIGH(.200) |
214 addwfc isr_xC+2,F | 208 addwfc isr_xC+2,F |
209 | |
210 ; Add opt_temperature_adjust to result (SIGNED!) | |
211 movff opt_temperature_adjust,isr_xC+0 | |
212 | |
213 btfss isr_xC+0,7 ; <0? | |
214 bra temperature_extra_add ; No | |
215 ; Yes | |
216 comf isr_xC+0,F | |
217 incf isr_xC+0,F | |
218 ; Check for max. of 2.0°C | |
219 movlw .22 | |
220 cpfslt isr_xC+0 | |
221 clrf isr_xC+0 | |
222 ; Subtract | |
223 movf isr_xC+0,W | |
224 subwf isr_xC+1,F | |
225 movlw .0 | |
226 subwfb isr_xC+2,F | |
227 bra temperature_extra_common | |
228 | |
229 temperature_extra_add: | |
230 ; Check for max. of 2.0°C | |
231 movlw .21 | |
232 cpfslt isr_xC+0 | |
233 clrf isr_xC+0 | |
234 ; Add | |
235 movf isr_xC+0,W | |
236 addwf isr_xC+1,F | |
237 movlw .0 | |
238 addwfc isr_xC+2,F | |
239 temperature_extra_common: | |
215 | 240 |
216 movf isr_xC+1,W | 241 movf isr_xC+1,W |
217 addwf temperature_avg+0,F | 242 addwf temperature_avg+0,F |
218 movf isr_xC+2,W | 243 movf isr_xC+2,W |
219 addwfc temperature_avg+1,F | 244 addwfc temperature_avg+1,F |