PDA

View Full Version : Page write (I2CWRITE)



Tomas
- 5th April 2004, 01:05
Hi,

I want to Write pages of my 24LC256 using the routine below:

For B0 = 0 to 32767 step 64
Lcdout $fe,1, "Writing ch0"," ",#ch0
for x = 0 to 64 step 2
ADCIN 0, ADCresult
ch0[x] = ADCresult.lowByte
ch0[x+1] = ADCresult.HighByte
'Pause 10
next x
EE_addr = $A0
i2cwrite SDA,SCL,EE_addr,B0,[str ch0\64]
Pause 10
next b0
Return

First i take sample and then store the result. The problem is when i do it again, i think, i overwrite the previous data.

What i want to do is, first store in the first page of the EEPROM(0 to 63) then next round when i come back to the the routine i want to store in the next page (64 to 127) and so on. Finally by using I2CREAD i want to read the data from the corresponding location.
How can i do that? How can i access each address of the EEPROM(this is for another problem).
I tried to increment the "page pointer" but the result was unexpexted.
something like:
cnt = cnt + 64
cntd = cntd + 128
for eePointer = cnt to cntd
I2CWRITE . . .

Cheers,
Tom