diff code_part1/OSTC_code_asm_part1/start.asm @ 720:4452837aff37

Vault date and time during update
author heinrichsweikamp
date Sun, 26 May 2013 11:58:56 +0200
parents b7f7184d800d
children ae641bcb0d02
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/start.asm	Thu May 23 21:43:08 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Sun May 26 11:58:56 2013 +0200
@@ -163,6 +163,32 @@
 	clrf	EEADRH					; Reset EEADRH
 
 restart:
+    ; check for time/date vault
+    movlw   .1
+    movwf   EEADRH
+    read_int_eeprom .5
+    movlw   0xAA
+    cpfseq  EEDATA                  ; 0xAA in EEPROM Bank1, Byte 5?
+    bra     restart0                        ; No
+
+    movlw   0x00
+    movwf   EEDATA
+    write_int_eeprom	d'5'        ; clear flag
+    read_int_eeprom     .6
+    movff   EEDATA,year
+    read_int_eeprom     .7
+    movff   EEDATA,month
+    read_int_eeprom     .8
+    movff   EEDATA,day
+    read_int_eeprom     .9
+    movff   EEDATA,hours
+    read_int_eeprom     .10
+    movff   EEDATA,mins
+    read_int_eeprom     .11
+    movff   EEDATA,secs
+    call    RTCinit                 ; Check limits
+restart0:
+    clrf    EEADRH
 	movlw	b'00000011'
 	movwf	T3CON					; Timer3 with 32768Hz clock running
 	clrf	TMR3L