comparison src/ms5541.asm @ 631:185ba2f91f59

3.09 beta 1 release
author heinrichsweikamp
date Fri, 28 Feb 2020 15:45:07 +0100
parents 4cd81bdbf15c
children 4050675965ea
comparison
equal deleted inserted replaced
630:4cd81bdbf15c 631:185ba2f91f59
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File ms5541.asm combined next generation V3.0.3b 3 ; File ms5541.asm combined next generation V3.8.6
4 ; 4 ;
5 ; Sensor subroutines 5 ; Sensor subroutines
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
114 movf isr_xC+1,W ; and sum into SENS 114 movf isr_xC+1,W ; and sum into SENS
115 addwf SENS+0,F 115 addwf SENS+0,F
116 movf isr_xC+2,W 116 movf isr_xC+2,W
117 addwfc SENS+1,F 117 addwfc SENS+1,F
118 118
119 ; calculate absolute pressure = (sens * (d1-off))/2^12 + 1000 (For MS5541C) 119 ; calculate absolute pressure = (sens * (d1-off))/2^12 + 1000 (for MS5541C)
120 ; calculate absolute pressure = (sens * (d1-off))/2^11 + 1000 (For MS5541C-30) 120 ; calculate absolute pressure = (sens * (d1-off))/2^11 + 1000 (for MS5541C-30)
121 movf OFF+0,W ; d1-off --> a 121 movf OFF+0,W ; d1-off --> a
122 subwf D1+0,W 122 subwf D1+0,W
123 movwf isr_xA+0 123 movwf isr_xA+0
124 movf OFF+1,W 124 movf OFF+1,W
125 subwfb D1+1,W 125 subwfb D1+1,W
126 movwf isr_xA+1 126 movwf isr_xA+1
127 127
128 MOVII SENS,isr_xB ; sens --> b 128 MOVII SENS,isr_xB ; sens --> b
129 call isr_signed_mult16x16 129 call isr_signed_mult16x16
130 movlw .13 130 movlw .13
131 cpfslt C1+1 ; C1 > 3328 (Must be MS5541-30) 131 cpfslt C1+1 ; C1 > 3328 ?
132 bra isr_shift_ms5541_30 132 bra isr_shift_ms5541_30 ; YES - MS5541-30
133 ; MS5541 133 movlw .12-.8 ; NO - MS5541: 12 bit shift = 1 byte + 4 bits
134 movlw .12-.8 ; a 12 bit shift = 1 byte + 4 bits 134 bra isr_shift_ms5541_common
135 isr_shift_ms5541_30:
136 movlw .11-.8 ; MS5541-30: 11 bit shift = 1 byte + 3 bits
137 isr_shift_ms5541_common:
135 call isr_shift_C31 138 call isr_shift_C31
136 bra isr_shift_ms5541_all
137 isr_shift_ms5541_30:
138 ; MS5541-30
139 movlw .11-.8 ; a 11 bit shift = 1 byte + 3 bits
140 call isr_shift_C31
141 isr_shift_ms5541_all:
142 movlw LOW .1000 ; add 1000 139 movlw LOW .1000 ; add 1000
143 addwf isr_xC+1,F 140 addwf isr_xC+1,F
144 movlw HIGH .1000 141 movlw HIGH .1000
145 addwfc isr_xC+2,F 142 addwfc isr_xC+2,F
146 143