May
1999, Issue 106
Dallas
1-Wire Devices, (Part 2):
All
on One
THE
BUS STOPS HERE
Park
those buses in an infinite loop for now. I want to continue
where I left off last month, talking about the 1-wire
Dallas devices. In their play for easy expansion, Dallas
created a potential monster by enabling multiple 1-wire
devices to share the same single I/O bit.
Many
of these devices might be the same, like the multiple
thermometers that monitor equipment temperatures, or
they might be different, like the 1-wire weather station
Dallas offers for about $80 on their web site (see Photo
1).
|

Photo 1Dallass
1-wire demo weather station comes with a PC
serial interface. Ditching the interface provides
a good platform for investigating the 1-wire
bus for use with a microcontroller.
|
The
plastic enclosure contains the electronics and hardware
for measuring temperature, wind speed, and wind direction.
All of this is done via Dallas 1-wire devices. How is
it possible, using a single wire?
There
are two levels of commands to talk with 1-wire devicesROM
functions and memory functions. All 1-wire devices are
familiar with all ROM functions, which are bus-level
functions used to communicate with all 1-wire devices.
(See Part 1 for 1-wire timing and communication specs.)
Following
a bus reset, all slave devices patiently listen for
a ROM function. After a device is selected via a ROM
function, it is ready to respond to a memory function.
Each 1-wire device family has its own list of memory
functions that support the special qualities of that
device. In other words, ROM functions are general commands
and memory functions are specific.
The
READ-ROM command instructs all devices to forget about
the ROM functions and respond with their ID (family
code + serial number + CRC). Obviously, multiple devices
will answer and the colliding data is worthless, making
READ-ROM only good for use with single devices on the
bus.
SKIP-ROM
instructs all devices to forget about the ROM functions
and respond to the following memory function. Again,
good for single devices.
MATCH-ROM
contains a unique ID (family code + serial number +
CRC) of the device youre looking for. All 1-wire
devices that dont match the ID you requested are
disabled. Only a single device (if it is actually there)
pays attention to the following memory function commands.
MATCH-ROM is good to use with multiple devicesthat
is, if you know whos connected.
56-BIT
ADDRESSING
If
you paid attention last month, you know how each 1-wire
device has its own ID number. Each device has its own
1-byte family code (e.g., 10h for all DS1820 thermometers).
The following six bytes hold a unique serial number
for each manufactured device. No two devices within
a family have the same serial number.
A
single-byte CRC check byte offers some semblance of
correctness. To determine what devices are connected
to the 1-wire bus, you must search all 264 combinations
to see whos home. But, that task could take years!
Luckily, Dallas included a search function to help narrow
down the possibilities, but you need to know how to
use it.