Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/temp_extrema.asm @ 454:69f1f3a1c645
minor change in license text
author | heinrichsweikamp |
---|---|
date | Sun, 28 Aug 2011 17:22:14 +0200 |
parents | 2144f19fa1eb |
children | 39e02673db4c |
rev | line source |
---|---|
0 | 1 |
2 ; OSTC - diving computer code | |
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
4 | |
5 ; This program is free software: you can redistribute it and/or modify | |
6 ; it under the terms of the GNU General Public License as published by | |
7 ; the Free Software Foundation, either version 3 of the License, or | |
8 ; (at your option) any later version. | |
9 | |
10 ; This program is distributed in the hope that it will be useful, | |
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ; GNU General Public License for more details. | |
14 | |
15 ; You should have received a copy of the GNU General Public License | |
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 | |
19 ; takes care of the temperature extrema routine | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 05/15/08 | |
22 ; last updated: 05/15/08 | |
23 ; known bugs: | |
24 ; ToDo: | |
25 | |
26 check_temp_extrema: ; called once every minute from Sleeploop, Surfloop and Diveloop | |
27 read_int_eeprom d'54' ; get lowest temperature so far | |
28 movff EEDATA,sub_b+0 | |
29 read_int_eeprom d'55' | |
30 movff EEDATA,sub_b+1 | |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
0
diff
changeset
|
31 SAFE_2BYTE_COPY temperature,sub_a |
0 | 32 call sub16 ; sub_c = sub_a - sub_b |
33 btfss neg_flag ; new lowest temperature ? | |
34 bra check_temp_extrema_high | |
35 ; Yes, store new value together with the date | |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
0
diff
changeset
|
36 movff sub_a+0,EEDATA |
0 | 37 write_int_eeprom d'54' |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
0
diff
changeset
|
38 movff sub_a+1,EEDATA |
0 | 39 write_int_eeprom d'55' |
40 movff month,EEDATA | |
41 write_int_eeprom d'56' | |
42 movff day,EEDATA | |
43 write_int_eeprom d'57' | |
44 movff year,EEDATA | |
45 write_int_eeprom d'58' | |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
0
diff
changeset
|
46 |
0 | 47 ; Now check high extrema |
48 check_temp_extrema_high: | |
49 read_int_eeprom d'59' ; get highest temperature so far | |
50 movff EEDATA,sub_b+0 | |
51 read_int_eeprom d'60' | |
52 movff EEDATA,sub_b+1 | |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
0
diff
changeset
|
53 SAFE_2BYTE_COPY temperature,sub_a |
0 | 54 call sub16 ; sub_c = sub_a - sub_b |
55 btfsc neg_flag ; new highest temperature ? | |
56 return ; no, quit! | |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
0
diff
changeset
|
57 |
0 | 58 ; Yes, store new value together with the date |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
0
diff
changeset
|
59 movff sub_a+0,EEDATA |
0 | 60 write_int_eeprom d'59' |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
0
diff
changeset
|
61 movff sub_a+1,EEDATA |
0 | 62 write_int_eeprom d'60' |
63 movff month,EEDATA | |
64 write_int_eeprom d'61' | |
65 movff day,EEDATA | |
66 write_int_eeprom d'62' | |
67 movff year,EEDATA | |
68 write_int_eeprom d'63' | |
69 return |