Skip to main content
Visitor II
October 25, 2019
Question

IIS2DLPC temperature sesnor 12 bit value. How to convert from 12 bit raw value to °C?

  • October 25, 2019
  • 1 reply
  • 816 views

How can i convert 12 bit raw value from 0x0D & 0x0E to degree celsius?

    This topic has been closed for replies.

    1 reply

    ST Employee
    October 25, 2019

    Hi @User_of_Sensor​ , you have first to concatenate the OUT_T_L (0Dh) and the OUT_T_H (0Eh) register (16 bits). Then you consider only the first 12 bits, converting it in decimal value using 2's complement, divide for the sensitivity of 16LSB/°C and finally sum it to 25°C. You can find the driver code here

    float_t iis2dlpc_from_lsb_to_celsius(int16_t lsb)
    {
     return (((float_t)lsb / 16.0f) + 25.0f);
    }

    Regards

    Visitor II
    October 28, 2019

    Hello @Eleon BORLINI​ ,

    Thank you for the reply. It works! Great

    Best regards,