Rainbow Electronics DS2404 User Manual
Page 12

DS2404
12 of 29
Example 2: Write two data bytes to memory locations 0026h and 0027h (the seventh and eighth byte of
page 1). Read entire memory (1-Wire port).
MASTER MODE
DATA(LSB FIRST)
COMMENTS
TX
Reset
reset pulse (480–960
ms)
RX
Presence
presence pulse
TX
CCh
Issue “skip ROM” command
TX
0Fh
Issue “write scratchpad” command
TX
26h
TA1, beginning offset=6
TX
00h
TA2, address=0026h
TX
<2 data bytes>
Write 2 bytes of data to scratchpad
TX
Reset
reset pulse
RX
Presence
presence pulse
TX
CCh
Issue “skip ROM” command
TX
AAh
Issue “read scratchpad” command
RX
26h
Read TA1, beginning offset=6
RX
00h
Read TA2, address=0026h
RX
07h
Read E/S, ending offset=7, flags=0
RX
<2 data bytes>
Read scratchpad data and verify
TX
Reset
reset pulse
RX
Presence
presence pulse
TX
CCh
Issue “skip ROM” command
TX
55h
Issue “copy scratchpad” command
TX
26h
TX
00h
TX
07h
TA1
TA2
AUTHORIZATION CODE
E/S
TX
Reset
reset pulse
RX
Presence
presence pulse
TX
CCh
Issue “skip ROM” command
TX
F0h
Issue “read memory” command
TX
00h
TA1, beginning offset=0
TX
00h
TA2, address=0000h
RX
<542 bytes>
Read entire memory
TX
Reset
reset pulse
RX
Presence
presence pulse, done
WRITE PROTECT/PROGRAMMABLE EXPIRATION
The write protect bits (WPR, WPI, WPC) provide a means of write protecting the timekeeping data and
limiting access to the DS2404 when an alarm occurs (programmable expiration).
The write protect bits may not be written by performing a single copy scratchpad command. Instead, to
write these bits, the copy scratchpad command must be performed three times. Please note that the AA bit
will be set, as expected, after the first copy command is successfully executed. Therefore, the
authorization pattern for the second and third copy command should have this bit set. The read
scratchpad command may be used to verify the authorization pattern.