DS18B20
Programmable Resolution
1-Wire Digital Thermometer
If there is only one slave on the bus, the simpler Read
ROM [33h] command can be used in place of the Search
ROM process. For a detailed explanation of the Search
ROM procedure, refer to Application Note 937: Book of
master must return to Step 1 (Initialization) in the transac-
tion sequence. See the Operation—Alarm Signaling sec-
tion for an explanation of alarm flag operation.
®
DS18B20 Function Commands
iButton Standards. After every Search ROM cycle, the
bus master must return to Step 1 (Initialization) in the
transaction sequence.
After the bus master has used a ROM command to
address the DS18B20 with which it wishes to communi-
cate, the master can issue one of the DS18B20 function
commands. These commands allow the master to write
to and read from the DS18B20’s scratchpad memory,
initiate temperature conversions and determine the power
supply mode. The DS18B20 function commands, which
are described below, are summarized in Table 3 and illus-
trated by the flowchart in Figure 14.
Read Rom [33h]
This command can only be used when there is one slave
on the bus. It allows the bus master to read the slave’s
64-bit ROM code without using the Search ROM proce-
dure. If this command is used when there is more than
one slave present on the bus, a data collision will occur
when all the slaves attempt to respond at the same time.
Convert T [44h]
Match Rom [55H]
This command initiates a single temperature conversion.
Following the conversion, the resulting thermal data is
stored in the 2-byte temperature register in the scratch-
pad memory and the DS18B20 returns to its low-power
idle state. If the device is being used in parasite power
mode, within 10µs (max) after this command is issued
the master must enable a strong pullup on the 1-Wire bus
The match ROM command followed by a 64-bit ROM
code sequence allows the bus master to address a
specific slave device on a multidrop or single-drop bus.
Only the slave that exactly matches the 64-bit ROM code
sequence will respond to the function command issued
by the master; all other slaves on the bus will wait for a
reset pulse.
for the duration of the conversion (t
) as described
CONV
in the Powering the DS18B20 section. If the DS18B20 is
powered by an external supply, the master can issue read
time slots after the Convert T command and the DS18B20
will respond by transmitting a 0 while the temperature
conversion is in progress and a 1 when the conversion is
done. In parasite power mode this notification technique
cannot be used since the bus is pulled high by the strong
pullup during the conversion.
Skip Rom [CCh]
The master can use this command to address all devices
on the bus simultaneously without sending out any ROM
code information. For example, the master can make all
DS18B20s on the bus perform simultaneous temperature
conversions by issuing a Skip ROM command followed by
a Convert T [44h] command.
Note that the Read Scratchpad [BEh] command can
follow the Skip ROM command only if there is a single
slave device on the bus. In this case, time is saved by
allowing the master to read from the slave without send-
ing the device’s 64-bit ROM code. A Skip ROM command
followed by a Read Scratchpad command will cause
a data collision on the bus if there is more than one
slave since multiple devices will attempt to transmit data
simultaneously.
Write Scratchpad [4Eh]
This command allows the master to write 3 bytes of data
to the DS18B20’s scratchpad. The first data byte is written
into the T register (byte 2 of the scratchpad), the second
H
byte is written into the T register (byte 3), and the third
L
byte is written into the configuration register (byte 4). Data
must be transmitted least significant bit first. All three
bytes MUST be written before the master issues a reset,
or the data may be corrupted.
Alarm Search [ECh]
Read Scratchpad [BEh]
The operation of this command is identical to the operation
of the Search ROM command except that only slaves with
a set alarm flag will respond. This command allows the
master device to determine if any DS18B20s experienced
an alarm condition during the most recent temperature
conversion. After every Alarm Search cycle (i.e., Alarm
Search command followed by data exchange), the bus
This command allows the master to read the contents of
the scratchpad. The data transfer starts with the least sig-
nificant bit of byte 0 and continues through the scratchpad
until the 9th byte (byte 8 – CRC) is read. The master may
issue a reset to terminate reading at any time if only part
of the scratchpad data is needed.
iButton is a registered trademark of Maxim Integrated Products, Inc.
Maxim Integrated
│ 11
www.maximintegrated.com