Have you tried scoping the SCL and SDA lines to see if it is really communicating? I2C is a no-brainer - if you get it working the first time.
The address should be declared in a WORD sized variable for the 24LC256. You then use this variable to hold the addresses for access.
Code:
Address var Word ' this will hold the 16 bit word address
EData var Byte ' Eprom data byte for read/write
Address = 5 ' address to access
Edata = $55 ' data to write
I2Cwrite SCL,SDA,$A0, Address, [EData] ' write it
Edata = 0 ' destroy the value before read
I2Cread SCL,SDA,$A0, Address , [EData] ' read it back
if Edata = $55 then Success ' if it compares, You Succeeded
Bookmarks