DS2480
042498 19/26
SOFTWARE DRIVER EXAMPLES
The DS2480 requires a software driver that translates
the activities to be generated on the 1–Wire bus into the
appropriate commands. The examples below cover typ-
ical situations, such as reading the ROM, writing to the
scratchpad of a Memory iButton, reading the memory of
a Memory iButton, programming an Add–Only iButton
EPROM and performing a temperature conversion with
the Temperature iButton DS1920. An example for the
use of the Search Accelerator is included in the descrip-
tion of the Search Accelerator, earlier in this document.
The DS2480 command codes used in these examples
are valid for regular speed and will work properly on
short 1–Wire busses (< 10 meters). The response byte
on the reset command assumes a normal presence
pulse, no alarm or short.
The DS2480 includes a 1–byte buffer that stores a byte
received from the host while the previous byte is being
translated into activity on the 1–Wire bus. For this rea-
son the host may send another byte even without having
received the response byte. Sending bytes faster than
they can be translated into 1–Wire activities may result
in loss of data and/or synchronization and therefore
should be avoided.
READ ROM SEQUENCE
Action Sequence
Host TX
Host RX
Generate Reset Pulse
C1
C9
Set data mode
E1
(nothing)
Read ROM Command
33
(as sent)
Read ROM ID (8 bytes)
FF (x8)
ROM ID
Set command mode
E3
(nothing)
Generate Reset Pulse
C1
C9
WRITE SCRATCHPAD SEQUENCE
Write 2 bytes to scratchpad at memory locations 16h
and 17h
Action Sequence
Host TX
Host RX
Generate Reset Pulse
C1
C9
Set data mode
E1
(nothing)
Skip ROM Command
CC
CC
Write Scratchpad Cmd.
0F
(as sent)
Starting Address TA1
16
(as sent)
Starting Address TA2
00
(as sent)
Write to the Scratchpad
(2 bytes)
(as sent)
Set command mode
E3
(nothing)
Generate Reset Pulse
C1
C9
READ MEMORY SEQUENCE
Read 8 bytes from memory address 0040h
Action Sequence
Host TX
Host RX
Generate Reset Pulse
C1
C9
Set data mode
E1
(nothing)
Skip ROM Command
CC
(as sent)
Read Memory Command
F0
(as sent)
Starting Address TA1
40
(as sent)
Starting Address TA2
00
(as sent)
Read 8 bytes of data
FF (x8)
data
Set command mode
E3
(nothing)
Generate Reset Pulse
C1
C9