PDA

View Full Version : EEPROM & I2C Page Write



Bill Legge
- 20th May 2009, 03:52
I'm using EEPROM chips 24LC512 with 64k bytes of storage.
I want to erase (set all data to zero) the chips as quickly as possible.
According to the Microchip spec sheets, a page write can be done:

Control_Byte, AddressHi_Byte, AddressLo_Byte, DataByte_0, .....DataByte_127

i.e. the chip will accept 128 bytes of data in one go when using page write.
How do I do this in PBP:

Address VAR WORD
Blank CON $0
I2CWRITE DataPin,ClockPin,$A0,Address,[STR Blank\128]

Is this OK? Is there a better way?

The chips and code work OK in 'non-page write mode'
Sorry if this has been covered before but I can't find it.

Regards Bill Legge

sayzer
- 20th May 2009, 07:25
http://www.picbasic.co.uk/forum/showthread.php?t=8811&highlight=page+write






-----------

Jerson
- 20th May 2009, 08:32
CAUTION:

You should ensure that you write a PAGESIZE worth of data to the EEPROM on a PAGE BOUNDARY. Writing at an arbitrary address within a page may lead to unforseen consequences as the EEPROM wraps around the lower address bits within the same page and may overwrite other data that may be present at those addresses.

Bill Legge
- 20th May 2009, 09:18
Sayzer

Thanks for the code - it works fine.
I was concerned about the amount of memory that a 128 byte array would occupy?

Jerson

Thanks for the note about page boundaries


Bill legge