AnsweredAssumed Answered

Question about LIS3DH acceleration data

Question asked by nianjiong.xia on Jan 27, 2015
Latest reply on Jan 28, 2015 by Gav
 1) Question1 I am reading the the data sheet of LIS3DH AN3308.  I doubt about the description of 3.2.3(Example of accleration data).
350(0x15E)mg register data is Val_0x29 = 0x15, Val_0x28 = E0 (left-justified)
It is OK of BLE
1g(0x400mg) register data is Val_0x29 = 0x04, Val_0x28 = 0x00
Is it correct example?? I think it should be  Val_0x29 = 0x40, Val_0x28 = 0x00

2) I download LIS3DH driver code from st.com 
stsw-mems023_LIS3DH Linux OS device driver.zip

the get acceleration data code is as the following,
     acc_data[0] = (AXISDATA_REG); 
     err = lis3dh_acc_i2c_read(stat, acc_data, 6);

     hw_d[0] = (((s16) ((acc_data[1] << 8) | acc_data[0])) >> 4);
     hw_d[1] = (((s16) ((acc_data[3] << 8) | acc_data[2])) >> 4);
     hw_d[2] = (((s16) ((acc_data[5] << 8) | acc_data[4])) >> 4);
In fact, the output resolution is 12bit, not 16bit ???
I found the output resolution description at LIS2DH data sheet
But not found at LIS3DH, In AN3308
3.2.1 Data alignment
    Acceleration data are represented as 16-bit numbers and are left justified.

Thanks
 

Outcomes