Depend on the datasheet , when c12 = 38CCh, how to change c12 to 0.00086665??
I have to admit that computation of some coefficients might be a bit unclear.
First, it is necessary to take into account how the coefficients are stored in registers 0x04 – 0x0B and that are coded in 2’s complement notation.
As for the c12 coefficient, the last two bits of the c12 LSB are zero as shown on page 7 of the MPL115A1 datasheet:
c12 MSB byte = c12[13:6] = [b13 , b12 , b11 , b10 , b9 , b8 , b7 , b6]
c12 LSB byte = c12[5:0] & “00” = [b5 , b4 , b3 , b2 , b1 , b0 , 0 , 0]
... and the c12 coefficient is formatted as follows:
c12 = b13 . 000 000 000 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
Considering our example, the 16-bit c12 = 0x38CC.
Then b12 .. b0 = 0b011 1000 1100 11 = 3635
and c12 = 3635 / 2^22 = 0.00086665
I hope it makes sense.
Retrieving data ...