AnsweredAssumed Answered

Raw Data of MMA8452

Question asked by Sriram V on Nov 25, 2016
Latest reply on Nov 27, 2016 by Tomas Vaverka

I am using a MMA8452 accelerometer. I did not quite understand the following piece of code

 

        data->x = ((tmp_data[0] << 8) & 0xff00) | tmp_data[1];

        data->y = ((tmp_data[2] << 8) & 0xff00) | tmp_data[3];

        data->z = ((tmp_data[4] << 8) & 0xff00) | tmp_data[5];

 

But, MMA8452 has 12 bit samples. Should these again be shifted by 4 bits to the right as tmp_data[1], tmp_data[3], tmp_data[4] have only 4 bits of data?

 

When the Device is Flat. What should be the values of x, y, z.

Outcomes