AnsweredAssumed Answered

Understanding InternalI2C

Question asked by Matthew Smith on Dec 9, 2012
Latest reply on Dec 11, 2012 by Matthew Smith

I am, for the first time, setting up I2C communications to a couple of devices - an MPL115A2 barometer and a Sensiron SHT21 humidity/temperature sensor. Other devices will follow as soon as I have got my head around how this bean works.


Looking through AN3785 for the barometer and example code for the Sensiron part, I am unable to fully reconcile I2C operations with the methods of the InternalI2C bean. Specifically, I can't see how or when a start is sent. I've found that I can send stops manually using SendStop - once I finally located the "Automatic stop condition" in the Advanced view of the Component Inspector. But how do I send a start at the appropriate point? Here's an example from the Sensiron documentation, which I just happen to have open:



error |= I2c_WriteByte (I2C_ADR_W);

error |= I2c_WriteByte (USER_REG_R);


error |= I2c_WriteByte (I2C_ADR_R);

*pRegisterValue = I2c_ReadByte(ACK);


error |= SHT2x_CheckCrc (pRegisterValue,1,checksum);




Easy to see how the functions above map to InternalI2C methods, other than the start condition - of which I can't find a mention in the online documentation. The starts are specified at very specific points but - and I need to know how to make this happen.


Also can't figure out the [Restart] in the AN3785, but am assuming this just means send a start again.