Andres Rodriguez
New Member
After I write to the EEPROM I read from the same address and the value read is allways 0.
I am using the following code for a 28X1 chip:
I am using the following code for a 28X1 chip:
Code:
MEMDEVICE = %10100000 'First 24LC256 EEPROM, Second will be %10100010 and Third %10100100
CLKDEVICE = %11010000 ' RTC DS3232
MEMAD = 0
StartRead:
i2cslave CLKDEVICE,i2cfast,i2cbyte 'Select RTC DS3232
readi2c $00,(b0,b1) 'Read seconds and minutes
i2cslave MEMDEVICE,i2cfast,i2cword 'Select EEPRM
writei2c MEMAD, (b0,b1) 'Store time
pause 500
'Measure temperature
High CS 'idle
Low SCK
Low CS 'start transmission sequence
DAT = 0
For N = 1 to 16
High SCK
DAT = DAT * 2 + MISO
Low SCK
Next N
High CS 'terminate the transmission
DAT = DAT / 8 'use only the 13 most sig bits
MEMAD=MEMAD+2
writei2c MEMAD, (DAT)
readi2c MEMAD, (DAT)
Pause 500