comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 595:16f4eafc197e

CNS for pSCR-GF fixed.
author heinrichsweikamp
date Thu, 21 Jun 2012 07:16:11 +0200
parents 46e9ccd0eca7
children f3735da18809
comparison
equal deleted inserted replaced
594:6520bcda1a00 595:16f4eafc197e
273 ; Routines used in the "other second" 273 ; Routines used in the "other second"
274 call calc_average_depth ; calculate average depth 274 call calc_average_depth ; calculate average depth
275 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) 275 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds)
276 276
277 ; Calculate CNS 277 ; Calculate CNS
278 rcall set_actual_ppo2 ; Set char_I_actual_ppO2
279 clrf WREG 278 clrf WREG
280 movff WREG,char_I_step_is_1min ; Make sure to be in 2sec mode. 279 movff WREG,char_I_step_is_1min ; Make sure to be in 2sec mode.
281 280
282 read_int_eeprom d'34' ; Read deco data 281 read_int_eeprom d'34' ; Read deco data
283 movlw .6 282 movlw .6
284 cpfseq EEDATA 283 cpfseq EEDATA ; in pscr-mode?
285 bra calc_deko_divemode1a 284 rcall set_actual_ppo2 ; No, set char_I_actual_ppO2
286 ; in PSCR mode
287 call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2
288 ; tstfsz sub_c+1 ; Is ppO2 > 2.55bar ? mH
289 ; setf sub_c+0 ; yes: bound to 2.55... better than wrap around.
290 movff sub_c+0,char_I_actual_ppO2 ; copy last ppO2 to buffer register
291 285
292 calc_deko_divemode1a: 286 calc_deko_divemode1a:
293 call deco_calc_CNS_fraction ; calculate CNS 287 call deco_calc_CNS_fraction ; calculate CNS
294 movlb b'00000001' ; rambank 1 selected 288 movlb b'00000001' ; rambank 1 selected
295 289
875 movlw .6 869 movlw .6
876 cpfseq EEDATA 870 cpfseq EEDATA
877 bra check_ppO2_non_pscr 871 bra check_ppO2_non_pscr
878 ; in PSCR mode 872 ; in PSCR mode
879 call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2 873 call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2
874 movff sub_c+0,xA+0
875 movff sub_c+1,xA+1
876 movlw d'100'
877 movwf xB+0
878 clrf xB+1
879 call div16x16 ; /100
880 tstfsz xC+1 ; Is ppO2 > 2.55bar ?
881 setf xC+0 ; yes: bound to 2.55... better than wrap around.
882 movff xC+0,char_I_actual_ppO2 ; copy last ppO2 to buffer register (for pSCR CNS)
883 clrf xC+2
884 clrf xC+3
880 movff sub_c+0,xC+0 885 movff sub_c+0,xC+0
881 movff sub_c+1,xC+1 ; copy for comptibility 886 movff sub_c+1,xC+1 ; copy for comptibility
882 clrf xC+2
883 clrf xC+3
884 bra check_ppO2_check 887 bra check_ppO2_check
885 888
886 check_ppO2_non_pscr: 889 check_ppO2_non_pscr:
887 SAFE_2BYTE_COPY amb_pressure, xA 890 SAFE_2BYTE_COPY amb_pressure, xA
888 movlw d'10' 891 movlw d'10'