Need help with I2C syntax problem?
Hello everyone. I've been going crazy a few hours now, trying to get my code to compile an i2cwrite command. No matter what I do, whenever the i2cwrite line is in the code I get the following compile errors
67:[226] numeric constant or symbol name expected
67:[201] ')' expected
67:[212] extra tokens on end of line
67:[300] too many errors
Here is a snippet of my code that compiles fine without the i2cwrite line:
Define OSC 4
ansel = 0
anselh = 0
TrisA = 0
TrisB = 0
TrisC = 0
CCP1CON = 0
DEFINE DEBUG_BIT 7 'Set DEBUG pin
DEFINE DEBUG_BAUD 2400 'Set DEBUG baud rate
DEFINE DEBUG_MODE 1 'Set DEBUG mode inverted
'DEFINE I2C_HOLD 1
I2CDataPIN VAR PortB.4 ' I2C data pin
I2CClockPIN VAR PortB.6 ' I2C clock pin
srfdevice VAR BYTE 'FOR SRF02 preprogrammed adress $E0
srfdevice = $E0
srfregister0 VAR byte 'register 0 is the COMMANDregister of the SRF02
srfregister0 = $00
cmcommand VAR byte
cmcommand = 81 '$51 = 81 = Ranging command for results in cm
Main:
i2cwrite I2CDatapin,I2CClockpin,srfdevice,srfregister0,[cmcommand]
'this is where I have my problem
pause 1000
GOTO Main
Please can someone confirm if I have a syntax error. Thanks...
-mike