SNIS237A December 2024 – April 2025 TMP118
PRODUCTION DATA
Refer to the PDF data sheet for device specific package drawings
The Temp_Result registers use a 16-bit format. Temperature data is represented by a 16-bit 2's complement word with a Least Significant Bit (LSB) equal to 0.0078125°C. The fractional values are included in the temperature readings, which can be denoted using Q notation, a simple way to represent the length of the fractional portion of the value. 2's Compliment is employed to describe negative temperatures. C code can easily convert the 2's Compliment data when the data is typecast into the correct signed data type. For more details on using Q notation to decode digital temperature data, refer to How to Read and Interpret Digital Temperature Sensor Output Data.
Note following power-up or reset, the temperature register reads 0°C until the first conversion is complete. Also note the decoding scheme allows temperature measurement beyond the recommended operating temperature range of -40°C to 125°C, but the device performance is not guaranteed beyond this range.
| Parameter | Value |
|---|---|
| Bits | 16 |
| Q | 7 |
| Resolution | 0.0078125 |
| Range (+) | 255.9921875 |
| Range (-) | -256 |
| 25˚C | 0xC80 |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sign | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 0.5 | 0.25 | 0.125 | 0.0625 | 0.03125 | 0.015625 | 0.0078125 |
| -256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 1/2 | 1/4 | 1/8 | 1/16 | 1/32 | 1/64 | 1/128 |
-28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 2-1 | 2-2 | 2-3 | 2-4 | 2-5 | 2-6 | 2-7 |
C Code Examples:
/* 16-bit format has 0 bits discarded by right shift
q7 is 0.0078125 resolution
the following bytes represent 24.5C */
uint8_t byte1 = 0xC;
uint8_t byte2 = 0x40;
float f = ((int8_t) byte1 << 8 | byte2) * 0.0078125f;
int mC = ((int8_t) byte1 << 8 | byte2) * 1000 >> 7;
int C = ((int8_t) byte1 << 8 | byte2) >> 7;Table 7-3 shows some example temperatures and the converted register values in binary and hexadecimal format. Go to the TMP118 GUI-based code generator to find MCU-agnostic C-code driver.
| TEMPERATURE (°C) | DIGITAL OUTPUT (BINARY) | HEX |
|---|---|---|
| 125 | 0011 1110 1000 0000 | 3E80 |
| 100 | 0011 0010 0000 0000 | 3200 |
| 80 | 0010 1000 0000 0000 | 2800 |
| 75 | 0010 0101 1000 0000 | 2580 |
| 50 | 0001 1001 0000 0000 | 1900 |
| 25 | 0000 1100 1000 0000 | 0C80 |
| 0.25 | 0000 0000 0010 0000 | 0020 |
| 0.0625 | 0000 0000 0000 1000 | 0008 |
| 0.0078125 | 0000 0000 0000 0001 | 0001 |
| 0 | 0000 0000 0000 0000 | 0000 |
| -0.0078125 | 1111 1111 1111 1111 | FFFF |
| -0.0625 | 1111 1111 1111 1100 | FFF8 |
| –0.25 | 1111 1111 1110 0000 | FFE0 |
| –25 | 1111 0011 1000 0000 | F380 |
| –40 | 1110 1100 0000 0000 | EC00 |