Arduino Forum

Using Arduino => Sensors => Topic started by: ujjwalrathod007 on Aug 17, 2019, 02:51 pm

Title: DPS310 sensor data processing
Post by: ujjwalrathod007 on Aug 17, 2019, 02:51 pm
 :)  :)

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.
Title: Re: DPS310 sensor data processing
Post by: ujjwalrathod007 on Aug 18, 2019, 05:30 pm
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..
Title: Re: DPS310 sensor data processing
Post by: knut_ny on Aug 19, 2019, 12:00 pm
top of page 15 ..
datasheet (https://www.infineon.com/dgdl/Infineon-DPS310-DS-v01_00-EN.pdf?fileId=5546d462576f34750157750826c42242)