Other Parts Discussed in Thread: TMP006, TMP116
Hi,
If I am using TMP006 or TMP007 with the i2ctmp driver example program, it seems that the multiplier to convert to Celsius is wrong, because according to datasheet Celsius per LSB is 0.03125.
/* Take 20 samples and print them out onto the console */
for (sample = 0; sample < 20; sample++) {
if (I2C_transfer(i2c, &i2cTransaction)) {
/*
* Extract degrees C from the received data;
* see TMP116/006 datasheet
*/
temperature = (rxBuffer[0] << 8) | (rxBuffer[1]);
temperature *= 0.0078125;
/*
* If the MSB is set '1', then we have a 2's complement
* negative value which needs to be sign extended
*/
if (rxBuffer[0] & 0x80) {
temperature |= 0xF000;
}
Display_printf(display, 0, 0, "Sample %u: %d (C)",
sample, temperature);
}
else {
Display_printf(display, 0, 0, "I2C Bus fault.");
}
/* Sleep for 1 second */
sleep(1);
}
-kel