TheDirty 33 Posted February 8, 2011 Share Posted February 8, 2011 The error in the code is mentioned here: http://www.rcgroups.com/forums/showthread.php?t=1197534 This is the code the I finally settled on in my own test project: //calculate the temperature x1 = (ut - ac6) * ac5 >> 15; x2 = ((int32_t) mc << 11) / (x1 + md); b5 = x1 + x2; *t = (b5 + 8) >> 4; //calculate the pressure b6 = b5 - 4000; x1 = (b2 * (b6 * b6 >> 12)) >> 11; x2 = ac2 * b6 >> 11; x3 = x1 + x2; b3 = (((int32_t) ac1 * 4 + x3) << BMP085_OSS) >> 2; x1 = ac3 * b6 >> 13; x2 = (b1 * (b6 * b6 >> 12)) >> 16; x3 = ((x1 + x2) + 2) >> 2; b4 = (ac4 * (uint32_t) (x3 + 32768)) >> 15; b7 = ((uint32_t) up - b3) * (50000 >> BMP085_OSS); *p = b7 < 0x80000000 ? (b7 * 2) / b4 : (b7 / b4) * 2; x1 = (*p >> 8) * (*p >> 8); x1 = (x1 * 3038) >> 16; x2 = (-7357 * *p) >> 16; *p = *p + ((x1 + x2 + 3791) >> 4); Quote Link to post Share on other sites
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.