hey! its working,
the problem i was having was in declaring tris when reading/writing to the memory. ive got it working now and am very happy. thankyou all for the help, heres my current code,
trisb=%00000010 'read i comment one out
'trisb=%00000001 'write
addr var byte
sda var PORTB.0
scl var PORTB.1
cont con %10100000
x var byte 'test data
y var byte 'read data
'x=%00000001 'test data is the number 0'
addr=0
loop:
'I2Cwrite sda,scl,cont,(addr),[x] 'comment out when reading
'pause 20
i2Cread sda,scl,cont,addr,[y] 'should read the data
pause 20
serout portb.2,4,[254,1]
serout Portb.2,4,["y=",#y," x=",#x," a=",#addr] 'visual verification
addr=addr+1
'x=x+%00000001
if addr=255 then end
goto loop
end
Bookmarks