SNIS233A February 2024 – July 2024 TMP110
PRODUCTION DATA
The TMP110 temperature registers use a 12-bit format. The 12 bits are aligned to the left side, or most significant side, of the 16-bit word. The four unused bits are on the right side, or least significant side. For this reason, a shift is needed to discard the extra bits. 2’s Complement is employed to describe negative temperatures. C code can easily convert the 2’s Complement data when the data is typecast into the correct signed data type. Q notation describes the number of bits which represent a fractional result. 4 bits of fractional data, known as Q4, offers 0.0625°C resolution.
PARAMETER | VALUE |
---|---|
Bits | 12 |
Q | 4 |
Resolution | 0.0625 |
Range (+) | 127.9375 |
Range (–) | -128 |
25˚C | 0x0190 |
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Sign | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 0.5 | 0.25 | 0.125 | 0.0625 | - | - | - | - |
-128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 1/2 | 1/4 | 1/8 | 1/16 | - | - | - | - |
-27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
2-1 |
2-2 |
2-3 |
2-4 |
- | - | - | - |
/* 12-bit format will have 4 bits discarded by right shift
q4 is 0.062500 resolution
the following bytes represent 24.5C */
uint8_t byte1 = 0x18;
uint8_t byte2 = 0x80;
float f = (((int8_t) byte1 << 8 | byte2) >> 4) * 0.0625f;
int mC = (((int8_t) byte1 << 8 | byte2) >> 4) * 1000 >> 4;
int C = (int8_t) byte1;
Similarly, in extended mode, the temperature register is extended to a 13-bit format with the same resolution (Q4). This changes the range and effective bits but the resolution remains the same. For this reason, the bit shift also changes. Encoding and C code examples for extended mode are shown below.
PARAMETER | VALUE |
---|---|
Bits | 13 |
Q | 4 |
Resolution | 0.0625 |
Range (+) | 255.9375 |
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 | - | - | - |
-256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 1/2 | 1/4 | 1/8 | 1/16 | - | - | - |
-28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
2-1 |
2-2 |
2-3 |
2-4 | - | - | - |
/* 13-bit format will have 3 bits discarded by right shift
q4 is 0.062500 resolution
the following bytes represent 24.5C */
uint8_t byte1 = 0xC;
uint8_t byte2 = 0x40;
float f = (((int8_t) byte1 << 8 | byte2) >> 3) * 0.0625f;
int mC = (((int8_t) byte1 << 8 | byte2) >> 3) * 1000 >> 4;
int C = (((int8_t) byte1 << 8 | byte2) >> 3) >> 4;