DPS310 sensor data processing

:slight_smile: :slight_smile:

I am working with DPS310 with I2C communication.

The datasheet of my sensor says that temperature value is stored in 24bit 2's complement format.

my question is that will it be signed value or unsigned values?

I assumed unsigned and make my code. for 2's complement conversion to the original value, I used value^0xffffff. and then add 1 to it. Is it the right procedure for data stored in int data type?

currently, I have a very large value of temperature which is impossible.

I tried some troubleshooting

I took 3 byte data type and read the temperature registers

They are as 1,115,246 in decimal... I contvert it from 2's complement manually and got 24-bit value as 16681994 then devided the number by 524288 as I have single precision.

So got something like 31, put that into the equation 1937-293*(31). which is not the right value I should get..

top of page 15 ..