Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/temp_extrema.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 | 96a35aeda5f2 |
children | 39e02673db4c |
comparison
equal
deleted
inserted
replaced
340:ecbbbd423e86 | 341:2144f19fa1eb |
---|---|
26 check_temp_extrema: ; called once every minute from Sleeploop, Surfloop and Diveloop | 26 check_temp_extrema: ; called once every minute from Sleeploop, Surfloop and Diveloop |
27 read_int_eeprom d'54' ; get lowest temperature so far | 27 read_int_eeprom d'54' ; get lowest temperature so far |
28 movff EEDATA,sub_b+0 | 28 movff EEDATA,sub_b+0 |
29 read_int_eeprom d'55' | 29 read_int_eeprom d'55' |
30 movff EEDATA,sub_b+1 | 30 movff EEDATA,sub_b+1 |
31 movff temperature+0,sub_a+0 | 31 SAFE_2BYTE_COPY temperature,sub_a |
32 movff temperature+1,sub_a+1 | |
33 call sub16 ; sub_c = sub_a - sub_b | 32 call sub16 ; sub_c = sub_a - sub_b |
34 btfss neg_flag ; new lowest temperature ? | 33 btfss neg_flag ; new lowest temperature ? |
35 bra check_temp_extrema_high | 34 bra check_temp_extrema_high |
36 ; Yes, store new value together with the date | 35 ; Yes, store new value together with the date |
37 movff temperature+0,EEDATA | 36 movff sub_a+0,EEDATA |
38 write_int_eeprom d'54' | 37 write_int_eeprom d'54' |
39 movff temperature+1,EEDATA | 38 movff sub_a+1,EEDATA |
40 write_int_eeprom d'55' | 39 write_int_eeprom d'55' |
41 movff month,EEDATA | 40 movff month,EEDATA |
42 write_int_eeprom d'56' | 41 write_int_eeprom d'56' |
43 movff day,EEDATA | 42 movff day,EEDATA |
44 write_int_eeprom d'57' | 43 write_int_eeprom d'57' |
45 movff year,EEDATA | 44 movff year,EEDATA |
46 write_int_eeprom d'58' | 45 write_int_eeprom d'58' |
46 | |
47 ; Now check high extrema | 47 ; Now check high extrema |
48 check_temp_extrema_high: | 48 check_temp_extrema_high: |
49 read_int_eeprom d'59' ; get highest temperature so far | 49 read_int_eeprom d'59' ; get highest temperature so far |
50 movff EEDATA,sub_b+0 | 50 movff EEDATA,sub_b+0 |
51 read_int_eeprom d'60' | 51 read_int_eeprom d'60' |
52 movff EEDATA,sub_b+1 | 52 movff EEDATA,sub_b+1 |
53 movff temperature+0,sub_a+0 | 53 SAFE_2BYTE_COPY temperature,sub_a |
54 movff temperature+1,sub_a+1 | |
55 call sub16 ; sub_c = sub_a - sub_b | 54 call sub16 ; sub_c = sub_a - sub_b |
56 btfsc neg_flag ; new highest temperature ? | 55 btfsc neg_flag ; new highest temperature ? |
57 return ; no, quit! | 56 return ; no, quit! |
57 | |
58 ; Yes, store new value together with the date | 58 ; Yes, store new value together with the date |
59 movff temperature+0,EEDATA | 59 movff sub_a+0,EEDATA |
60 write_int_eeprom d'59' | 60 write_int_eeprom d'59' |
61 movff temperature+1,EEDATA | 61 movff sub_a+1,EEDATA |
62 write_int_eeprom d'60' | 62 write_int_eeprom d'60' |
63 movff month,EEDATA | 63 movff month,EEDATA |
64 write_int_eeprom d'61' | 64 write_int_eeprom d'61' |
65 movff day,EEDATA | 65 movff day,EEDATA |
66 write_int_eeprom d'62' | 66 write_int_eeprom d'62' |