comparison src/ms5541.asm @ 647:357341239438

Merge
author heinrichs weikamp
date Thu, 14 Oct 2021 12:04:12 +0200
parents 7d8a4c60ec1a 5b7fe7777425
children ef2ed7e3a895
comparison
equal deleted inserted replaced
644:1e695355dfc4 647:357341239438
279 movwf isr_xB+0 279 movwf isr_xB+0
280 clrf isr_xB+1 280 clrf isr_xB+1
281 call isr_div32x16 ; isr_xC:4 = isr_xC:4 / isr_xB:2 with isr_xA as remainder 281 call isr_div32x16 ; isr_xC:4 = isr_xC:4 / isr_xB:2 with isr_xA as remainder
282 ; isr_xC:2 equals pressure in 1mbar 282 ; isr_xC:2 equals pressure in 1mbar
283 283
284 ; subtract 20mbar from the final result
285 movlw .20
286 subwf isr_xC+0,F
287 movlw .0
288 subwfb isr_xC+1,F
289
290 ; copy for compatibility of the next routines 284 ; copy for compatibility of the next routines
291 movff isr_xC+1,isr_xC+2 285 movff isr_xC+1,isr_xC+2
292 movff isr_xC+0,isr_xC+1 286 movff isr_xC+0,isr_xC+1
293 287
294 press_comp_done_common: ; continue here even with MS5837 288 press_comp_done_common: ; continue here even with MS5837
611 bsf block_sensor_interrupt ; disable sensor interrupts 605 bsf block_sensor_interrupt ; disable sensor interrupts
612 606
613 btfsc press_sensor_type ; New sensor found? 607 btfsc press_sensor_type ; New sensor found?
614 call I2C_get_calib_MS5837 ; Yes, read C1 to C6 608 call I2C_get_calib_MS5837 ; Yes, read C1 to C6
615 banksel isr_backup ; select bank ISR data 609 banksel isr_backup ; select bank ISR data
616 610 ; double-check sensor type
611 movlw 0xED
612 cpfseq C1+0
613 bra get_calibration_data1 ; Not 0xED (I2C address false reading)
614 movlw 0xED
615 cpfseq C1+1
616 bra get_calibration_data1 ; Not 0xED (I2C address false reading)
617 movlw 0xED
618 cpfseq C5+0
619 bra get_calibration_data1 ; Not 0xED (I2C address false reading)
620 movlw 0xED
621 cpfseq C5+1
622 bra get_calibration_data1 ; Not 0xED (I2C address false reading)
623
624 ; C1 and C5 are 0xEDED -> NOT Sensor 1
625 bcf press_sensor_type
626
627 get_calibration_data1:
617 btfsc press_sensor_type ; New sensor found? 628 btfsc press_sensor_type ; New sensor found?
618 bra get_calibration_data2 ; Yes, skip to the end 629 bra get_calibration_data2 ; Yes, skip to the end
619 630
620 rcall reset_MS5541 ; reset chip 631 rcall reset_MS5541 ; reset chip
621 632