Hi all.
I need what might be some basic help with some I2C code.
I have a SP03 module and the I2C specs for that are on http://www.robot-electronics.co.uk/htm/Sp03doc.shtml
I am using a 16f877 with 20 mhz crystal. Basically for now I need to read the command status? Can anyone offer a suggestion? Also are the pins I have selected to use for Data and Clock ok on the 877 or should I be using specific pins? Do they need pull up resistors? I have tried different varioations of code and can't get a response....
My code
DEFINE OSC 20
define i2c_slow 1' Tried this as a test
Wdog Var Portb.7
DPIN var PORTB.6 ' I2C data pin
CPIN var PORTB.5 ' I2C clock pin
talk var portd.2 ' Indicate still busy
NOP CON 0
B1 var byte
High talk 'Unit talks on power up. So indicate
loop:
Toggle wdog
pause 200
I2CREAD DPIN,CPIN,$C4,[B1] 'Read if still talking
if b1 > 0 then goto loop
low talk
goto loop
Bookmarks