Mercurial > public > hwos_code
comparison src/calibrate.asm @ 656:8af5aefbcdaf default tip
Update to 3.31 beta
| author | heinrichsweikamp |
|---|---|
| date | Thu, 27 Nov 2025 18:32:58 +0100 |
| parents | 75e90cd0c2c3 |
| children |
comparison
equal
deleted
inserted
replaced
| 655:c7b7b8a358cd | 656:8af5aefbcdaf |
|---|---|
| 17 ;============================================================================= | 17 ;============================================================================= |
| 18 calibrate1 CODE | 18 calibrate1 CODE |
| 19 ;============================================================================= | 19 ;============================================================================= |
| 20 | 20 |
| 21 | 21 |
| 22 IFDEF _external_sensor | 22 IFDEF _external_sensor_eccr |
| 23 | 23 |
| 24 ;----------------------------------------------------------------------------- | 24 ;----------------------------------------------------------------------------- |
| 25 ; Transmit current Setpoint from WREG (in cbar) to external Electronics | 25 ; Transmit current Setpoint from WREG (in cbar) to external Electronics |
| 26 ; | 26 ; |
| 27 global transmit_setpoint | 27 global transmit_setpoint |
| 28 transmit_setpoint: | 28 transmit_setpoint: |
| 29 return ; !!!! FUNCTION IS CURRENTLY DISABLED !!!! | 29 btfsc ext_s8_full_digital ; are we in external S8 full digital mode? |
| 30 | 30 bra transmit_setpoint2 ; Yes, alsway TX Setpoint |
| 31 ; btfsc ext_input_optical ; optical input in use? | 31 btfsc ext_input_optical ; optical input in use? |
| 32 ; return ; YES - setpoint - TX not supported | 32 return ; YES - setpoint - TX not supported |
| 33 ; TSTOSS opt_s8_mode ; NO - S8 mode selected? | 33 TSTOSS opt_s8_mode ; NO - S8 mode selected? |
| 34 ; return ; NO | 34 return ; NO |
| 35 ; clrf lo ; YES - initialize checksum | 35 transmit_setpoint2: |
| 36 ; movff char_I_const_ppO2,hi ; - copy setpoint value to hi | 36 clrf lo ; YES - initialize checksum |
| 37 ; movlw 0xAA ; - load start byte | 37 movff char_I_const_ppO2,hi ; - copy setpoint value to hi |
| 38 ; rcall tx_to_HUD_chksum ; - transmit to HUD | 38 movlw 0xAA ; - load start byte |
| 39 ; movlw 0x60 ; - load command 'new SP' | 39 rcall tx_to_HUD_chksum ; - transmit to HUD |
| 40 ; rcall tx_to_HUD_chksum ; - transmit to HUD | 40 movlw 0x70 ; - load command 'new SP' |
| 41 ; movf hi,W ; - load SP in cbar | 41 rcall tx_to_HUD_chksum ; - transmit to HUD |
| 42 ; rcall tx_to_HUD_chksum ; - transmit to HUD | 42 movf hi,W ; - load SP in cbar |
| 43 ; movf lo,W ; - load checksum | 43 rcall tx_to_HUD_chksum ; - transmit to HUD |
| 44 ; rcall tx_to_HUD ; - transmit checksum | 44 movf lo,W ; - load checksum |
| 45 ; return ; - done | 45 rcall tx_to_HUD ; - transmit checksum |
| 46 return ; - done | |
| 46 | 47 |
| 47 | 48 |
| 48 ;----------------------------------------------------------------------------- | 49 ;----------------------------------------------------------------------------- |
| 49 ; Helper Function - Transmit Byte to external Electronics | 50 ; Helper Function - Transmit Byte to external Electronics |
| 50 ; | 51 ; |
| 70 ; ISR-safe 2 byte copy of the current pressure to xB for later use | 71 ; ISR-safe 2 byte copy of the current pressure to xB for later use |
| 71 SMOVII pressure_abs,xB | 72 SMOVII pressure_abs,xB |
| 72 | 73 |
| 73 ; check for HUD | 74 ; check for HUD |
| 74 btfsc ext_input_optical ; optical interface in use? | 75 btfsc ext_input_optical ; optical interface in use? |
| 76 bra calibrate_mix1 ; YES - skip | |
| 77 btfsc ext_s8_full_digital ; are we in external S8 full digital mode? | |
| 75 bra calibrate_mix1 ; YES - skip | 78 bra calibrate_mix1 ; YES - skip |
| 76 TSTOSS opt_s8_mode ; NO - S8 interface in use? | 79 TSTOSS opt_s8_mode ; NO - S8 interface in use? |
| 77 bra calibrate_mix1 ; NO - skip HUD part | 80 bra calibrate_mix1 ; NO - skip HUD part |
| 78 ;bra calibrate_mix0 ; YES - calibrate S8 HUD | 81 ;bra calibrate_mix0 ; YES - calibrate S8 HUD |
| 79 | 82 |
| 191 btfss neg_flag ; sensor mV higher than maximum boundary? | 194 btfss neg_flag ; sensor mV higher than maximum boundary? |
| 192 retlw .1 ; YES - return signaling boundary violation | 195 retlw .1 ; YES - return signaling boundary violation |
| 193 | 196 |
| 194 retlw .0 ; return signaling min/max ok | 197 retlw .0 ; return signaling min/max ok |
| 195 | 198 |
| 196 ENDIF ; _external_sensor | 199 ENDIF ; _external_sensor_eccr |
| 197 | 200 |
| 198 ;============================================================================= | 201 ;============================================================================= |
| 199 calibrate2 CODE | 202 calibrate2 CODE |
| 200 ;============================================================================= | 203 ;============================================================================= |
| 201 | 204 |
| 202 IFDEF _external_sensor | 205 IFDEF _external_sensor_eccr |
| 203 | 206 |
| 204 ;----------------------------------------------------------------------------- | 207 ;----------------------------------------------------------------------------- |
| 205 ; Compute Sensor mV from Raw Values received via S8 digital Interface | 208 ; Compute Sensor mV from Raw Values received via S8 digital Interface |
| 206 ; | 209 ; |
| 207 global compute_mvolts_from_rawdata | 210 global compute_mvolts_from_rawdata |
| 232 call div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder | 235 call div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder |
| 233 MOVII xC,sensor3_mv ; store result | 236 MOVII xC,sensor3_mv ; store result |
| 234 | 237 |
| 235 return ; done | 238 return ; done |
| 236 | 239 |
| 237 ENDIF ; _external_sensor | 240 ENDIF ; _external_sensor_eccr |
| 238 | 241 |
| 239 ;----------------------------------------------------------------------------- | 242 ;----------------------------------------------------------------------------- |
| 240 | 243 |
| 241 END | 244 END |
