2020-04-06 08:50 AM
Hi,
I am developing a device that uses the accelerometer/magnetometer LSM303AGR.
The problem is that datasheet doesn´t comment about temperature sensibility (For example: Sensitivity = 16 LSB/°C in lis2dtw12)
Could anyone give me an equation to convert the output temperature for the temperature registers of the LSM303AGR to Celisus Degrees?
Thanks in advance
2020-04-06 09:24 AM
Hi @Jorge González , you can refer to the github C drivers for the LSM303AGR device, provided by ST (LINK)
float_t lsm303agr_from_lsb_nm_to_celsius(int16_t lsb)
{
return ( ( (float_t)lsb / 64.0f ) / 4.0f ) + 25.0f;
}
The datasheet (p. 15 and 46) reports that the temperature value is in 8-bit resolution and is obtained concatenating the OUT_TEMP_L_A (0Ch) and the OUT_TEMP_H_A (0Dh) registers, two's complement conversion on 16bit, 1°C per LSB centered around the typical test temperature, 25°C. For this reason, you see the 64*4 = 2^8 division (8bit), the float casting (two's complement) and the 25°C sum.
Regards