0

I'm trying to get the pressure from a sensor using I2C but I'm not sure on the C code. So far I have this:

I2C1_MasterRead(&PressureData, 2, I2C_ADDR_DS, &status);

Where Pressure data is an 8 bit unsigned integer, the data is 2 bytes long, the address of the sensor, followed by what I think is a stop bit.

Does anyone have experience and can help me out?

Finners
  • 37
  • 7
  • 1
    It is probably easiest to start with an example, maybe this one: https://www.microchip.com/forums/m843185.aspx – Ctx Feb 18 '20 at 12:30
  • 4
    Far too broad to be answered. It all depends on the specific hardware, the schematic and so on. – Lundin Feb 18 '20 at 13:46
  • `PressureData` should be 2 bytes long, because you try to read 2 bytes. If it is only one byte (u8) then second byte will be lost. – Mubin Icyer Feb 18 '20 at 13:58

0 Answers0