1.2 ROM Function Commands
Every 1-Wire device contains a globally unique 64-bit identifier number stored in ROM. This number can be used to facilitate addressing or identification of individual devices on the bus. The identifier consists of three parts; an 8-bit family code, a 48-bit serial number, and an 8-bit CRC computed from the first 56 bits. A small set of commands that operate on the 64-bit identifier is defined. These are called ROM function commands. The table below lists the six defined ROM commands.
Command | Code | Usage |
---|---|---|
READ ROM | 33H | Identification |
SKIP ROM | CCH | Skip addressing |
MATCH ROM | 55H | Address specific device |
SEARCH ROM | F0H | Obtain IDs of all devices on the bus |
OVERDRIVE SKIP ROM | 3CH | Overdrive version of SKIP ROM |
OVERDRIVE MATCH ROM | 69H | Overdrive version of MATCH ROM |
READ ROM command
The “READ ROM” command can be used on a bus with a single slave to read the 64-bit unique identifier. If there are several slave devices connected to the bus, the result of this command will be the AND result of all slave device identifiers. Assumed that communication is flawless, the presence of several slaves is indicated by a failed CRC.
SKIP ROM command
The “SKIP ROM” command can be used when no specific slave is targeted. On a one-slave bus, the “SKIP ROM” command is sufficient for addressing. On a multiple-slave bus, the “SKIP ROM” command can be used to address all devices at once. This is only useful when sending commands to slave devices, e.g., to start temperature conversions on several temperature sensors at once. It is not possible to use the “SKIP ROM” command when reading from slave devices on a multiple-slave bus.
MATCH ROM command
The “MATCH ROM” command is used to address individual slave devices on the bus. After the “MATCH ROM” command, the complete 64-bit identifier is transmitted on the bus. When this is done, only the device with exactly this identifier is allowed to answer until the next reset pulse is received.
SEARCH ROM command
The “SEARCH ROM” command can be used when the identifiers of all slave
devices are not known in advance. It makes it possible to discover the identifiers
of all the slaves present on the bus. First, the “SEARCH ROM” command is transmitted
on the bus. The master then reads one bit from the bus. Each slave places the first
bit of its identifier on the bus. The master will read this as the logical AND
result of the first bit of all slave identifiers. The master then reads one more bit
from the bus. Each slave then places the complement of the first bit of its
identifier on the bus. The master will read this as the logical AND of the
complement of the first bit of the identifier of all slaves. If all devices have
‘1
’ as the first bit, the master will have read 10b. Similarly,
if all devices have ‘0
’ as the first bit, the master will have read
01b. In these cases, the bit can be stored as the first bit of all addresses. The
master will then write back this bit, which in effect, will tell all slaves to keep
sending identifier bits. If there are devices with both ‘0
’ and
‘1
’ as the first bit in the identifier on the bus, the master
will have read 00. In this case, the master must choose, whether to continue with
the addresses that have ‘0
’ in this position or
‘1
’. The choice is transmitted on the bus, in effect making all
slaves that do not have this bit in this position of the identifier, enter an idle
state.
The master then goes on to read the next bit, and the process is repeated until all 64 bits are read. The master should then have discovered one complete 64-bit identifier. To discover more identifiers, the “SEARCH ROM” command should be run again, but this time a different choice for the bit value should be made the first time there is a discrepancy. Repeating this once for each slave device should discover all slaves. Note that when one search has been performed, all slaves except one should have entered an idle state. It is now possible to communicate with the active slave without specifically addressing it with the MATCH ROM command.
Overdrive ROM commands
The overdrive ROM commands are not covered here since overdrive mode is outside the scope of this document, only covering standard speed.