Hi:
I have read through several posts on the forum regarding i2c, and I have read the information in the PBP manual.
I have used the following code:
ADDR var byte
ADDR = $07
GOSUB TIME_125
I2CWRITE PORTC.4,PORTC.3,$A0,ADDR,[7]
GOSUB TIME_125
I2CREAD PORTC.4,PORTC.3,$A0,ADDR,[i2c_Data],Fail
GOSUB TIME_125
TIME_125:
FOR Counter = 1 TO 125
Counter = Counter + 1
NEXT Counter
RETURN
;
to try to talk to a 24AA512 EEPROM.
I have an ICD connected and single stepped my way through the code and followed the assembler code as it runs.
I have confirmed with my meter on the chip pins (and leds on SDA SCL) that I am getting the signals to the EEPROM.
I do not appear to be writing and i2c_Data in the read statement returns 0.
I am clearly missing something, but I am not sure what it is.
For this project which is a proto-typer based on a 16F877A, I will also be using i2c to talk to a DS1631 temperature sensor and a DS1307 RTC.
I have a working LCD and 4 7 segment displays working through a MAX7219. My next phase was to get the i2c going before moving on to the One_Wire and iButton devices.
Any suggestions on how to set up the i2c properly would be greatly appreciated.
Thanks
Tim
Bookmarks