Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/ms5535.asm @ 169:e26f49674956
Merge decoplan display for both GF and Buhlmann models.
+ Add CF(54) to reverse deco plan display order.
+ Clean state machine to faster redisplay in divemode.
Fix don't flip screen for soft emulation.
author | JeanDo |
---|---|
date | Wed, 26 Jan 2011 19:19:02 +0100 |
parents | 8d6aca08f66b |
children | 6d8a2550c9ea |
comparison
equal
deleted
inserted
replaced
168:494587193f5d | 169:e26f49674956 |
---|---|
16 | 16 |
17 | 17 |
18 ; routines for Intersema MS5535A, MS5541B and MS5541C | 18 ; routines for Intersema MS5535A, MS5541B and MS5541C |
19 ; history: | 19 ; history: |
20 ; 2005-09-26: Written by Matthias Heinrichs, info@heinrichsweikamp.com | 20 ; 2005-09-26: Written by Matthias Heinrichs, info@heinrichsweikamp.com |
21 ; 2008-08-21: MH last updated | 21 ; 2008-08-21: MH last updated, with second order compensation. |
22 ; 2011-01-19: jDG Clean up using true signed arithmetics. | 22 ; 2011-01-19: jDG Clean up using true signed arithmetics. |
23 ; known bugs: | 23 ; known bugs: |
24 ; ToDo: | 24 ; ToDo: |
25 | 25 |
26 ; with second order temperature compensation | 26 ;============================================================================= |
27 | 27 ; Expose internal variables, to ease debug: |
28 global D1, D2 | |
29 global C1, C2, C3, C4, C5 | |
30 global xdT, xdT2, OFF, SENS, amb_pressure | |
31 | |
32 ;============================================================================= | |
28 calculate_compensation: | 33 calculate_compensation: |
29 ; calculate UT1 = 8*C5 + 10000 (u16 range 10.000 .. +42.760) | 34 ; calculate UT1 = 8*C5 + 10000 (u16 range 10.000 .. +42.760) |
30 clrf isr_xA+1 | 35 clrf isr_xA+1 |
31 movlw d'8' | 36 movlw d'8' |
32 movwf isr_xA+0 | 37 movwf isr_xA+0 |
191 incf temperature+1 | 196 incf temperature+1 |
192 | 197 |
193 calc_pos_temp: | 198 calc_pos_temp: |
194 return ; Fertig mit allem | 199 return ; Fertig mit allem |
195 | 200 |
201 ;============================================================================= | |
196 get_pressure_start: | 202 get_pressure_start: |
197 rcall reset_MS5535A | 203 rcall reset_MS5535A |
198 movlw b'10100000' ;+3*high as start and 1+low as stop! | 204 movlw b'10100000' ;+3*high as start and 1+low as stop! |
199 get_pressure_start2: | 205 get_pressure_start2: |
200 movwf isr1_temp | 206 movwf isr1_temp |
210 movff dMSB,D1+1 | 216 movff dMSB,D1+1 |
211 movff dLSB,D1+0 | 217 movff dLSB,D1+0 |
212 #endif | 218 #endif |
213 return | 219 return |
214 | 220 |
221 ;============================================================================= | |
215 get_temperature_start: | 222 get_temperature_start: |
216 rcall reset_MS5535A | 223 rcall reset_MS5535A |
217 movlw b'10010000' ;+3*high as start and 1+low as stop! | 224 movlw b'10010000' ;+3*high as start and 1+low as stop! |
218 bra get_pressure_start2 ; continue in "get_pressure" | 225 bra get_pressure_start2 ; continue in "get_pressure" |
219 | 226 |
224 movff dMSB,D2+1 | 231 movff dMSB,D2+1 |
225 movff dLSB,D2+0 | 232 movff dLSB,D2+0 |
226 #endif | 233 #endif |
227 return | 234 return |
228 | 235 |
236 ;============================================================================= | |
229 get_calibration_data: | 237 get_calibration_data: |
230 ; ; read addional temperature correction from internal EEPROM 0x100 | |
231 ; bsf no_sensor_int ; No sensor interupt! | |
232 ; clrf temperature_correction ; clear compensation value | |
233 ; movlw LOW 0x100 | |
234 ; movwf EEADR | |
235 ; movlw HIGH 0x100 | |
236 ; movwf EEADRH | |
237 ; call read_eeprom | |
238 ; clrf EEADRH ; Only 256Bytes used in normal program | |
239 ; movlw d'200' ; limit value | |
240 ; cpfsgt EEDATA ; EEDATA>200? | |
241 ; movff EEDATA, temperature_correction ; No, Store for compensation | |
242 ; | |
243 rcall reset_MS5535A | 238 rcall reset_MS5535A |
244 movlw d'13' | 239 movlw d'13' |
245 movwf clock_count | 240 movwf clock_count |
246 movlw b'01010100' ;+3*high as start and 1+low as stop! | 241 movlw b'01010100' ;+3*high as start and 1+low as stop! |
247 movwf isr1_temp | 242 movwf isr1_temp |
396 bcf C6+0,7 | 391 bcf C6+0,7 |
397 | 392 |
398 bcf no_sensor_int ; enable sensor interrupts | 393 bcf no_sensor_int ; enable sensor interrupts |
399 return | 394 return |
400 | 395 |
396 ;============================================================================= | |
401 reset_MS5535A_one: | 397 reset_MS5535A_one: |
402 bsf sensor_SDO | 398 bsf sensor_SDO |
403 nop | 399 nop |
404 bsf sensor_CLK | 400 bsf sensor_CLK |
405 nop | 401 nop |
483 bsf STATUS,C | 479 bsf STATUS,C |
484 rlcf isr1_temp,F | 480 rlcf isr1_temp,F |
485 decfsz clock_count,F | 481 decfsz clock_count,F |
486 bra recieve_loop | 482 bra recieve_loop |
487 return | 483 return |
488 | |
489 | 484 |
490 send_data_MS55535A: | 485 send_data_MS55535A: |
491 ; send three startbits first | 486 ; send three startbits first |
492 bcf sensor_CLK | 487 bcf sensor_CLK |
493 bsf sensor_SDO | 488 bsf sensor_SDO |