Mercurial > public > mk2
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 |
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 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
20 ; written: 10/30/05 | |
21 ; last updated: 05/16/08 | |
22 ; known bugs: | |
23 ; ToDo: | |
24 | |
25 ; the timer1 module interrupts every 62.5ms (16x/second) | |
26 ; temperature and pressure is averaged over 4 measurements | |
27 ; flag pressure_refresh is set every 500ms | |
28 ; and provides accurate pressure (+/-1mBar stable) and temperature (0.1C stable) | |
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 | 32 uartint: |
33 btfsc simulatormode_active ; are we in simulatormode? | |
34 bra simulator_int ; Yes, reading is depth in m! | |
35 | |
36 movff RCREG,uart1_temp | |
37 movlw d'96' | |
38 subwf uart1_temp,F | |
39 dcfsnz uart1_temp,F ; "a" | |
40 bsf dump_external_eeprom ; set flag | |
41 dcfsnz uart1_temp,F ; "b" | |
42 bsf uart_settime ; set flag | |
43 dcfsnz uart1_temp,F ; "c" | |
44 bsf simulatormode_active ; set flag | |
45 dcfsnz uart1_temp,F ; "d" | |
46 bsf internal_eeprom_write ; set flag | |
47 dcfsnz uart1_temp,F ; "e" | |
48 bsf uart_send_hash ; set flag | |
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 | 51 dcfsnz uart1_temp,F ; "g" |
52 bsf uart_send_int_eeprom ; set flag | |
53 dcfsnz uart1_temp,F ; "h" | |
54 bsf uart_reset_decodata ; set flag | |
55 dcfsnz uart1_temp,F ; "i" | |
56 bsf internal_eeprom_write2 ; set flag | |
57 dcfsnz uart1_temp,F ; "j" | |
58 bsf uart_send_int_eeprom2 ; set flag | |
59 dcfsnz uart1_temp,F ; "k" | |
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 | 66 |
67 uartint1: | |
68 movf RCREG,w ; unload RCREG in stand-alone simulator mode | |
69 bcf PIR1,RCIF ; Clear flag | |
70 bcf RCSTA,CREN ; Clear receiver status | |
71 bsf RCSTA,CREN | |
72 return | |
73 | |
74 simulator_int: | |
75 btfsc standalone_simulator ; ignore in standalone simulator mode | |
76 bra uartint1 | |
77 | |
21 | 78 bsf LED_blue |
0 | 79 tstfsz RCREG ; =0x00? |
80 bra simulator_int1 ; No | |
81 incf RCREG,F ; Yes, so force RCREG=1 | |
82 | |
83 simulator_int1: | |
84 movf RCREG,w ; depth in m | |
85 mullw d'100' ; result will be mbar | |
86 movff PRODL,sim_pressure+0 ; stored for pressure overwrite | |
87 movff PRODH,sim_pressure+1 | |
88 bra uartint1 ; exit uart int | |
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 | 92 switch_left_int: |
0 | 93 bcf INTCON,INT0IF ; Clear flag |
94 | |
95 btfsc T0CON,TMR0ON ; Timer0 running? | |
96 bra timer0_restart ; Yes, restart | |
97 | |
266 | 98 ; OSTC 2N has flipped screen and exchanged switches... |
99 movff win_flags,WREG ; Get into Bank0 | |
100 btfss WREG,0 | |
0 | 101 bsf switch_left ; Set flag, button press is OK |
266 | 102 btfsc WREG,0 |
103 bsf switch_right ; Set flag, button press is OK | |
0 | 104 |
105 bsf T0CON,TMR0ON ; Start Timer 0 | |
106 return | |
107 | |
108 | |
238 | 109 switch_right_int: |
0 | 110 bcf INTCON3,INT1IF ; Clear flag |
111 | |
112 btfsc T0CON,TMR0ON ; Timer0 running? | |
113 bra timer0_restart ; Yes, restart | |
114 | |
266 | 115 ; OSTC 2N has flipped screen and exchanged switches... |
116 movff win_flags,WREG ; Get into Bank0 | |
117 btfsc WREG,0 | |
118 bsf switch_left ; Set flag, button press is OK | |
119 btfss WREG,0 | |
0 | 120 bsf switch_right ; Set flag, button press is OK |
121 | |
122 bsf T0CON,TMR0ON ; Start Timer 0 | |
123 return | |
124 | |
125 timer0_restart: | |
126 bcf INTCON,TMR0IF ; Clear flag | |
127 clrf T0CON ; Timer0 | |
128 clrf TMR0H | |
129 clrf TMR0L | |
130 bsf T0CON,TMR0ON ; Start Timer 0 | |
131 return | |
132 | |
133 timer0int: | |
134 bcf INTCON,TMR0IF ; Clear flag | |
135 bcf T0CON,TMR0ON ; Stop Timer 0 | |
136 clrf TMR0H | |
137 clrf TMR0L | |
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 | 143 timer1int: |
144 bcf PIR1,TMR1IF ; Clear flag | |
145 | |
146 timer1int_debug: | |
21 | 147 bcf LED_red ; LEDr off (For charge indicator) |
0 | 148 |
149 movlw 0x08 ; Timer1 int after 62.5ms (=16/second) | |
150 cpfslt TMR1H ; Did we miss a 1/16 second? | |
151 incf timer1int_counter1,F ; Yes, add extra 1/16 second | |
152 | |
153 movlw 0x08 ; Timer1 int after 62.5ms (=16/second) | |
154 subwf TMR1H,F | |
155 | |
238 | 156 incf timer1int_counter1,F ; Increase timer1 counter |
157 | |
0 | 158 movlw d'15' ; One second 16 |
159 cpfsgt timer1int_counter1 | |
160 bra sensor_int_pre ; only pressure sensor | |
238 | 161 rcall RTCisr ; adjust time, then query pressure sensor |
0 | 162 |
163 sensor_int_pre: | |
238 | 164 btfsc sleepmode ; In sleepmode? |
165 return ; Yes | |
0 | 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 | 182 sensor_int: |
183 btfsc no_sensor_int ; No sensor interrupt (because it's addressed during sleep) | |
184 return | |
185 | |
238 | 186 incf timer1int_counter2,F ; counts to eight for state maschine |
0 | 187 |
238 | 188 ; State 1: Clear flags and average registers, get temperature (51us) and start pressure integration (73,5us) |
189 ; State 2: Get pressure (51us), start temperature integration (73,5us) and calculate temperature compensated pressure (233us) | |
190 ; State 3: Get temperature (51us) and start pressure integration (73,5us) | |
191 ; State 4: Get pressure (51us), start temperature integration (73,5us) and calculate temperature compensated pressure (233us) | |
192 ; State 5: Get temperature (51us) and start pressure integration (73,5us) | |
193 ; State 6: Get pressure (51us), start temperature integration (73,5us) and calculate temperature compensated pressure (233us) | |
194 ; State 7: Get temperature (51us) and start pressure integration (73,5us) | |
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 | |
196 | |
197 movff timer1int_counter2,isr_divB ; isr_divB used as temp here... | |
198 dcfsnz isr_divB,F | |
199 bra sensor_int_state1_plus_restart ; Do State 1 | |
200 dcfsnz isr_divB,F | |
201 bra sensor_int_state2 ; Do State 2 | |
202 dcfsnz isr_divB,F | |
203 bra sensor_int_state1 ; Do State 3 | |
204 dcfsnz isr_divB,F | |
205 bra sensor_int_state2 ; Do State 4 | |
206 dcfsnz isr_divB,F | |
207 bra sensor_int_state1 ; Do State 5 | |
208 dcfsnz isr_divB,F | |
209 bra sensor_int_state2 ; Do State 6 | |
210 dcfsnz isr_divB,F | |
211 bra sensor_int_state1 ; Do State 7 | |
212 ; bra sensor_int2_plus_average ; Do State 8 | |
213 | |
214 ;sensor_int2_plus_average: | |
215 rcall sensor_int_state2 | |
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 | 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 | 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 | 241 |
242 bsf pressure_refresh ; Set flag! Temp and pressure were updated! | |
238 | 243 clrf timer1int_counter2 ; Then reset State counter |
0 | 244 |
245 btfss simulatormode_active ; are we in simulator mode? | |
246 bra comp_air_pressure ; no | |
247 | |
248 comp_air_pressure0: | |
249 movlw LOW d'1000' ; yes, so simulate 1Bar surface pressure | |
250 movwf last_surfpressure+0 | |
251 movlw HIGH d'1000' | |
252 movwf last_surfpressure+1 | |
253 | |
254 comp_air_pressure: | |
255 movf last_surfpressure+0,W ; compensate airpressure | |
256 subwf amb_pressure+0,W | |
238 | 257 movwf rel_pressure+0 ; rel_pressure stores depth! |
0 | 258 |
259 movf last_surfpressure+1,W | |
260 subwfb amb_pressure+1,W | |
261 movwf rel_pressure+1 | |
238 | 262 btfss STATUS,N ; result is below zero? |
263 return | |
264 clrf rel_pressure+0 ; Yes, do not display negative depths | |
265 clrf rel_pressure+1 ; e.g. when surface air pressure dropped during the dive | |
0 | 266 return |
238 | 267 |
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 | 274 |
275 sensor_int_state1: | |
276 call get_temperature_value ; State 1: Get temperature | |
277 call get_pressure_start ; and start pressure integration. | |
278 return ; Done. | |
279 | |
280 sensor_int_state2: | |
281 call get_pressure_value ; State2: Get pressure (51us) | |
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 | 284 |
340
ecbbbd423e86
BUGFIX save negativ temperatures in logbook (bbbug #6)
JeanDo
parents:
297
diff
changeset
|
285 ;============================================================================= |
0 | 286 |
287 RTCisr: | |
288 clrf timer1int_counter1 ; counts to 16 (one second / 62.5ms) | |
289 bsf onesecupdate ; we have a new second! | |
290 | |
291 bcf STATUS,Z ; are we in dive mode? | |
292 btfss divemode | |
238 | 293 bra RTCisr2 ; No, must be surface or sleepmode |
0 | 294 |
295 incf samplesecs,F ; CF20 diving seconds done | |
296 decf samplesecs_value,W ; holds CF20 value (minus 1 into WREG) | |
297 cpfsgt samplesecs | |
238 | 298 bra RTCisr1 ; no |
0 | 299 |
300 clrf samplesecs ; clear counter... | |
301 bsf store_sample ; ...and set bit for profile storage | |
238 | 302 |
0 | 303 RTCisr1: |
304 ; Increase re-setable average depth divetime counter | |
111 | 305 incf average_divesecs+0,F ; increase stopwatch registers |
0 | 306 btfsc STATUS,Z |
111 | 307 incf average_divesecs+1,F ; increase stopwatch registers |
0 | 308 |
309 btfss divemode2 ; displayed divetime is running? | |
310 bra RTCisr2 ; No (e.g. too shallow) | |
311 | |
312 incf divesecs,F ; increase divetime registers | |
313 movlw d'59' | |
314 cpfsgt divesecs | |
315 bra RTCisr1a | |
238 | 316 |
0 | 317 clrf divesecs |
318 bsf realdive ; this bit is always set (again) if the dive is longer then one minute | |
319 | |
320 incf divemins+0,F ; increase divemins | |
321 btfsc STATUS,Z | |
322 incf divemins+1,F ; and now do the realtime clock routine anyway | |
323 | |
324 RTCisr1a: | |
325 btfss FLAG_apnoe_mode ; Are we in Apnoe mode? | |
326 bra RTCisr2 ; No, skip the following | |
327 | |
328 incf apnoe_secs,F ; increase descent registers | |
329 movlw d'59' | |
330 cpfsgt apnoe_secs | |
331 bra RTCisr2 | |
332 clrf apnoe_secs | |
333 | |
334 incf apnoe_mins,F ; increase descent mins | |
335 ; Now, do the RTC routine.... | |
336 RTCisr2: | |
337 incf secs,F ; adjusts seconds, minutes, hours, day, month and year. Checks for a leap year and works until 2099! | |
338 movlw d'59' | |
339 cpfsgt secs | |
340 return | |
341 clrf secs | |
342 bsf oneminupdate | |
343 incf mins,F | |
344 movlw d'59' | |
345 cpfsgt mins | |
346 return | |
347 clrf mins | |
348 incf hours,F | |
349 movlw d'23' | |
350 cpfsgt hours | |
351 return | |
352 clrf hours | |
13 | 353 incf day,F |
43 | 354 movff time_correction_value,secs ; Correct too slow clock |
13 | 355 |
0 | 356 check_date: |
357 movff month,isr_divB ; new month? | |
358 dcfsnz isr_divB,F | |
359 movlw .31 | |
360 dcfsnz isr_divB,F | |
361 movlw .28 | |
362 dcfsnz isr_divB,F | |
363 movlw .31 | |
364 dcfsnz isr_divB,F | |
365 movlw .30 | |
366 dcfsnz isr_divB,F | |
367 movlw .31 | |
368 dcfsnz isr_divB,F | |
369 movlw .30 | |
370 dcfsnz isr_divB,F | |
371 movlw .31 | |
372 dcfsnz isr_divB,F | |
373 movlw .31 | |
374 dcfsnz isr_divB,F | |
375 movlw .30 | |
376 dcfsnz isr_divB,F | |
377 movlw .31 | |
378 dcfsnz isr_divB,F | |
379 movlw .30 | |
380 dcfsnz isr_divB,F | |
381 movlw .31 | |
382 cpfsgt day,1 | |
383 return | |
384 movlw .1 | |
385 movwf day | |
386 incf month,F | |
387 movlw .12 | |
388 cpfsgt month,1 | |
389 return | |
390 movlw .1 | |
391 movwf month | |
392 incf year,F | |
393 return |