Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/adc_rtc.asm @ 614:7a269c01192a
Make sure day and month <> zero
author | heinrichsweikamp |
---|---|
date | Mon, 16 Jul 2012 10:42:34 +0200 |
parents | c3336f944e53 |
children | f87205426add |
comparison
equal
deleted
inserted
replaced
613:46fc9f02ae03 | 614:7a269c01192a |
---|---|
204 RTCinit: ; resets RTC | 204 RTCinit: ; resets RTC |
205 movlw 0x80 | 205 movlw 0x80 |
206 movwf TMR1H | 206 movwf TMR1H |
207 nop ; See errata DS80284E-page 2 | 207 nop ; See errata DS80284E-page 2 |
208 clrf TMR1L | 208 clrf TMR1L |
209 | |
210 ; Reset RTC if any part of the time/date is out of range | 209 ; Reset RTC if any part of the time/date is out of range |
211 movlw d'60' ; Limit | 210 movlw d'60' ; Limit |
212 cpfslt secs ; Check part | 211 cpfslt secs ; Check part |
213 bra RTCinit2 ; Reset time... | 212 bra RTCinit2 ; Reset time... |
214 movlw d'60' ; Limit | 213 movlw d'60' ; Limit |
224 cpfslt month ; Check part | 223 cpfslt month ; Check part |
225 bra RTCinit2 ; Reset time... | 224 bra RTCinit2 ; Reset time... |
226 movlw d'100' ; Limit | 225 movlw d'100' ; Limit |
227 cpfslt year ; Check part | 226 cpfslt year ; Check part |
228 bra RTCinit2 ; Reset time... | 227 bra RTCinit2 ; Reset time... |
229 | 228 ; Make sure day and month <> zero |
230 bsf PIE1, TMR1IE | 229 movlw .0 |
230 cpfseq day ; =0? | |
231 incf day,F ; Yes, +1 | |
232 cpfseq month ; =0? | |
233 incf month,F ; Yes, +1 | |
234 bsf PIE1, TMR1IE ; Enable clock int | |
231 return | 235 return |
232 | 236 |
233 RTCinit2: | 237 RTCinit2: |
234 movlw .00 | 238 movlw .00 |
235 movwf secs | 239 movwf secs |
241 movwf day | 245 movwf day |
242 movlw .7 | 246 movlw .7 |
243 movwf month | 247 movwf month |
244 movlw .12 | 248 movlw .12 |
245 movwf year | 249 movwf year |
246 bsf PIE1, TMR1IE | 250 bsf PIE1, TMR1IE ; Enable clock int |
247 return | 251 return |
248 | 252 |
249 reset_battery_stats: | 253 reset_battery_stats: |
250 bcf uart_reset_battery_stats ; Clear flag | 254 bcf uart_reset_battery_stats ; Clear flag |
251 bcf PIE1,RCIE ; no interrupt for UART | 255 bcf PIE1,RCIE ; no interrupt for UART |