beautypg.com

Clock accuracy, Command byte, Recommended layout for crystal – Rainbow Electronics DS1302 User Manual

Page 4

background image

DS1302

4 of 15

with Dallas Real-Time Clocks.” The DS1302 can also be driven by an external 32.768kHz oscillator. In
this configuration, the X1 pin is connected to the external oscillator signal and the X2 pin is floated.

CLOCK ACCURACY

The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the match
between the capactive load of the oscillator circuit and the capacitive load for which the crystal was
trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts. External
circuit noise coupled into the oscillator circuit may result in the clock running fast. See Application Note
58, “Crystal Considerations with Dallas Real-Time Clocks” for detailed information.

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 0, writes to the DS1302 will be disabled. Bit 6 specifies clock/calendar
data if logic 0 or RAM data if logic 1. Bits 1 through 5 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).

ADDRESS/COMMAND BYTE Figure 2

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, the

RST

signal provides a method of terminating either 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

input is low all data transfer terminates and the I/O pin goes to a high impedance state. Data transfer is
illustrated in Figure 3. At power-up,

RST

must be a logic 0 until V

CC

> 2.0V. Also SCLK must be at a

logic 0 when

RST

is driven to a logic 1 state.

RECOMMENDED LAYOUT FOR CRYSTAL