Nope, you still missed that cigar... but you're close...
StorePage var word
StartAddress var Word
StoreData:
StartAddress=StorePage*64
I2CWRITE SDA,SCL,EE_addr,StartAddress,[str data1\64]
Return
Consider the above subroutine. Before it is called, you set the Page Number that you wish to store your 64 bytes of data into. Since you wish only to store 3 pages, the variable StorePage can be 0, 1 or 2, but in fact for the 24LC256 can be any number between 0 and 511 (max 512 pages as you said).
The first line takes the Page number and converts it to a linear address pointer, so that for example, if your Page is zero, the address will point to zero. Page=1 then Address=64. Page=2 then Address=128 and so on...
The I2CWRITE line will save 64 bytes in one hit from your array data1 (providing your EE_addr is set correctly).
That's it... all there is to it.
To read back, just preset your StorePage accordingly and create a similar ReadData subroutine using I2CREAD...
Melanie
Bookmarks