Quote Originally Posted by alik View Post
I wish to increase the memory capacity in a device by adding multiple eeproms (24LC512), so that when the memory becomes 90% full it switches to the next eeprom by removing the power, i guess i could do this by sharing the sda/scl/gnd with all the eeproms and supply the vcc as a high output from a port on a pic 16f876. the question is what code would i use to know when the memory was 90% full or even 100%.
any help would be appreciated.
Thank you
Although I do not know of a way to "automatically" detect when it is full, it should be quite easy. Presumably, if you are building the board and coding the PIC, you know what size the eeprom is and how much you have already written to it. Something simple like this, just before your write command...

if MemoryAddress > $ffff - WRITESIZE then
MemoryAddress = 0
WriteAddress = WriteAddress + 1
if WriteAddress > MaxWriteAddress then goto FullTimeSleep
Endif