comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 26:8d7af04e0f85

ppO2 limits in fixed setpoint ccr
author heinrichsweikamp
date Sat, 15 May 2010 10:03:04 +0200
parents 99512945c7a1
children 29341afd2060
comparison
equal deleted inserted replaced
25:99512945c7a1 26:8d7af04e0f85
2981 movlw d'10' 2981 movlw d'10'
2982 movwf xB+0 2982 movwf xB+0
2983 clrf xB+1 2983 clrf xB+1
2984 ;xA/xB=xC with xA as remainder 2984 ;xA/xB=xC with xA as remainder
2985 call div16x16 ; xC+0=p_amb/10 2985 call div16x16 ; xC+0=p_amb/10
2986
2986 ; char_I_const_ppO2 > p_amb/10 -> Not physically possible! -> Display actual value! 2987 ; char_I_const_ppO2 > p_amb/10 -> Not physically possible! -> Display actual value!
2987
2988 tstfsz xC+1 ; xC>255 2988 tstfsz xC+1 ; xC>255
2989 setf xC+0 ; Yes, set xC+0 to 2,55bar ppO2 2989 setf xC+0 ; Yes, set xC+0 to 2,55bar ppO2
2990 2990
2991 movff ppO2_setpoint_store,WREG 2991 movff ppO2_setpoint_store,WREG
2992 cpfslt xC+0 ; Setpoint value possible? 2992 cpfslt xC+0 ; Setpoint value possible?
2993 bra PLED_const_ppO2_value1 ; Yes! 2993 bra PLED_const_ppO2_value1 ; Yes
2994 2994
2995 movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value 2995 movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value
2996 bra PLED_const_ppO2_value1a 2996 bra PLED_const_ppO2_value1a
2997 2997
2998 PLED_const_ppO2_value1: 2998 PLED_const_ppO2_value1:
2999 2999 ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value!
3000 movff amb_pressure+0,xA+0
3001 movff amb_pressure+1,xA+1
3002 movlw d'10'
3003 movwf xB+0
3004 clrf xB+1
3005 call div16x16 ; xC=p_amb/10
3006 movff xC+0,xA+0
3007 movff xC+1,xA+1
3008 movff char_I_O2_ratio,xB+0
3009 clrf xB+1
3010 call mult16x16 ; xC:2=char_I_O2_ratio * p_amb/10
3011
3012 movff xC+0,sub_b+0
3013 movff xC+1,sub_b+1
3014 movff ppO2_setpoint_store,WREG; Setpoint
3015 mullw d'100' ; Setpoint*100
3016 movff PRODL,sub_a+0
3017 movff PRODH,sub_a+1
3018 call sub16 ; sub_c = sub_a - sub_b
3019
3020 btfss neg_flag
3021 bra PLED_const_ppO2_value11 ; Value in range
3022
3023 ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value!
3024
3025 movff xC+0,xA+0
3026 movff xC+1,xA+1
3027 movlw d'100'
3028 movwf xB+0
3029 clrf xB+1
3030 call div16x16 ;xA/xB=xC with xA as remainder
3031
3032 movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value
3033 bra PLED_const_ppO2_value1a
3034
3035 PLED_const_ppO2_value11:
3036
3037 ; Setpoint in possible limits
3000 movff ppO2_setpoint_store,char_I_const_ppO2 ; Restore Setpoint 3038 movff ppO2_setpoint_store,char_I_const_ppO2 ; Restore Setpoint
3001 3039
3002 PLED_const_ppO2_value1a: 3040 PLED_const_ppO2_value1a:
3003 movff char_I_const_ppO2,lo 3041 movff char_I_const_ppO2,lo
3004 clrf hi 3042 clrf hi