April
1999, Issue 105
Dallas
1-Wire Devices, (Part 1):
One
on One
THE
CHALLENGE
Is
it possible to reduce the necessary interface to a single
I/O pin, yet still let multiple external devices communicate
with a processor? Dallas Semiconductor accepted the
challenge years ago by creating a line of 1-wire data
devices.
To
fit a 1-wire protocol, the device needs to communicate
using a half-duplex protocol. This arrangement achieves
bidirectional communication over the same wire.
The
Dallas design is based on an open-collector type drive
with a pull-up resistor to VCC. Any device connected
to the 1-wire bus can pull the idle state (bus held
high by the pullup) down to ground with its open-collector
output.
The
computer or microcomputer that the external 1-wire device
is connected to is considered the master. All external
devices are considered slaves. Generally, the slave
devices wont clamp the bus low unless they are
responding to the masters request.
Most
1-wire devices are powered parasitically, which means
that they derive their power from the bus (while its
pulled up). This setup gives their timed circuits energy
to respond to a falling edge on the bus.
Communication
between the master and slave devices is handled via
read and write timeslots. A timeslot is a predetermined
period of time that begins when an active state (low)
is applied to the 1-wire bus. The falling edge of this
short pulse lets the other devices know when to read
the data bus or write to the data bus for the remainder
of the time slot.
There
are two different slot timingsreset and data.
The reset slot contains a low for at least 480 µs and
a response time of not more than 300 µs. These long
times are easily recognizable from the shorter data-slot
times.
Data
slots are no more than 120 µs. These consist of a maximum
15 µs low followed by the actual data, which is a high
or low on the bus. The masters initial low gets
all external devices listening to the bus.
If
the external device is receiving data, it samples the
bus after a minimum of 15 µs from the initial drop of
the bus. If the external device must send data, the
data is placed on the bus immediately following the
initial drop (see Figure 1).
|

Figure 1After
an initial low output, both write and read timeslots
can hold the output low indicating a data bit
of 0. When writing, the master controls the data,
and when reading, the slave controls the data.
|
Remember
that a slave device wont initiate data transfer
on the bus. There must be a way for the master to tell
an external device to respond. When a single device
is part of the system, either as a permanent component
or a socketed temporary touch device, a reset pulse
should precede any commands.
Although
devices that are permanently attached will always be
present, temporary devices may or may not be there.
The reset pulse is a request for any connected devices
to respond with a presence pulse to indicate that at
least one device is connected.