So the 20 bit altitude value consists of 2 bytes with a 2-s complement signed number, and 4 bits in the third byte representing fractions of a metre as an unsigned number. | So if I go to Death Valley and the first two bytes are -30 metres and the fractional bits in the 3rd byte amount to 0.6 metres, does that make the total result to be -30.6 metres or -29.4 metres ? |

Hello,

The fractional component needs to be added to the integer component, so the result would be -29.4 meters.

Let’s consider another example:

OUT_P_MSB = 0xFF

OUT_P_CSB = 0xFF

OUT_P_LSB = 0xF0

The integer component is -1, the fractional component 0.9375 ((0xF0 >> 4) * 0.0625) and the resulting altitude -1 + 0.9375 = -0.0625 meters.

You can find a simple example code for the MPL3115A2 working in the Altimeter mode in this document.

I hope it helps.

Regards,

Tomas