1)问题1我正在阅读LIS3DH AN3308的数据表。我怀疑3.2.3的描述(加速数据的例子)。
350(0x15E)mg寄存器数据为Val_0x29 = 0x15,Val_0x28 = E0(左对齐)
BLE没问题
1g(0x400mg)寄存器数据为Val_0x29 = 0x04,Val_0x28 = 0x00
这是正确的例子吗?我认为它应该是Val_0x29 = 0x40,Val_0x28 = 0x00
2)我从st.com下载LIS3DH驱动程序代码
stsw-mems023_LIS3DH Linux OS设备driver.zip
获取加速数据代码如下,
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);
实际上,输出分辨率是12位,而不是16位???
我在LIS2DH数据表中找到了输出分辨率描述
但是没有在LIS3DH,AN3308中找到
3.2.1数据对齐
加速度数据表示为16位数字并且左对齐。
谢谢
#lis3dh数据格式变换
以上来自于谷歌翻译
以下为原文
1) Ques
tion1 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
#lis3dh-data-format