changeset 614:7a269c01192a

Make sure day and month <> zero
author heinrichsweikamp
date Mon, 16 Jul 2012 10:42:34 +0200
parents 46fc9f02ae03
children 3ab53b57f879
files code_part1/OSTC_code_asm_part1/adc_rtc.asm
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Sun Jul 15 15:24:44 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Mon Jul 16 10:42:34 2012 +0200
@@ -206,7 +206,6 @@
 	movwf	TMR1H
 	nop							; See errata DS80284E-page 2
 	clrf	TMR1L
-
 ; Reset RTC if any part of the time/date is out of range
 	movlw	d'60'				; Limit
 	cpfslt	secs				; Check part
@@ -226,8 +225,13 @@
 	movlw	d'100'				; Limit
 	cpfslt	year				; Check part
 	bra		RTCinit2			; Reset time...
-
-	bsf		PIE1, TMR1IE
+; Make sure day and month <> zero
+	movlw	.0
+	cpfseq	day					; =0?
+	incf	day,F				; Yes, +1
+	cpfseq	month				; =0?
+	incf	month,F				; Yes, +1
+	bsf		PIE1, TMR1IE		; Enable clock int
 	return
 
 RTCinit2:
@@ -243,7 +247,7 @@
 	movwf	month
 	movlw	.12
 	movwf	year
-	bsf		PIE1, TMR1IE
+	bsf		PIE1, TMR1IE		; Enable clock int
 	return
 
 reset_battery_stats: