DS1904
4 of 13
TIMEKEEPING
A 32.768 kHz crystal oscillator is used as the time base for the real-time clock counter. The oscillator can
b
e turned on or off under software control. The oscillator must be on for the real time clock to function.
The real-time clock counter is double buffered. This allows the master to read time without the data
changing while it is being read. To accomplish this, a snapshot of the counter data is transferred to a
read/write buffer, which the user accesses.
DEVICE CONTROL BYTE
The on/off control of the 32.768 kHz crystal oscillator is done through the device control byte. This byte
c
an be read and written through the Clock Function commands.
Device Control Byte
7 6 5 4 3 2 1 0
U4 U3 U2 U1
OSC
OSC 0 0
Bit 0 - 1
0 No function
Bits 0 and 1 are hard-wired to read all 0’s.
Bit 2 - 3
OSC Oscillator Enable/Disable
These bits control/report whether the 32.768 kHz crystal oscillator is running. If the oscillator is running,
both OSC bits will read 1. If the oscillator is turned off these bits will all read 0. When writing the device
control byte both occurrences of the OSC bit should have identical data. Otherwise the value in bit ad-
dress 3 (bold) takes precedence.
Bit 4 - 7
Un General-purpose user flags
These non-volatile bits have no particular function within the chip. They can be read and written under
the control of the application software.
REAL-TIME CLOCK
The real-time clock is a 32-bit binary counter. It is incremented once per second. The real-time clock can
accumulate 136 years of seconds before rolling over. Time/date is represented by the number of seconds
since a reference point, which is determined by the user. For example, 12:00 a.m., January 1, 1970 could
be a reference point.
CLOCK FUNCTION COMMANDS
The “Clock Function Flow Chart” (Figure 5) describes the protocols necessary for accessing the real-time
clock. With only four bytes of real-time clock and one control byte the DS1904 does not provide random
access. Reading and writing always starts with the device control byte followed by the least significant
byte of the time data.
DS1904
5 of 13
CLOCK FUNCTION COMMAND FLOW CHART F
igure 5
Master TX Control
Function Command
66H
Read Clock
?
Y
N
Bus Master
TX Reset
?
N
Y
N
Bus Master
TX Reset
?
DS1904 copies
RTC Counter
to R/W Buffer
99H
Write Clock
?
N
Y
Y
N
Bus Master
TX Reset
?
Bus Master TX
LS Byte (7:0)
Bus Master TX
next Byte (15:8)
Bus Master TX
next Byte (23:16)
Bus Master TX
MS Byte (31:24)
Bus Master TX
Device Control Byte
DS1904 copies
R/W Buffer
to RTC Counter
DS1904 TX
Presence Pulse
Bus Master RX
next Byte (15:8)
Bus Master RX
next Byte (23:16)
Bus Master RX
MS Byte (31:24)
Bus Master RX
LS Byte (7:0)
Bus Master RX
Device Control Byte
Y
DS1904
6 of 13
READ CLOCK [66h]
The read clock command is used to read the device control byte and the contents of the real-time clock
c
ounter. After having received the most significant bit of the command code the device copies the actual
contents of the real-time clock counter to the read/write buffer. Now the bus master reads data beginning
with the device control byte followed by the least significant byte through the most significant byte of the
real-time clock. After this the bus master may continue reading from the DS1904. The data received will
be the same as in the first pass through the command flow. The read clock command can be ended at any
point by issuing a Reset Pulse.
WRITE CLOCK [99h]
The write clock command is used to set the real-time clock counter and to write the device control byte.
A
fter issuing the command, the bus master writes first the device control byte, which becomes immedi-
ately effective. After this the bus master sends the least significant byte through the most significant byte
to be written to the real-time clock counter. The new time data is copied from the read/write buffer to the
real-time clock counter and becomes effective as the bus master generates a reset pulse. If the oscillator is
intentionally stopped, the real-time clock counter behaves as a four-byte non-volatile memory.
1-WIRE BUS SYSTEM
The 1-Wire bus is a system, which has a single bus master and one or more slaves. In all instances the
DS1904 is a slave device. The bus master is typically a microcontroller. The discussion of this bus system
is broken down into three topics: hardware configuration, transaction sequence, and 1-Wire signaling
(signal types and timing). A 1-Wire protocol defines bus transactions in terms of the bus state during
specified time slots that are initiated on the falling edge of sync pulses from the bus master. For a more
detailed protocol description, refer to Chapter 4 of the Book of iButton® Standards.
HARDWARE CONFIGURATION Figure 6
RX
TX
Open Drain
Port Pin
5 µA
Typ.
DS1904 1-WIRE PORT
RX = RECEIVE
TX = TRANSMIT
BUS MASTER
V
PUP
DATA
RX
TX
MOSFET
100
5 k
Typ.
Hardware Configuration
The 1-Wire bus has only a single line by definition; it is important that each device on the bus be able to
drive it at the appropriate time. To facilitate this, each device attached to the 1-Wire bus must have open
drain or three-state outputs. The 1-Wire input of the DS1904 is open drain with an internal circuit
equivalent to that shown in Figure 6. A multidrop bus consists of a 1-Wire bus with multiple slaves
attached. The 1-Wire bus has a maximum data rate of 16.3k bits per second and requires a pull-up resistor
of approximately 5k.

DS1904L-F5#

Mfr. #:
Manufacturer:
Maxim Integrated
Description:
iButtons & Accessories RTC iButton
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet