DS18B20
5 of 27
OPERATION - MEASURING TEMPERATURE
The core functionality of the DS18B20 is its direct-to-digital temperature sensor. The resolution of the
DS18B20 is configurable (9, 10, 11, or 12 bits), with 12-bit readings the factory default state. This
equates to a temperature resolution of 0.5°C, 0.25°C, 0.125°C, or 0.0625°C. Following the issuance of
the Convert T [44h] command, a temperature conversion is performed and the thermal data is stored in
the scratchpad memory in a 16-bit, sign-extended two’s complement format. The temperature
information can be retrieved over the 1-Wire interface by issuing a Read Scratchpad [BEh] command
once the conversion has been performed. The data is transferred over the 1-Wire bus, LSB first. The
MSB of the temperature register contains the “sign” (S) bit, denoting wheth er the temperature is positive
or negative.
Table 2 describes the exact relationship of output data to measured temperature. The table assumes 12-bit
resolution. If the DS18B20 is configured for a lower r esolution, insignificant bits will contain zeros. For
Fahrenheit usage, a lookup table or conversion routine must be used.
Temperature/Data Rela ti onships Table 2
232221202-1 2-2 2-3 2-4 LSB
MSb (unit = °C) LSb
SSSSS2
62524MSB
TEMPERATURE DIGITAL OUTPUT
(Binary) DIGITAL
OUTPUT
(Hex)
+125°C 0000 0111 1101 0000 07D0h
+85°C 0000 0101 0101 0000 0550h*
+25.0625°C 0000 0001 1001 0001 0191h
+10.125°C 0000 0000 1010 0010 00A2h
+0.5°C 0000 0000 0000 1000 0008h
0°C 0000 0000 0000 0000 0000h
-0.5°C 1111 1111 1111 1000 FFF8h
-10.125°C 1111 1111 0101 1110 FF5Eh
-25.0625°C 1111 1110 0110 1111 FF6Fh
-55°C 1111 1100 1001 0000 FC90h
*The power on reset register value is +85°C.
O PE RAT ION - ALA RM SIG NALING
After the DS18B20 has performed a temperature conversion, the temperature value is compared to the
trigger values stored in TH and TL. Since these registers are 8-bit only, bits 9-12 are ignored for
comparison. The most significant bit of TH or TL directly corresponds to the sign bit of the 16-bit
temperature register. If the result of a temperature measurement is higher than TH o r lower than TL, an
alarm flag inside the device is set. This flag is updated with ever y temperature me asurement. As long as
the alarm flag is set, the DS18B20 will respond to the alarm search command. This allows many
DS18B20s to be connected in parallel doing simultaneous temperature measurements. If somewhere the
temperature exceeds the limits, the alarming device(s) can be identified and read immediately without
having to read non-alarming devices.