Mercurial > public > mk2
diff code_part1/OSTC_code_asm_part1/adc_rtc.asm @ 341:2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
author | JeanDo |
---|---|
date | Fri, 20 May 2011 00:48:30 +0200 |
parents | ceedf078b2d8 |
children | ab962c4b19d6 |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/adc_rtc.asm Fri May 20 00:39:05 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/adc_rtc.asm Fri May 20 00:48:30 2011 +0200 @@ -72,9 +72,9 @@ movwf fatal_error_code ; Battery very low! bsf enter_error_sleep ; enter error routine -get_battery_voltage3: - movff amb_pressure+0,sub_b+0 - movff amb_pressure+1,sub_b+1 +get_battery_voltage3: + SAFE_2BYTE_COPY amb_pressure, sub_b + movlw LOW d'15001' ; must be lower then 15001mBar movwf sub_a+0 movlw HIGH d'15001' @@ -136,9 +136,10 @@ write_int_eeprom d'43' movff year,EEDATA write_int_eeprom d'44' - movff temperature+0,EEDATA + SAFE_2BYTE_COPY temperature,lo + movff lo,EEDATA write_int_eeprom d'45' - movff temperature+1,EEDATA + movff hi,EEDATA write_int_eeprom d'46' ; Reset charge statistics clrf EEDATA @@ -150,9 +151,10 @@ write_int_eeprom d'52' ; total complete cycles write_int_eeprom d'53' ; total complete cycles ; Reset temperature extremas - movff temperature+0,EEDATA ; Reset mimimum extrema + SAFE_2BYTE_COPY temperature,lo + movff lo,EEDATA ; Reset mimimum extrema write_int_eeprom d'54' - movff temperature+1,EEDATA + movff hi,EEDATA write_int_eeprom d'55' movff month,EEDATA write_int_eeprom d'56' @@ -160,9 +162,9 @@ write_int_eeprom d'57' movff year,EEDATA write_int_eeprom d'58' - movff temperature+0,EEDATA ; Reset maximum extrema + movff lo,EEDATA ; Reset maximum extrema write_int_eeprom d'59' - movff temperature+1,EEDATA + movff hi,EEDATA write_int_eeprom d'60' movff month,EEDATA write_int_eeprom d'61' @@ -192,9 +194,10 @@ write_int_eeprom d'43' movff year,EEDATA write_int_eeprom d'44' - movff temperature+0,EEDATA + SAFE_2BYTE_COPY temperature,lo + movff lo,EEDATA write_int_eeprom d'45' - movff temperature+1,EEDATA + movff hi,EEDATA write_int_eeprom d'46' return