annotate code_part1/OSTC_code_asm_part1/temp_extrema.asm @ 816:df8cd5ffd993

BUGFIX: Load first diluent if <> 1 correctly Auto-SP change work...
author heinrichsweikamp
date Sat, 16 May 2015 14:48:26 +0200
parents 2a0e5d884fc3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1
815
2a0e5d884fc3 BUGFIX: Fix licence in German
heinrichsweikamp
parents: 807
diff changeset
2 ; OSTC Mk.2, 2N and 2C - diving computer code
807
c50296c3059e BUGFIX: Divetime had unwanted "." behind the minutes
heinrichsweikamp
parents: 703
diff changeset
3 ; Copyright (C) 2015 HeinrichsWeikamp GbR
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; takes care of the temperature extrema routine
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; written: 05/15/08
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; last updated: 05/15/08
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 check_temp_extrema: ; called once every minute from Sleeploop, Surfloop and Diveloop
703
39e02673db4c some cleanup
heinrichsweikamp
parents: 341
diff changeset
27 clrf EEADRH
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 read_int_eeprom d'54' ; get lowest temperature so far
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 movff EEDATA,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 read_int_eeprom d'55'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31 movff EEDATA,sub_b+1
341
2144f19fa1eb BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents: 0
diff changeset
32 SAFE_2BYTE_COPY temperature,sub_a
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 call sub16 ; sub_c = sub_a - sub_b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 btfss neg_flag ; new lowest temperature ?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 bra check_temp_extrema_high
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36 ; 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
37 movff sub_a+0,EEDATA
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 write_int_eeprom d'54'
341
2144f19fa1eb BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents: 0
diff changeset
39 movff sub_a+1,EEDATA
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 write_int_eeprom d'55'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 movff month,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 write_int_eeprom d'56'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 movff day,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 write_int_eeprom d'57'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 movff year,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 write_int_eeprom d'58'
341
2144f19fa1eb BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents: 0
diff changeset
47
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 ; Now check high extrema
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 check_temp_extrema_high:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50 read_int_eeprom d'59' ; get highest temperature so far
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 movff EEDATA,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52 read_int_eeprom d'60'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53 movff EEDATA,sub_b+1
341
2144f19fa1eb BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents: 0
diff changeset
54 SAFE_2BYTE_COPY temperature,sub_a
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 call sub16 ; sub_c = sub_a - sub_b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 btfsc neg_flag ; new highest temperature ?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 return ; no, quit!
341
2144f19fa1eb BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents: 0
diff changeset
58
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 ; 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
60 movff sub_a+0,EEDATA
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61 write_int_eeprom d'59'
341
2144f19fa1eb BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents: 0
diff changeset
62 movff sub_a+1,EEDATA
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63 write_int_eeprom d'60'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64 movff month,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65 write_int_eeprom d'61'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66 movff day,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67 write_int_eeprom d'62'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 movff year,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 write_int_eeprom d'63'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70 return