OK - I have the EEPROMS setup per what has been described, and we can compile and it LOOKS like it sends data to the chips, but I cant' see anything coming back.. I read in 1000 values from 0 to 999 in an 'x' loop, then read them back, and all I see are '0's... Help! I think my naming of the chips is wrong..
Chip is an 16F876A.
I have two chips 24LC515 512k .. I have given them names:
DPIN var PortA.2 ' I2C data
CPIN var PortA.1 ' I2C clock
address var byte
value var byte
Chip1 con %10100000 ' address of chip1
Chip2 con %10100100 ' address of chip2
Init:
PORTA = %00000 'Initialize PortA to all zeros - all output
TRISA = %00000 'All port A output
PORTB = %00000101 'Initialize PortB - port 2 for data, port 0 for button interrupt
TRISB = %00000101 'Port 2 inputs are 0 and 2
T1CON = %01000000 'Timer1 1:1 prescale(?). Timer1 off
----------------------------------------------------------------------
I read and write to them like this: For this demo I only will write 1000 records in each chip.
storedata:
for x = 0 to 1000
i2cwrite dpin,cpin,chip1,x,x
pause 10
serout2 Apinout, 16468, [I,CLR]
serout2 Apinout, 16468, [I,L1_C1]
serout2 Apinout, 16468, ["Writing: C1 ",#x]
Next x
for x = 0 to 1000
i2cwrite dpin,cpin,chip2,x,x
pause 10
serout2 Apinout, 16468, [I,CLR]
serout2 Apinout, 16468, [I,L1_C1]
serout2 Apinout, 16468, ["Writing: C2 ",#x]
Next x
...
...
Readitback:
' read memory contents to screen.
serout2 Apinout, 16468, [I,CLR]
serout2 Apinout, 16468,[I,L1_C1]
Serout2 AGPSout, 16572, ["Memory Dump Chip 1: ", 10,13]
Address =0
p=0
x=0
For p = 1 to 29 ' total sentences storable in memory
serout2 AGPSout, 16572, ["SS ",#p,": "]
for address = X to (X+34)
I2Cread Dpin,Cpin,Chip1, address, value
serout2 AGPSout, 16572, [",",#value]
next address
serout2 AGPSout, 16572, [10,13]
X=X+34
next p
serout2 Apinout, 16468, [I,CLR]
serout2 Apinout, 16468,[I,L1_C1]
Serout2 AGPSout, 16572, ["Memory Dump Chip 2: ", 10,13]
Address =0
p=0
x=0
For p = 1 to 29 ' total sentences storable in 1k
serout2 AGPSout, 16572, ["SS ",#p,": "]
for address = X to (X+34)
I2Cread Dpin,Cpin,Chip2, address, value
serout2 AGPSout, 16572, [",",#value]
next address
serout2 AGPSout, 16572, [10,13]
X=X+34
next p
Return
Bookmarks