cancel
Showing results for 
Search instead for 
Did you mean: 

Temperature reading from IIS3DWB

Balanceman
Associate

Can't figure out how to read or interpret the temperature reading from this MEM.

I read the two register 20h and 21h and get an answer like this:

RM20h02h14FFh

The very brief description in the spec sheet did not help me.

Has anyone a hint?

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @Balanceman​ , I suggest you to check the datasheet p.7 together with the online C drivers for IIS3DWB on Github, especially the iis3dwb_reg.c source code:

float_t iis3dwb_from_lsb_to_celsius(int16_t lsb)
{
  return (((float_t)lsb / 256.0f) + 25.0f);
}

In you case, if I well understand:

  • REG 20h (OUT_TEMP_L) value --> 14h
  • REG 21h value (OUT_TEMP_H) --> FFh

You have to:

  1. Concatenate the two registers, starting from MSB --> FF14h
  2. Transpose to decimal using two's complement conversion --> -236
  3. Divide by temperature sensitivity (256 LSB/°C) --> -0.922°C
  4. Sum 25°C (the default temperature calibration), and you'll get about --> 24.08°C

Regards