I2C without using XC32 library

Master Fast Read (no write of regsiter address first) #define MEMS_SENSOR_I2C_MASTER_IRQ_FLAG 0x0080 i2c_comms_failed = 0; //—– SEND THE START CONDITION —– I2C4CON |= 0x0001; //Set SEN while (I2C4CON & 0x0001) //Wait for SEN to clear ; //—– SEND THE I2C DEVICE ADDRESS WITH THE READ BIT SET —– IFS1 &= ~MEMS_SENSOR_I2C_MASTER_IRQ_FLAG; I2C4TRN = (MEMS_SENSOR_B_I2C_ADDRESS | […]

Read More

I2C Master

The legacy versions of Plib I2C has code for I2C1 and I2C2 only.  When you try and use fro I2C3, I2C4 etc you're buggered.  You have to use the modern I2C functions instead which is just great because they are horribly documented and don't have direct equivalents for things like IdleI2C1(). Setup I2C Bus //—– SETUP […]

Read More