IIS2DLPC accelerometer data conversion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-07-18 6:49 PM
Hi:
According to the IIS2DLPC datasheet and STMems_Standard_C_drivers are as follows
According to the IIS2DLPC datasheet, it seems that the iis2dlpc_reg.c needs to be corrected, such as the red text comment?
float_t iis2dlpc_from_fs2_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.061f;
//return ((float_t)lsb) * 0.244f;
}
float_t iis2dlpc_from_fs4_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.122f;
//return ((float_t)lsb) * 0.488f;
}
float_t iis2dlpc_from_fs8_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.244f;
//return ((float_t)lsb) * 0.976f;
}
float_t iis2dlpc_from_fs16_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.488f;
//return ((float_t)lsb) * 1.952f;
}
float_t iis2dlpc_from_fs2_lp1_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.061f;
//return ((float_t)lsb) * 0.976f;
}
float_t iis2dlpc_from_fs4_lp1_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.122f;
//return ((float_t)lsb) * 1.952f;
}
float_t iis2dlpc_from_fs8_lp1_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.244f;
//return ((float_t)lsb) * 3.904f;
}
float_t iis2dlpc_from_fs16_lp1_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.488f;
//return ((float_t)lsb) * 7.808f;
}
thanks
Solved! Go to Solution.
- Labels:
-
Accelerometers
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-07-20 1:34 AM
Hi @Myles ,
Welcome to ST Community!
Drivers are correct. The coefficient values reported in the PID are considering the sensitivity and the shift of 2/4 bit to have data in right giustified according to the resolution, as written in Datasheet (pg 20 Table 11):
Data are always represented in 16 bit and they need to be shift by 2 or 4 according to the power mode (es: in High Performance mode, FS=2g you need to divide 0.244 by 4 = 0.061).
If my reply answered your question, please click on Accept as Solution at the bottom of this post. This will help other users with the same issue to find the answer faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-07-20 1:34 AM
Hi @Myles ,
Welcome to ST Community!
Drivers are correct. The coefficient values reported in the PID are considering the sensitivity and the shift of 2/4 bit to have data in right giustified according to the resolution, as written in Datasheet (pg 20 Table 11):
Data are always represented in 16 bit and they need to be shift by 2 or 4 according to the power mode (es: in High Performance mode, FS=2g you need to divide 0.244 by 4 = 0.061).
If my reply answered your question, please click on Accept as Solution at the bottom of this post. This will help other users with the same issue to find the answer faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-07-20 6:11 PM
I figured it out, thanks for clearing up my doubts!
