diff code_part1/OSTC_code_asm_part1/i2c_eeprom.asm @ 455:c512a868937c

last work for 2.0: Fixing 32kB boundary read for logbook
author heinrichsweikamp
date Tue, 30 Aug 2011 16:29:21 +0200
parents a76c5a3e9e96
children 3091628b2742
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/i2c_eeprom.asm	Sun Aug 28 17:22:14 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/i2c_eeprom.asm	Tue Aug 30 16:29:21 2011 +0200
@@ -127,6 +127,7 @@
 	clrf		ext_ee_temp2		; high address counter
 	bcf			second_FD			; clear flags
 	bcf			first_FD
+	bcf			eeprom_switched_b1
 get_free_EEPROM_location3:
 	bsf			SSPCON2, PEN		; Stop condition
 	rcall		WaitMSSP	
@@ -157,6 +158,15 @@
 	rcall		I2C_WaitforACK
 
 get_free_EEPROM_location2:
+	btfsc		eeprom_switched_b1			; Switched to Block1 already?
+	bra			get_free_EEPROM_location2_x	; Yes, skip this check!
+
+	btfsc		ext_ee_temp2,7				; Access Block1?
+	bsf			eeprom_switched_b1			; Yes, and set the flag so this check is skipped in the rest of this routine
+	btfsc		ext_ee_temp2,7				; Access Block1?
+	bra			get_free_EEPROM_location3	; Yes, initiate new read sequence in block1
+
+get_free_EEPROM_location2_x:
 	bsf			SSPCON2, RCEN		; Enable recieve mode
 	rcall		WaitMSSP	
 	btfsc		first_FD