This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

TWI_I2C_Error

main.cHi,

I am having an issue with I2C transaction in my program.

There are two sensors(Touch and Temp) connected to the I2C bus. Touch sensor is working well when I added Temp senor config, it started showing I2C error.

In my program line 407,408 are used to read Temp sensor. I am always getting error messages on these two line.

Any advise would be much appreciated.

Regards Siva

Parents
  • Well, that certainly wasn't clear from the original question. "Complying" has a very different meaning than "compiling", I'd also suggest including the error when asking for help with a compilation issue. I believe what the compiler is telling you is that 0x80 left shifted one is too large for an 8 bit variable. I2C addresses steal the least significant bit as a R/W indicator so the code is taking your defined address and shifting it 1 bit to allow that to happen.

    If you look at the SHT21 data sheet the I2C address is a 7-bit 0b1000000, so you should be defining your address as 0x40 and then that shift will compile properly.

  • I haven't really dug into that, so I'm not able to help you with that question.

Reply Children
No Data
Related