Mercurial > public > hwos_code
diff src/adc_lightsensor.asm @ 189:e79bc535ef9e
ignore un-calibrated sensors even if they become valid
author | heinrichsweikamp |
---|---|
date | Wed, 29 Oct 2014 12:53:01 +0100 |
parents | 669b5d00706d |
children | a0e0ddfc1b49 |
line wrap: on
line diff
--- a/src/adc_lightsensor.asm Mon Oct 27 11:28:48 2014 +0100 +++ b/src/adc_lightsensor.asm Wed Oct 29 12:53:01 2014 +0100 @@ -321,9 +321,15 @@ rcall wait_adc bcf STATUS,C rrcf ADRESH,F ; /2 - rrcf ADRESL,F - movff ADRESL,o2_mv_sensor1+0 ; in 0.1mV steps - movff ADRESH,o2_mv_sensor1+1 + rrcf ADRESL,W + ; add to o2_mv_sensor1:2 + addwf o2_mv_sensor1+0,F + movf ADRESH,W + addwfc o2_mv_sensor1+1,F + ; Devide by 2 + bcf STATUS,C + rrcf o2_mv_sensor1+1,F ; /2 + rrcf o2_mv_sensor1+0,F ; Ignore 1,2mV noise for not-connected inputs tstfsz o2_mv_sensor1+1 ; >25,5mV? bra get_analog_inputs2 ; Yes, skip here @@ -335,9 +341,15 @@ rcall wait_adc bcf STATUS,C rrcf ADRESH,F ; /2 - rrcf ADRESL,F - movff ADRESL,o2_mv_sensor2+0 ; in 0.1mV steps - movff ADRESH,o2_mv_sensor2+1 + rrcf ADRESL,W + ; add to o2_mv_sensor2:2 + addwf o2_mv_sensor2+0,F + movf ADRESH,W + addwfc o2_mv_sensor2+1,F + ; Devide by 2 + bcf STATUS,C + rrcf o2_mv_sensor2+1,F ; /2 + rrcf o2_mv_sensor2+0,F ; Ignore 1,2mV noise for not-connected inputs tstfsz o2_mv_sensor2+1 ; >25,5mV? bra get_analog_inputs3 ; Yes, skip here @@ -349,9 +361,15 @@ rcall wait_adc bcf STATUS,C rrcf ADRESH,F ; /2 - rrcf ADRESL,F - movff ADRESL,o2_mv_sensor3+0 ; in 0.1mV steps - movff ADRESH,o2_mv_sensor3+1 + rrcf ADRESL,W + ; add to o2_mv_sensor3:2 + addwf o2_mv_sensor3+0,F + movf ADRESH,W + addwfc o2_mv_sensor3+1,F + ; Devide by 2 + bcf STATUS,C + rrcf o2_mv_sensor3+1,F ; /2 + rrcf o2_mv_sensor3+0,F ; Ignore 1,2mV noise for not-connected inputs tstfsz o2_mv_sensor3+1 ; >25,5mV? bra get_analog_inputs4 ; Yes, skip here