X1, X2– 32.768 kHz Crystal Pins
GND– Ground
RST– Reset
I/O– Data Input/Output
SCLK– Serial Clock
, V
V
CC1
– Power Supply Pins
CC2
ORDERING INFORMATION
PART #DESCRIPTION
DS1302Serial T imekeeping Chip; 8–pin DIP
DS1302SSerial Timekeeping Chip;
8–pin SOIC (200 mil)
DS1302ZSerial Timekeeping Chip;
8–pin SOIC (150 mil)
DESCRIPTION
The DS1302 Trickle Charge Timekeeping Chip contains
a real time clock/calendar and 31 bytes of static RAM. It
communicates with a microprocessor via a simple serial
interface. The real time clock/calendar provides
seconds, minutes, hours, day, date, month, and year
information. The end of the month date is automatically
adjusted for months with less than 31 days, including
corrections for leap year. The clock operates in either
the 24–hour or 12–hour format with an AM/PM indicator.
Copyright 1995 by Dallas Semiconductor Corporation.
All Rights Reserved. For important information regarding
patents and other intellectual property rights, please refer to
Dallas Semiconductor data books.
Interfacing the DS1302 with a microprocessor is simplified by using synchronous serial communication. Only
three wires are required to communicate with the clock/
RAM: (1) RST (Reset), (2) I/O (Data line), and (3) SCLK
(Serial clock). Data can be transferred to and from the
clock/RAM one byte at a time or in a burst of up to 31
bytes. The DS1302 is designed to operate on very low
power and retain data and clock information on less
than 1 microwatt.
041697 1/12
DS1302
The DS1302 is the successor to the DS1202. In addition to the basic timekeeping functions of the DS1202,
the DS1302 has the additional features of dual power
pins for primary and back–up power supplies, programmable trickle charger for V
, and seven additional
CC1
bytes of scratchpad memory.
OPERATION
The main elements of the Serial Timekeeper are shown
in Figure 1: shift register, control logic, oscillator, real
time clock, and RAM. To initiate any transfer of data,
RST is taken high and eight bits are loaded into the shift
register providing both address and command information. Data is serially input on the rising edge of the SCLK.
The first eight bits specify which of 40 bytes will be
accessed, whether a read or write cycle will take place,
and whether a byte or burst mode transfer is to occur.
DS1302 BLOCK DIAGRAM Figure 1
V
V
GND
CC1
CC2
I/O
POWER
CONTROL
REAL TIME
CLOCK
After the first eight clock cycles have loaded the command word into the shift register, additional clocks will
output data for a read or input data for a write. The number of clock pulses equals eight plus eight for byte mode
or eight plus up to 248 for burst mode.
COMMAND BYTE
The command byte is shown in Figure 2. Each data
transfer is initiated by a command byte. The MSB (Bit 7)
must be a logic “1”. If it is zero, writes to the DS1302 will
be disabled. Bit 6 specifies clock/calendar data if logic
“0” or RAM data if logic “1”. Bits one through five specify
the designated registers to be input or output, and the
LSB (Bit 0) specifies a write operation (input) if logic “0”
or read operation (output) if logic “1”. The command
byte is always input starting with the LSB (Bit 0).
32.768 kHz
X2X1
OSCILLATOR
AND DIVIDER
INPUT SHIFT
REGISTERS
SCLK
RST
ADDRESS/COMMAND BYTE Figure 2
RAM
6
CK
5
A4
7
1
041697 2/12
COMMAND AND
CONTROL LOGIC
4
A3
DATA BUS
3
A2
ADDRESS BUS
2
A1
31 X 8 RAM
1
A0
0
RD
W
DS1302
RESET AND CLOCK CONTROL
All data transfers are initiated by driving the RST input
high. The RST input serves two functions. First, RST
turns on the control logic which allows access to the shift
register for the address/command sequence. Second,
signal provides a method of terminating either
the RST
single byte or multiple byte data transfer.
A clock cycle is a sequence of a falling edge followed by
a rising edge. For data inputs, data must be valid during
the rising edge of the clock and data bits are output on
the falling edge of clock. If the RST
transfer terminates and the I/O pin goes to a high impedance state. Data transfer is illustrated in Figure 3. At
power–up, RST
Also SCLK must be at a logic “0” when RST is driven to a
logic “1” state.
must be a logic “0” until VCC2.5 volts.
input is low all data
DATA INPUT
Following the eight SCLK cycles that input a write command byte, a data byte is input on the rising edge of the
next eight SCLK cycles. Additional SCLK cycles are
ignored should they inadvertently occur. Data is input
starting with bit 0.
DATA OUTPUT
Following the eight SCLK cycles that input a read command byte, a data byte is output on the falling edge of
the next eight SCLK cycles. Note that the first data bit to
be transmitted occurs on the first falling edge after the
last bit of the command byte is written. Additional SCLK
cycles retransmit the data bytes should they inadvertently occur so long as RST
tion permits continuous burst mode read capability.
Also, the I/O pin is tri–stated upon each rising edge of
SCLK. Data is output starting with bit 0.
remains high. This opera-
BURST MODE
Burst mode may be specified for either the clock/calendar or the RAM registers by addressing location 31 decimal (address/command bits one through five = logical
one). As before, bit six specifies clock or RAM and bit 0
specifies read or write. There is no data storage capacity at locations 9 through 31 in the Clock/Calendar Registers or location 31 in the RAM registers. Reads or
writes in burst mode start with bit 0 of address 0.
As in the case with the DS1202, when writing to the
clock registers in the burst mode, the first eight registers
must be written in order for the data to be transferred.
However, when writing to RAM in burst mode it is not
necessary to write all 31 bytes for the data to transfer.
Each byte that is written to will be transferred to RAM
regardless of whether all 31 bytes are written or not.
CLOCK/CALENDAR
The clock/calendar is contained in seven write/read registers as shown in Figure 4. Data contained in the clock/
calendar registers is in binary coded decimal format
(BCD).
CLOCK HALT FLAG
Bit 7 of the seconds register is defined as the clock halt
flag. When this bit is set to logic “1”, the clock oscillator is
stopped and the DS1302 is placed into a low–power
standby mode with a current drain of less than 100
nanoamps. When this bit is written to logic “0”, the clock
will start.
AM-PM/12-24 MODE
Bit 7 of the hours register is defined as the 12– or
24–hour mode select bit. When high, the 12–hour mode
is selected. In the 12–hour mode, bit 5 is the AM/PM bit
with logic high being PM. In the 24–hour mode, bit 5 is
the second 10 hour bit (20 – 23 hours).
WRITE PROTECT BIT
Bit 7 of the control register is the write protect bit. The
first seven bits (bits 0 – 6) are forced to zero and will
always read a zero when read. Before any write operation to the clock or RAM, bit 7 must be zero. When high,
the write protect bit prevents a write operation to any
other register.
TRICKLE CHARGE REGISTER
This register controls the trickle charge characteristics
of the DS1302. The simplified schematic of Figure 5
shows the basic components of the trickle charger. The
trickle charge select (TCS) bits (bits 4 – 7) control the
selection of the trickle charger. In order to prevent accidental enabling, only a pattern of 1010 will enable the
trickle charger. All other patterns will disable the trickle
charger. The DS1302 powers up with the trickle charger
disabled. The diode select (DS) bits (bits 2 – 3) select
whether one diode or two diodes are connected
between V
selected or if DS is 10, two diodes are selected. If DS is
00 or 11, the trickle charger is disabled independent of
CC2
and V
. If DS is 01, one diode is
CC1
041697 3/12
DS1302
TCS. The RS bits (bits 0 – 1) select the resistor that is
connected between V
CC2
and V
. The resistor
CC1
selected by the resistor select (RS) bits is as follows:
RS Bits
ResistorTypical Value
00NoneNone
01R12KΩ
10R24KΩ
11R38KΩ
If RS is 00, the trickle charger is disabled independent
of TCS.
Diode and resistor selection is determined by the user
according to the maximum current desired for battery or
super cap charging. The maximum charging current
can be calculated as illustrated in the following example.
Assume that a system power supply of 5V is applied to
V
and a super cap is connected to V
CC2
CC1
. Also
assume that the trickle charger has been enabled with 1
diode and resistor R1 between V
maximum current I
would therefore be calculated as
max
CC2
and V
CC1
. The
follows:
I
= (5.0V – diode drop) / R1
max
~ (5.0V – 0.7V) / 2KΩ
~ 2.2 mA
Obviously, as the super cap charges, the voltage drop
between V
CC2
and V
will decrease and therefore the
CC1
charge current will decrease.
CLOCK/CALENDAR BURST MODE
The clock/calendar command byte specifies burst
mode operation. In this mode the first eight clock/calendar registers can be consecutively read or written (see
Figure 4) starting with bit 0 of address 0.
to any of the eight clock/calendar registers (this includes
the control register). The trickle charger is not accessible in burst mode.
RAM
The static RAM is 31 x 8 bytes addressed consecutively
in the RAM address space.
RAM BURST MODE
The RAM command byte specifies burst mode operation. In this mode, the 31 RAM registers can be consecutively read or written (see Figure 4) starting with bit 0 of
address 0.
REGISTER SUMMARY
A register data format summary is shown in Figure 4.
CRYSTAL SELECTION
A 32.768 kHz crystal can be directly connected to the
DS1302 via pins 2 and 3 (X1, X2). The crystal selected
for use should have a specified load capacitance (CL) of
6 pF.
POWER CONTROL
V
provides low power operation in single supply and
CC1
battery operated systems as well as low power battery
backup.
V
provides the primary power in dual supply sys-
CC2
tems where V
maintain the time and data in the absence of primary
power.
The DS1302 will operate from the larger of V
V
. When V
CC2
power the DS1302. When V
will power the DS1302.
is connected to a backup source to
CC1
is greater than V
CC2
CC2
+ 0.2V , V
CC1
is less than V
CC1
CC1
CC2
, V
or
will
CC1
If the write protect bit is set high when a write clock/calendar burst mode is specified, no data transfer will occur
041697 4/12
DATA TRANSFER SUMMARY Figure 3
SINGLE BYTE TRANSFER
SCLK
RST
0123456 701 23456 7
R/W
I/O
BURST MODE TRANSFER
SCLK
RST
I/O
A0A1A2A3A41
ADDRESS COMMANDDATA INPUT/OUTPUT
0123456 701 2456 7
R/W
111111
ADDRESS COMMANDDATA I/O BYTE N
DS1302
R/C
R/C
DATA I/O BYTE 1
FUNCTIONBYTE NSCLK n
CLOCK872
RAM31256
041697 5/12
DS1302
REGISTER ADDRESS/DEFINITION Figure 4
REGISTER ADDRESSREGISTER DEFINITION
A. CLOCK
0
1
RD
W
00–59
CHSEC10 SEC
SEC
7
6
1
050403020
0
MIN
HR
DATE
MONTH
DAY
YEAR
CONTROL
TRICKLE
CHARGER
CLOCK
BURST
100001
0
100010
0
100011
0
100100
0
100101
0
100110
0
100111
0
101000
0
111111
0
RD
RD
RD
RD
RD
RD
RD
RD
RD
0
W
W
W
W
W
W
W
W
W
00–59
01–12
00–23 24
01–28/29
01–30
01–31
01–12
01–07
00–99
12/
010 DATE0
00
0000
WP0000000
TCSTCS TCS DSDSRSTCSRS
0
10 YEAR
10
A/P
MIN10 MIN
HRHR0
DATE
10
M
MONTH
DAY0
YEAR
B. RAM
RAM 0
RAM 30
RAM
BURST
041697 6/12
100000
1
111110
1
111111
1
RD
RD
RD
W
W
W
RAM DATA 0
RAM DATA 30
DS1302 PROGRAMMABLE TRICKLE CHARGER Figure 5
V
CC2
PIN #1
R1
2KΩ
R2
4KΩ
R3
8KΩ
DS1302
V
CC1
PIN #8
TRICKLE
CHARGE
REGISTER
1 OF 16 SELECT
(NOTE: ONLY 1010 CODE ENABLES CHARGER
1 OF 2
SELECT
1 OF 3
SELECT
TCSTCSTCSTCSDSDSRSRS
BIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
TCS
DS
RS
TRICKLE CHARGER SELECT
=
DIODE SELECT
=
RESISTOR SELECT
=
041697 7/12
DS1302
Logic 0 I
t
V
V
1
Logic 1 Output
V
V
2
Logic 0 Output
V
V
3
Acti
t
I
A
5, 12
Timek
t
I
A
4,12
Standby C
t
I
A
10, 12
Acti
t
I
A
5, 13
ABSOLUTE MAXIMUM RATINGS*
Voltage on Any Pin Relative to Ground–0.5V to +7.0V
Operating Temperature0°C to 70°C
Storage Temperature–55°C to +125°C
Soldering Temperature260°C for 10 seconds
* This is a stress rating only and functional operation of the device at these or any other conditions above those
indicated in the operation sections of this specification is not implied. Exposure to absolute maximum rating
conditions for extended periods of time may affect reliability.
The Dallas Semiconductor DS1302 is built to the highest quality standards and manufactured for long term reliability.
All Dallas Semiconductor devices are made using the same quality materials and manufacturing methods. However,
standard versions of the DS1302 are not exposed to environmental stresses, such as burn–in, that some industrial
applications require. Products which have successfully passed through this series of environmental stresses are
marked IND or N, denoting their extended operating temperature and reliability rating. For specific reliability information on this product, please contact the factory in Dallas at (972) 371–4448.
RECOMMENDED DC OPERATING CONDITIONS(0°C to 70°C)
PARAMETERSYMBOLMINTYPMAXUNITSNOTES
Supply Voltage V
Logic 1 InputV
npu
CC1
, V
CC2
V
V
CC1
CC2
IH
,
2.55.5V1, 11
2.0VCC+0.3V1
VCC=2.5V–0.3+0.3
IL
VCC=5V–0.3+0.8
DC ELECTRICAL CHARACTERISTICS(0°C to 70°C; VCC = 2.5 to 5.5V*)
PARAMETERSYMBOLMINTYPMAXUNITSNOTES
Input LeakageI
I/O LeakageI
ve Supply Curren
eeping Curren
urren
ve Supply Curren
*Unless otherwise noted.
041697 8/12
LI
LO
OH
OL
CC1A
CC1T
CC1S
CC2A
VCC=2.5V1.6
VCC=5V2.4
VCC=2.5V0.4
VCC=5V0.4
V
=2.5V
CC1
V
=5V1.2
CC1
V
=2.5V
CC1
V
=5V1
CC1
V
=2.5V
CC1
V
=5V100
CC1
V
=2.5V
CC2
V
=5V1.28
CC2
100
+500µA6
+500µA6
0.4
0.3
0.425
m
µ
10, 12,
n
m
,
14
DS1302
Timek
t
I
A
4,13
Standby C
t
I
A
10, 13
Data to CLK Set
t
7
CLK to Data Hold
t
7
CLK to Data Del
t
7, 8, 9
CLK L
t
7
CLK High Ti
t
7
CLK F
t
MHz7
CLK Ri
ll
t
t
RST to CLK Set
t
7
DC ELECTRICAL CHARACTERISTICS (cont’d)(0°C to 70°C; VCC = 2.5 to 5.5V*)