DS1302 Trickle-Charge Timekeeping Chip
CE AND CLOCK CONTROL
Driving the CE input high initiates all data transfers. The CE input serves two functions. First, CE turns on the
control logic that allows access to the shift register for the address/command sequence. Second, the CE signal
provides a method of terminating either single-byte or multiple-byte CE data transfer.
A clock cycle is a sequence of a rising edge followed by a falling edge. For data inputs, data m ust be valid during
the rising edge of the clock and data bits are output on the falling edge of clock. If the CE input is low, all data
transf er term inates and the I/O p in goes t o a h igh-im pedance s tate. Figure 4 s hows data tr ansf er. At po wer -up, C E
must be a logic 0 until VCC > 2.0V. Also, SCLK must be at a logic 0 when CE is driven to a logic 1 state.
DATA INPU T
Following the eight SCLK cycles tha t inp ut a write comm and b yte, a data b yte is in put on th e ris ing e dg e of the nex t
eight SCLK c ycles. Additional SCLK cycles are ignored should the y inadvertently occur. Data is input starting with
bit 0.
DATA OUTP UT
Following the eight SCLK cycles that input a read command byte, a data byte is output on the falling edge of the
next eigh t SCL K c ycles. N ote th at t he firs t data bit to be tr ansm itted occurs on the f irst f alling edge after the las t bit
of the command byte is written. Additional SCLK cycles retransmit the data bytes should they inadvertently occur
so long as CE remains high. This operat ion 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.
BURST MODE
Burst m ode can be specified for either the clock /calendar or the R AM registers by addressing location 31 decim al
(address/command bits 1 through 5 = logic 1). As before, bit 6 specifies clock or RAM and bit 0 specifies read or
write. T here is no dat a storage cap acity at loc ations 9 thr ough 31 in th e Clock /Calendar Regist ers or loc ation 31 in
the RAM registers. Reads or writes in burst mode start with bit 0 of address 0.
W hen writing t o th e c lock registers i n the b ur st mode, the f irs t eigh t regis t er s must be written i n order f or the data t o
be transf erred. Howe ver, when writ ing to RAM in burs t mode it is not neces sary to write all 31 b ytes 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 tim e and calend ar inf ormation is obtain ed by r e ading t he ap propr i ate reg is ter b ytes. Table 3 illustrates th e R T C
registers . The time and ca lendar are s et or initiali zed by writing t he appropriat e register bytes . The contents of the
time and calendar registers are in the binary-coded decimal (BCD) format.
The day-of-week register increments at midnight. Values that correspond to the day of week are user-defined but
must be sequential (i.e., if 1 equals Sunday, then 2 equals Monday, and so on.). Illogical time and date entries
result in undefined operation.
W hen readin g or writing th e time and date regis ters, sec ondary (user) buf fers are used to pr event errors when the
internal registers update. When reading the time and date registers, the user buffers are synchronized to the
internal registers the rising edge of CE.
The c ountdown chain is res et whenever th e seconds r egister is writte n. Write transf ers occur on the f alling edge of
CE. To avoid rollover issues, once the countdown chain is reset, the remaining time and date registers must be
written within 1 second.
The DS1302 can b e run in either 12-hour or 24-hour m ode. 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 m ode, 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). The hours data must be
re-initialized wh ene ver the 12/24 bit is changed.
6 of 13