# HG changeset patch
# User heinrichsweikamp
# Date 1342428154 -7200
# Node ID 7a269c01192a2b73aa1f846158044366a310894b
# Parent  46fc9f02ae031fadc917327fe7ab31f33ebbc55b
Make sure day and month <> zero

diff -r 46fc9f02ae03 -r 7a269c01192a code_part1/OSTC_code_asm_part1/adc_rtc.asm
--- 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: