I still can't get the I2CRead/Write to work with this EEPROM and I have used them with other PICs in the past with no problems. I used my Logic Analyzer to capture both the Shiftin/out and the I2CRead/Write examples. I could follow the working Shiftin/out on the Logic analyzer, but the I2C is either faster than I can capture, or completely messed up. I am using the same program to test both routines.
I just tried uploading the analyzer screenshots, but it said I didn't have permissions.
This code works:
Test_ShiftOut: ' Write "A" byte to EEPROM at Location 0
ADDR_HB = 0
ADDR_LB = 0
Char = "A"
GOSUB INT_ROM
SHIFTOUT DPIN,CPIN,1,[Char\8,%1\1]
GOSUB STOP_ROM
PAUSE 10
Return
Test_ShiftIn:
GOSUB INT_ROM
GOSUB START_ROM
SHIFTOUT DPIN,CPIN,1,[ExtMem0R]
SHIFTIN DPIN,CPIN,0,[ACK\1,Char\8]
SHIFTOUT DPIN,CPIN,1,[%1\1]
GOSUB STOP_ROM
Return
INT_ROM:
GOSUB START_ROM
SHIFTOUT DPIN,CPIN,1,[ExtMem0W]
SHIFTIN DPIN,CPIN,0,[ACK\1]
SHIFTOUT DPIN,CPIN,1,[ADDR_HB]
SHIFTIN DPIN,CPIN,0,[ACK\1]
SHIFTOUT DPIN,CPIN,1,[ADDR_LB]
SHIFTIN DPIN,CPIN,0,[ACK\1]
RETURN
START_ROM:
HIGH CPIN:HIGH DPIN:LOW DPIN
RETURN
STOP_ROM:
HIGH CPIN:LOW DPIN:HIGH DPIN
RETURN
This code doesn't work:
Char = "A"
I2CWRITE DPIN,CPIN,ExtMem0,ADDR,[Char]
Pause 10
I2CREAD DPIN,CPIN,ExtMem0,ADDR,[Char]
The analyzer shows the I2C commands to be much faster. Maybe the EEPROM is too slow?





Bookmarks