Hi,
I have used I2CREAD and I2CWRITE in order to write to and read from the 24LC256 EEPROM. As example code i'm using I2CX.bas with the byte address changed to WORD.
I have connected the two wires in I2C protocol as follows:
SCL var PORTC.3 ' Clock pin
SDA var PORTC.4 ' Data pin
These two pins according to the 24LC256 data sheet are not supposed to be HIGH as the same time. However after lodding the .HEX file the pins were constantly HIGH. The conde looks like this:
For B0 = 0 To 15 ' Loop 16 times
B1 = B0 + 100 ' B1 is data for SEEPROM
I2CWRITE SDA,SCL,$A0,B0,[B1] ' Write each location
Pause 10 ' Delay 10ms after each write
Next B0
Loop: For B0 = 0 To 15 Step 2 ' Loop 8 times
I2CREAD SDA,SCL,$A0,B0,[B1,B2] ' Read 2 locations in a row
Lcdout $fe,1,#B0,": ",#B1," ",#B2," " ' Display 2 locations
Pause 1000
Next B0
Goto loop
Finally when running all i can see is the address incrementing by 2 and the two data variables B1 and B2 were just 0.
Can anyone see what the problem is? Please help. Thanks for you time in advance.
Tom
Bookmarks