Other Parts Discussed in Thread: HALCOGEN
Hi, I have question about I2C Code.
I was looking the example and I've tried to write my own code.
i2cSetSlaveAdd(i2cREG1, Slave_Address); /*Configure address of Slave to talk to*/
i2cSetDirection(i2cREG1, I2C_TRANSMITTER); /*Set direction to Transmitter*/
i2cSetCount(i2cREG1, 1); /*Configure Data count*/
i2cSetMode(i2cREG1, I2C_MASTER); /*Set mode as Master*/
i2cSetStop(i2cREG1); /*Set Stop after programmed Count*/
i2cSetStart(i2cREG1); /*Transmit Start Condition*/
i2cSendByte(i2cREG1, 0x00);
while(i2cIsBusBusy(i2cREG1) == true); /*wait until Bus Busy is cleared*/
while(i2cIsStopDetected(i2cREG1) == 0); /*wait until Stop is detected*/
i2cClearSCD(i2cREG1);
i2cSetSlaveAdd(i2cREG1, Slave_Address); /*Configure address of Slave to talk to*/
i2cSetDirection(i2cREG1, I2C_RECEIVER); /*Set direction to receiver*/
When i started my application, it waited on 'while(i2cIsStopDetected(i2cREG1) == 0);' code.
I followed HALCoGen's example.
What shall i fix for?
Thanks
Anthony