
232DTT1795 Manual
Chapter 3
5
B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 434-7094
Chapter 3. 232DTT Data Format
The DTT uses 9-bit, two’s complement format to represent
temperature data. The ninth bit is the sign bit. If this bit is a 0, the
temperature is above 0
°
C. If the bit is 1, the temperature is less
than 0
°
C. Each bit represents 1/2
°
C.
Two’s complement format provides a way for digital devices
to handle negative numbers. To convert the two’s complement value
to a meaningful number representing temperature, follow these
steps:
1. Check bit nine. In our case this is the entire first character. If the
character is decimal 0 (NUL), then the value in the second
character is positive and no further complementing is necessary,
go to step 6. If character is decimal 1, then continue with step 2.
2. Use the NOT function of your programming language to invert
(or complement) the value in the second character.
3. We need to insure that we are only dealing with an eight bit
variable. You may be able to define this in your programming
language. To be sure, we can use the AND function to limit our
new value to only eight bits by ANDing the value from step 2
with FFh. This masks off all but the lowest eight bits.
4. Add a 1 to the value from step 3. This completes the two’s
complement portion of the conversion.
5. Multiply our new value by -1. This simply adds the “-” sign to our
temperature reading.
Table 2. Temperature/Data Relationships
Temperature
DTT output
hex value
dec value
+125
°
C
0 11111010
00 FAh
250
+25
°
C
0 00110010
00 32h
50
1/2
°
C
0 00000001
00 01h
1
0
°
C
0 00000000
00 00 h
0
-1/2
°
C
1 11111111
01 FFh
511
-25
°
C
1 11001110
01 CEh
462
-55
°
C
1 10010010
01 92h
402