annotate code_part1/OSTC_code_asm_part1/isr.asm @ 340:ecbbbd423e86

BUGFIX save negativ temperatures in logbook (bbbug #6) BUGFIX temperature & amb_pressure averaging done in private variable. BUGFIX Signed averaging of temperature.
author JeanDo
date Fri, 20 May 2011 00:39:05 +0200
parents ceedf078b2d8
children 2144f19fa1eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR
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 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written: 10/30/05
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; last updated: 05/16/08
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25 ; the timer1 module interrupts every 62.5ms (16x/second)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 ; temperature and pressure is averaged over 4 measurements
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 ; flag pressure_refresh is set every 500ms
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 ; and provides accurate pressure (+/-1mBar stable) and temperature (0.1C stable)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
30 ;=============================================================================
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
31
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32 uartint:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 btfsc simulatormode_active ; are we in simulatormode?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 bra simulator_int ; Yes, reading is depth in m!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36 movff RCREG,uart1_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 movlw d'96'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 subwf uart1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 dcfsnz uart1_temp,F ; "a"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 bsf dump_external_eeprom ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 dcfsnz uart1_temp,F ; "b"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 bsf uart_settime ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 dcfsnz uart1_temp,F ; "c"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 bsf simulatormode_active ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 dcfsnz uart1_temp,F ; "d"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 bsf internal_eeprom_write ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47 dcfsnz uart1_temp,F ; "e"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 bsf uart_send_hash ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 dcfsnz uart1_temp,F ; "f"
297
ceedf078b2d8 Gas Setup page 2 reworked, Texts 107, 108, 109,150, 149, 168, 42, 43, 53,54,55, 165 need update in french, spanish and german
Heinrichsweikamp
parents: 283
diff changeset
50 bsf uart_reset_battery_stats ; set flag
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 dcfsnz uart1_temp,F ; "g"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52 bsf uart_send_int_eeprom ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53 dcfsnz uart1_temp,F ; "h"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 bsf uart_reset_decodata ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 dcfsnz uart1_temp,F ; "i"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 bsf internal_eeprom_write2 ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 dcfsnz uart1_temp,F ; "j"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58 bsf uart_send_int_eeprom2 ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 dcfsnz uart1_temp,F ; "k"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 bsf uart_store_tissue_data ; set flag
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
61
283
4ec488f046f4 Battery sign color coded, work on new uart-started 115200Baud bootloader (Do NOT use yet!)
heinrichsweikamp
parents: 266
diff changeset
62 movlw 0xC1
4ec488f046f4 Battery sign color coded, work on new uart-started 115200Baud bootloader (Do NOT use yet!)
heinrichsweikamp
parents: 266
diff changeset
63 cpfseq RCREG ; 115200Baud Bootloader request?
4ec488f046f4 Battery sign color coded, work on new uart-started 115200Baud bootloader (Do NOT use yet!)
heinrichsweikamp
parents: 266
diff changeset
64 bra uartint1 ; No
4ec488f046f4 Battery sign color coded, work on new uart-started 115200Baud bootloader (Do NOT use yet!)
heinrichsweikamp
parents: 266
diff changeset
65 bsf uart_115200_bootloader ; Yes, set Flag
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67 uartint1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 movf RCREG,w ; unload RCREG in stand-alone simulator mode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 bcf PIR1,RCIF ; Clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70 bcf RCSTA,CREN ; Clear receiver status
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 bsf RCSTA,CREN
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 simulator_int:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 btfsc standalone_simulator ; ignore in standalone simulator mode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 bra uartint1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77
21
73014f788032 1.60 stable rc1
heinrichsweikamp
parents: 13
diff changeset
78 bsf LED_blue
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 tstfsz RCREG ; =0x00?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 bra simulator_int1 ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 incf RCREG,F ; Yes, so force RCREG=1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83 simulator_int1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 movf RCREG,w ; depth in m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 mullw d'100' ; result will be mbar
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86 movff PRODL,sim_pressure+0 ; stored for pressure overwrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87 movff PRODH,sim_pressure+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 bra uartint1 ; exit uart int
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
90 ;=============================================================================
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
91
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
92 switch_left_int:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 bcf INTCON,INT0IF ; Clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 btfsc T0CON,TMR0ON ; Timer0 running?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 bra timer0_restart ; Yes, restart
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97
266
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
98 ; OSTC 2N has flipped screen and exchanged switches...
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
99 movff win_flags,WREG ; Get into Bank0
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
100 btfss WREG,0
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 bsf switch_left ; Set flag, button press is OK
266
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
102 btfsc WREG,0
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
103 bsf switch_right ; Set flag, button press is OK
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 bsf T0CON,TMR0ON ; Start Timer 0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
109 switch_right_int:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 bcf INTCON3,INT1IF ; Clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 btfsc T0CON,TMR0ON ; Timer0 running?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113 bra timer0_restart ; Yes, restart
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114
266
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
115 ; OSTC 2N has flipped screen and exchanged switches...
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
116 movff win_flags,WREG ; Get into Bank0
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
117 btfsc WREG,0
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
118 bsf switch_left ; Set flag, button press is OK
ba109a7948df OSTC 2N uses exchanged switches...
heinrichsweikamp
parents: 245
diff changeset
119 btfss WREG,0
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 bsf switch_right ; Set flag, button press is OK
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 bsf T0CON,TMR0ON ; Start Timer 0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 timer0_restart:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 bcf INTCON,TMR0IF ; Clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 clrf T0CON ; Timer0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 clrf TMR0H
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 clrf TMR0L
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 bsf T0CON,TMR0ON ; Start Timer 0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 timer0int:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134 bcf INTCON,TMR0IF ; Clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 bcf T0CON,TMR0ON ; Stop Timer 0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 clrf TMR0H
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 clrf TMR0L
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 return
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
139
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
140 ;=============================================================================
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
141 ;
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
142
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 timer1int:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144 bcf PIR1,TMR1IF ; Clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146 timer1int_debug:
21
73014f788032 1.60 stable rc1
heinrichsweikamp
parents: 13
diff changeset
147 bcf LED_red ; LEDr off (For charge indicator)
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149 movlw 0x08 ; Timer1 int after 62.5ms (=16/second)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 cpfslt TMR1H ; Did we miss a 1/16 second?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151 incf timer1int_counter1,F ; Yes, add extra 1/16 second
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 movlw 0x08 ; Timer1 int after 62.5ms (=16/second)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154 subwf TMR1H,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
156 incf timer1int_counter1,F ; Increase timer1 counter
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
157
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158 movlw d'15' ; One second 16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159 cpfsgt timer1int_counter1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160 bra sensor_int_pre ; only pressure sensor
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
161 rcall RTCisr ; adjust time, then query pressure sensor
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 sensor_int_pre:
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
164 btfsc sleepmode ; In sleepmode?
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
165 return ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
167 ; Sensor interput do poll the presure/temperature sensor, download results,
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
168 ; compute compensations, and store results in various shared variables.
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
169 ;
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
170 ; Input: interupt (every 62.5msec == 16Hz), sensor,
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
171 ; last_surfpressure:2.
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
172 ;
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
173 ; Output: amb_pressure:2,
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
174 ; temperature:2,
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
175 ; rel_pressure:2,
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
176 ; and the pressure_refresh flag.
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
177 ;
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
178 ; NOTE: averaging (4 successive value, as recommended in the MS5535 datasheet)
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
179 ; is done on private variables, to avoid trashing data while reading it
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
180 ; from the main code.
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
181 ;
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
182 sensor_int:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
183 btfsc no_sensor_int ; No sensor interrupt (because it's addressed during sleep)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
184 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
185
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
186 incf timer1int_counter2,F ; counts to eight for state maschine
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
187
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
188 ; State 1: Clear flags and average registers, get temperature (51us) and start pressure integration (73,5us)
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
189 ; State 2: Get pressure (51us), start temperature integration (73,5us) and calculate temperature compensated pressure (233us)
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
190 ; State 3: Get temperature (51us) and start pressure integration (73,5us)
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
191 ; State 4: Get pressure (51us), start temperature integration (73,5us) and calculate temperature compensated pressure (233us)
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
192 ; State 5: Get temperature (51us) and start pressure integration (73,5us)
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
193 ; State 6: Get pressure (51us), start temperature integration (73,5us) and calculate temperature compensated pressure (233us)
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
194 ; State 7: Get temperature (51us) and start pressure integration (73,5us)
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
195 ; State 8: Get pressure (51us), start temperature integration (73,5us), calculate temperature compensated pressure (233us) and build average for half-second update of tempperature and pressure
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
196
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
197 movff timer1int_counter2,isr_divB ; isr_divB used as temp here...
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
198 dcfsnz isr_divB,F
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
199 bra sensor_int_state1_plus_restart ; Do State 1
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
200 dcfsnz isr_divB,F
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
201 bra sensor_int_state2 ; Do State 2
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
202 dcfsnz isr_divB,F
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
203 bra sensor_int_state1 ; Do State 3
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
204 dcfsnz isr_divB,F
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
205 bra sensor_int_state2 ; Do State 4
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
206 dcfsnz isr_divB,F
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
207 bra sensor_int_state1 ; Do State 5
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
208 dcfsnz isr_divB,F
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
209 bra sensor_int_state2 ; Do State 6
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
210 dcfsnz isr_divB,F
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
211 bra sensor_int_state1 ; Do State 7
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
212 ; bra sensor_int2_plus_average ; Do State 8
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
213
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
214 ;sensor_int2_plus_average:
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
215 rcall sensor_int_state2
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
216 sensor_int2_plus_average2:
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
217 bcf STATUS,C ; clear carry bit.
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
218 rrcf amb_pressure_avg+1 ; amb_pressure sum / 2
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
219 rrcf amb_pressure_avg+0
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
220 bcf STATUS,C ; clear carry bit, twice.
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
221 rrcf amb_pressure_avg+1 ; amb_pressure sum / 4
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
222 rrcf amb_pressure_avg+0
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
223
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
224 movff amb_pressure_avg+1,amb_pressure+1 ; copy into actual register
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
225 movff amb_pressure_avg+0,amb_pressure+0
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
226
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
227 bcf STATUS,C
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
228 btfsc temperature_avg+1,7 ; Copy sign bit to carry
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
229 bsf STATUS,C
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
230 rrcf temperature_avg+1 ; Signed temperature /2
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
231 rrcf temperature_avg+0
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
232
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
233 bcf STATUS,C
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
234 btfsc temperature_avg+1,7 ; Copy sign bit to carry
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
235 bsf STATUS,C
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
236 rrcf temperature_avg+1 ; Signed temperature /4
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
237 rrcf temperature_avg+0
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
238
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
239 movff temperature_avg+1,temperature+1
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
240 movff temperature_avg+0,temperature+0
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
241
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
242 bsf pressure_refresh ; Set flag! Temp and pressure were updated!
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
243 clrf timer1int_counter2 ; Then reset State counter
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
244
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
245 btfss simulatormode_active ; are we in simulator mode?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
246 bra comp_air_pressure ; no
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
247
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
248 comp_air_pressure0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
249 movlw LOW d'1000' ; yes, so simulate 1Bar surface pressure
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
250 movwf last_surfpressure+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
251 movlw HIGH d'1000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
252 movwf last_surfpressure+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
253
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
254 comp_air_pressure:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
255 movf last_surfpressure+0,W ; compensate airpressure
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
256 subwf amb_pressure+0,W
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
257 movwf rel_pressure+0 ; rel_pressure stores depth!
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
258
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
259 movf last_surfpressure+1,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
260 subwfb amb_pressure+1,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
261 movwf rel_pressure+1
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
262 btfss STATUS,N ; result is below zero?
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
263 return
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
264 clrf rel_pressure+0 ; Yes, do not display negative depths
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
265 clrf rel_pressure+1 ; e.g. when surface air pressure dropped during the dive
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
266 return
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
267
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
268 sensor_int_state1_plus_restart:
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
269 ;;; bcf pressure_refresh ; clear flags
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
270 clrf amb_pressure_avg+0 ; pressure average registers
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
271 clrf amb_pressure_avg+1
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
272 clrf temperature_avg+0
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
273 clrf temperature_avg+1
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
274
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
275 sensor_int_state1:
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
276 call get_temperature_value ; State 1: Get temperature
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
277 call get_pressure_start ; and start pressure integration.
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
278 return ; Done.
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
279
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
280 sensor_int_state2:
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
281 call get_pressure_value ; State2: Get pressure (51us)
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
282 call get_temperature_start ; and start temperature integration (73,5us)
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
283 goto calculate_compensation ; calculate temperature compensated pressure (233us)
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
284
340
ecbbbd423e86 BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents: 297
diff changeset
285 ;=============================================================================
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
286
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287 RTCisr:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
288 clrf timer1int_counter1 ; counts to 16 (one second / 62.5ms)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
289 bsf onesecupdate ; we have a new second!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
290
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291 bcf STATUS,Z ; are we in dive mode?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 btfss divemode
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
293 bra RTCisr2 ; No, must be surface or sleepmode
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
294
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
295 incf samplesecs,F ; CF20 diving seconds done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
296 decf samplesecs_value,W ; holds CF20 value (minus 1 into WREG)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
297 cpfsgt samplesecs
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
298 bra RTCisr1 ; no
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
299
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
300 clrf samplesecs ; clear counter...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
301 bsf store_sample ; ...and set bit for profile storage
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
302
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
303 RTCisr1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
304 ; Increase re-setable average depth divetime counter
111
ed7826c740a0 1.74beta rc1
heinrichsweikamp
parents: 49
diff changeset
305 incf average_divesecs+0,F ; increase stopwatch registers
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 btfsc STATUS,Z
111
ed7826c740a0 1.74beta rc1
heinrichsweikamp
parents: 49
diff changeset
307 incf average_divesecs+1,F ; increase stopwatch registers
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
308
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
309 btfss divemode2 ; displayed divetime is running?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
310 bra RTCisr2 ; No (e.g. too shallow)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
311
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
312 incf divesecs,F ; increase divetime registers
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
313 movlw d'59'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
314 cpfsgt divesecs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
315 bra RTCisr1a
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 111
diff changeset
316
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
317 clrf divesecs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
318 bsf realdive ; this bit is always set (again) if the dive is longer then one minute
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
319
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
320 incf divemins+0,F ; increase divemins
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
321 btfsc STATUS,Z
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
322 incf divemins+1,F ; and now do the realtime clock routine anyway
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
323
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
324 RTCisr1a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
325 btfss FLAG_apnoe_mode ; Are we in Apnoe mode?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
326 bra RTCisr2 ; No, skip the following
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
327
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
328 incf apnoe_secs,F ; increase descent registers
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
329 movlw d'59'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
330 cpfsgt apnoe_secs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
331 bra RTCisr2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
332 clrf apnoe_secs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
334 incf apnoe_mins,F ; increase descent mins
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
335 ; Now, do the RTC routine....
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
336 RTCisr2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
337 incf secs,F ; adjusts seconds, minutes, hours, day, month and year. Checks for a leap year and works until 2099!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
338 movlw d'59'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
339 cpfsgt secs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
340 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
341 clrf secs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
342 bsf oneminupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
343 incf mins,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
344 movlw d'59'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
345 cpfsgt mins
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
346 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
347 clrf mins
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
348 incf hours,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
349 movlw d'23'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
350 cpfsgt hours
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
351 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
352 clrf hours
13
3b30cd739782 1.53 beta rc2
heinrichsweikamp
parents: 0
diff changeset
353 incf day,F
43
65d5b0c8da41 New CF48, changed CF15
heinrichsweikamp
parents: 21
diff changeset
354 movff time_correction_value,secs ; Correct too slow clock
13
3b30cd739782 1.53 beta rc2
heinrichsweikamp
parents: 0
diff changeset
355
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
356 check_date:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
357 movff month,isr_divB ; new month?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
358 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
359 movlw .31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
360 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
361 movlw .28
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
362 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
363 movlw .31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
364 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
365 movlw .30
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
366 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
367 movlw .31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
368 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
369 movlw .30
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
370 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
371 movlw .31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
372 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
373 movlw .31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
374 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
375 movlw .30
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
376 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
377 movlw .31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
378 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
379 movlw .30
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
380 dcfsnz isr_divB,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
381 movlw .31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
382 cpfsgt day,1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
383 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
384 movlw .1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
385 movwf day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
386 incf month,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
387 movlw .12
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
388 cpfsgt month,1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
389 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
390 movlw .1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
391 movwf month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
392 incf year,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
393 return