changeset 384:904863f96582 64kByte Logbook

Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
author heinrichsweikamp
date Sat, 18 Jun 2011 11:26:22 +0200
parents d7a70654d968
children af703be9ead2
files code_part1/OSTC_code_asm_part1/altimeter.asm code_part1/OSTC_code_asm_part1/menu_logbook.asm code_part1/OSTC_code_asm_part1/menu_reset.asm code_part1/OSTC_code_asm_part1/start.asm
diffstat 4 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/altimeter.asm	Fri Jun 17 00:13:36 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/altimeter.asm	Sat Jun 18 11:26:22 2011 +0200
@@ -364,6 +364,7 @@
         movlw       4*(.49-.32) + 0x82  ; CF#49 low byte address in EEPROM
     	movwf	    EEADR
     	call	    write_eeprom
+    	clrf	    EEADRH				; Reset EEADRH for compatibility
     	bra         altimeter_menu_2
 
 ;---- Reset sea level pressure to reference ----------------------------------
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Fri Jun 17 00:13:36 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Sat Jun 18 11:26:22 2011 +0200
@@ -1274,14 +1274,13 @@
 	movlw	color_red
     call	PLED_set_color			; Set to Red
 	DISPLAYTEXTH	d'303'			; Please wait!
-	movlw	LOW		0x100
-	movwf	EEADR
-	movlw	HIGH 	0x100
+	clrf	EEADR
+	movlw	d'1'
 	movwf	EEADRH
 	movlw	0xAA
 	movwf	EEDATA		
 	call	write_eeprom			; write 0xAA to indicate the logbook is already converted
-;return
+	clrf	EEADRH					; Restore EEADRH
 ; convert logbook:
 ; Step 1: Copy 32k from 0xFE + 1 with bank switching to bank1
 ; Step 2: Copy 32k from bank1 to bank0
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Fri Jun 17 00:13:36 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sat Jun 18 11:26:22 2011 +0200
@@ -451,12 +451,19 @@
 ; Write the two bytes lo:hi into EEPROM
 reset_eeprom_value:
 	incf	EEADR,F
-	movff	lo, EEDATA				; Lowbyte Defaul value
-	call	write_eeprom
+	movff	lo, EEDATA				; Lowbyte Default value
+
+	movlw	d'127'					; Work-around to prevent writing at EEPROM 0x00 to 0x04 
+	cpfslt	EEADR					; EEADR > 127?
+	call	write_eeprom			; Yes, write!
 
 	incf	EEADR,F
 	movff	hi, EEDATA				; Highbyte default value
-	goto    write_eeprom
+
+	movlw	d'127'					; Work-around to prevent writing at EEPROM 0x00 to 0x04 
+	cpfslt	EEADR					; EEADR > 127?
+	call    write_eeprom			; Yes, write!
+	return
 
 reset_external_eeprom:				; deletes complete external eeprom!
 	clrf	eeprom_address+0
--- a/code_part1/OSTC_code_asm_part1/start.asm	Fri Jun 17 00:13:36 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Sat Jun 18 11:26:22 2011 +0200
@@ -95,9 +95,9 @@
 	movlb	b'00000001'									; select ram bank 1
 
 ; check firmware and reset Custom Functions after an update
-	movlw	LOW		0x101
+	movlw	d'1'
 	movwf	EEADR
-	movlw	HIGH 	0x101
+	movlw	d'1'
 	movwf	EEADRH
 	call	read_eeprom				; read current version x
 	movff	EEDATA,temp1
@@ -116,9 +116,9 @@
 	bra		restart					; x and y are equal -> do not reset cf
 			
 check_firmware_new:
-	movlw	LOW		0x101			; store current version in EEPROM
+	movlw	d'1'					; store current version in EEPROM
 	movwf	EEADR
-	movlw	HIGH 	0x101
+	movlw	d'1'
 	movwf	EEADRH
 	movlw	softwareversion_x
 	movwf	EEDATA