SparkFun Electronics will be closed on July 3rd, 2015 in observance of Independence Day. Any orders placed after 2:00pm MT on July 2nd will be shipped out after the weekend. Thanks!


Member Since: July 9, 2009

Country: Switzerland

  • Thank you. But 2 lines further down he “gets rid of the decimal portion”. If a sign conversion of the decimal part is necessary, of course he will not bother to do it, but I want to keep the decimal part and am still unsure if I need to do a sign conversion or not. But okay, looking again, float tempcsb = (lsb>>4)/16.0; float altitude = (float)( (msb << 8) | csb) + tempcsb; tells me not to sign convert the altitude decimals, but just scale them and add them to the signed integral part.

  • Hi, From the datasheet: The Altitude data is arranged as 20-bit 2’s complement value in meters. The data is stored as meters with the 16 bits of OUT_P_MSB and OUT_P_CSB and with fractions of a meter stored in bits 7-4 of OUT_P_LSB. Be aware that the fractional bits are not signed, therefore, they are not represented in 2’s complement. Does somebody know how this is to be understood? Should I take the fractional part (LSB/256 units) and add it to the signed integral part? Or should I take the fractional part (LSB/256 units), multiply it by the sign of the integral part, then add the two? I don’t have the part here so I cannot just try.. Thank you Regards Soren

No public wish lists :(