# HG changeset patch # User heinrichsweikamp # Date 1308389182 -7200 # Node ID 904863f965824adb7c58619ed239b50feba12759 # Parent d7a70654d968c84934e8c676e30a468d34d2a334 Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1 diff -r d7a70654d968 -r 904863f96582 code_part1/OSTC_code_asm_part1/altimeter.asm --- 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 ---------------------------------- diff -r d7a70654d968 -r 904863f96582 code_part1/OSTC_code_asm_part1/menu_logbook.asm --- 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 diff -r d7a70654d968 -r 904863f96582 code_part1/OSTC_code_asm_part1/menu_reset.asm --- 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 diff -r d7a70654d968 -r 904863f96582 code_part1/OSTC_code_asm_part1/start.asm --- 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