2021-01-22 08:30 PM
2021-01-28 08:52 AM
Hi @Gk.1 ,
you can of course find the LSB-to-physical-unit conversion formula on the datasheet or on the app note.
You can refer to the C drivers on Github, and in particular the lis2dw12_reg.c:
float_t lis2dw12_from_fs2_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.061f;
}
-Eleon
2021-01-23 10:28 AM
Isn't that in the LIS2DW12 datasheet?
2021-01-28 08:52 AM
Hi @Gk.1 ,
you can of course find the LSB-to-physical-unit conversion formula on the datasheet or on the app note.
You can refer to the C drivers on Github, and in particular the lis2dw12_reg.c:
float_t lis2dw12_from_fs2_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.061f;
}
-Eleon
2023-03-24 08:57 AM
Hello @Eleon BORLINI,
I'm not sure where the value 0.061 come from. I can't find it in the datasheet or app note. What I can find are these values (in the datasheet):
And these others from the app note(which are the same):
Perhaps in the C driver there's some scaling? Could you please explain further, perhaps I'm missing something?
C driver:
/**
* @defgroup LIS2DW12_Sensitivity
* @brief These functions convert raw-data into engineering units.
* @{
*
*/
float_t lis2dw12_from_fs2_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.061f;
}
float_t lis2dw12_from_fs4_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.122f;
}
float_t lis2dw12_from_fs8_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.244f;
}
float_t lis2dw12_from_fs16_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.488f;
}
float_t lis2dw12_from_fs2_lp1_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.061f;
}
float_t lis2dw12_from_fs4_lp1_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.122f;
}
float_t lis2dw12_from_fs8_lp1_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.244f;
}
float_t lis2dw12_from_fs16_lp1_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.488f;
}
2023-03-24 09:15 AM
Hi @NEche.1 ,
since the data in the Github formulas, to convert from 16-bit to 14-bit you have to divide for 2^2 = 4, i.e. a shift left of two positions.
This is the same as:
float_t lis2dw12_from_fs2_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.244f / 4;
}
-Eleon