I'm having trouble deciding how I should convert the value stored in the fractional part (bits 4-5) of the OUT_P_LSB for CTRL_REG_1 & ALT == 0 (a.k.a. the output pressure should be in pascals). The datasheet states that the value of the OUT_P is in unsigned Q18.2 format which should mean that bit 5 of the OUT_P_LSB would represent 2^-1 (a.k.a. 0.5) place while bit 4 of OUT_P_LSB would represent the 2^-2 place (a.k.a. 0.25)? However, it seems that Table 3 in AN4519 shows the exact opposite.
Is this a problem with the table, or am I completely wrong in my understanding of Q number formats?
Solved! Go to Solution.
Hi,
You are right. In barometer mode (ALT bit = 0), bit 5 of the OUT_P_LSB register represents 0.5 Pa while bit 4 corresponds to 0.25 Pa. Table 3 indeed shows the exact opposite and I have already asked the responsible team for correction. Sorry for any inconvenience this may caused.
You might find useful my example code where I illustrate, among others, how to convert the 20-bit data from registers 0x01 – 0x03 to real values in Pascals.
I hope it helps.
Regards,
Tomas
PS: If my answer helps to solve your question, please mark it as "Correct" or “Helpful”. Thank you.
Hi,
You are right. In barometer mode (ALT bit = 0), bit 5 of the OUT_P_LSB register represents 0.5 Pa while bit 4 corresponds to 0.25 Pa. Table 3 indeed shows the exact opposite and I have already asked the responsible team for correction. Sorry for any inconvenience this may caused.
You might find useful my example code where I illustrate, among others, how to convert the 20-bit data from registers 0x01 – 0x03 to real values in Pascals.
I hope it helps.
Regards,
Tomas
PS: If my answer helps to solve your question, please mark it as "Correct" or “Helpful”. Thank you.
Also, in section 7.1.3 of the datasheet, it states that the temperature is in signed Q12.4 format. However, there are only 8-bits specifying the non-fractional part in the OUT_T_MSB. Is this too a mistake? I think it should be signed Q8.4 if this is using Q number formats?
You are right again, thanks for pointing it out, it will be corrected in the next data sheet revision.
The 12-bit temperature measurement in degrees Celsius is comprised of a signed integer component and a fractional component. The signed 8-bit integer component is located in the OUT_T_MSB register (0x04) and the fractional component in bits 7-4 of the OUT_T_LSB register (0x05). It obviously corresponds to the Q8.4 format.
Regards,
Tomas
Thanks for the link and quick response!