cancel
Showing results for 
Search instead for 
Did you mean: 

IIS2DH data convert data to g

247950665
Associate
Posted on June 06, 2016 at 03:14

I'm using IIS2DH, I config it to normal mode, so It's 10bit resolution, and I got 16bit data for each axis, now I right shift the 16bit data to get a 10bit data, and the range is 0-1023, is that right?

but

And if I keep the board horizontal, I got the Z = 125*7.81mg/digit= 1g, it's right, but if I reverse the board, the ideal Z should be -g, right? But I got the data which is 905, so Z = 905*7.81mg/digit = 7g, it's not right, I can't find  details about how to convert data to g in the website, who can help me ?

#data-convert #g #iis2dh
1 REPLY 1
Miroslav BATEK
ST Employee
Posted on June 30, 2016 at 10:02

Hello,

your data are correct but the decoding is not. The data are stored as Two's complement. Please refer to:

https://en.wikipedia.org/wiki/Two%27s_complement

or

http://stackoverflow.com/questions/1049722/what-is-2s-complement

Best regards

Miroslav