GENERAL DESCRIPTION
The DS1307 serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are
2
transferred serially through an IC, bidirectional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with AM/PM indicator. The DS1307 has a built-in power-sense circuit that detects power failures and automatically switches to the backup supply. Timekeeping operation continues while the part operates from the backup supply.
BENEFITS AND FEATURES
?
Completely Manages All Timekeeping FunctionsoReal-Time Clock Counts Seconds, Minutes,
Hours, Date of the Month, Month, Day of theWeek, and Year with Leap-YearCompensation Valid Up to 2100
o56-Byte, Battery-Backed, General-Purpose
RAM with Unlimited Writes
oProgrammable Square-Wave Output SignalSimple Serial Port Interfaces to MostMicrocontrollers
2
oIC Serial Interface
Low Power Operation Extends Battery BackupRun Time
oConsumes Less than 500nA in Battery-Backup Mode with Oscillator RunningoAutomatic Power-Fail Detect and Switch
Circuitry 8-Pin DIP and 8-Pin SO Minimizes RequiredSpace
Optional Industrial Temperature Range: -40°C to+85°C Supports Operation in a Wide Range ofApplications
Underwriters Laboratories? (UL) Recognized
?
?
TYPICAL OPERATING CIRCUIT V CCV CCV CCR PURP UCRYSTAL ?
V CCSQW/OUT X1 SCL X2 ?
CPU SDA DS1307 V BAT GND = tr/ Cb RPU ?
PIN CONFIGURATIONS
TOP VLEWX1X2VBATGNDSO (150 mils)VCCSQW/OUTSCLSDAX1X2VBATGNDPDIP (300 mils)VCCSQW/OUTSCLSDAORDERING INFORMATION
PART
DS1307+
DS1307N+ DS1307Z+ DS1307ZN+ DS1307Z+T&R DS1307ZN+T&R
TEMP RANGE 0°C to +70°C -40°C to +85°C0°C to +70°C -40°C to +85°C0°C to +70°C -40°C to +85°C
VOLTAGE (V) PIN-PACKAGE
5.0 5.0 5.0 5.0 5.0 5.0
8 PDIP (300 mils) 8 PDIP (300 mils) 8 SO (150 mils) 8 SO (150 mils)
8 SO (150 mils) Tape and Reel 8 SO (150 mils) Tape and Reel
TOP MARK* DS1307 DS1307N DS1307 DS1307N DS1307 DS1307N
+Denotes a lead-free/RoHS-compliant package.
*A “+” anywhere on the top mark indicates a lead-free package. An “N” anywhere on the top mark indicates an industrial temperature range device.Underwriters Laboratories, Inc. is a registered certification mark of Underwriters Laboratories, Inc.
DS1307 64 x 8, Serial, IC Real-Time Clock
2
PIN DESCRIPTION
PIN 1
NAME X1
FUNCTION
Connections for Standard 32.768kHz Quartz Crystal. The internal oscillator circuitry is designed for operation with a crystal having a specified load capacitance (CL) of 12.5pF. X1 is the input to the oscillator and can optionally be connected to an external 32.768kHz oscillator. The output of the internal oscillator, X2, is floated if an external oscillator is connected to X1.
Note: For more information on crystal selection and crystal layout considerations, refer to Application Note 58: Crystal Considerations with Dallas Real-Time Clocks.
Backup Supply Input for Any Standard 3V Lithium Cell or Other Energy Source. Battery voltage must be held between the minimum and maximum limits for proper operation. Diodes in series between the battery and the VBAT pin may prevent proper operation. If a backup supply is not required, VBAT must be grounded. The nominal power-fail trip point (VPF) voltage at which access to the RTC and user RAM is denied is set by the internal circuitry as 1.25 x VBAT nominal. A lithium battery with 48mAh or greater will back up the DS1307 for more than 10 years in the absence of power at +25°C.
UL recognized to ensure against reverse charging current when used with a lithium battery.
4 5 6
GND SDA SCL
Ground
Serial Data Input/Output. SDA is the data input/output for the IC serial interface. The SDA pin is open drain and requires an external pullup resistor. The pullup voltage can be up to 5.5V regardless of the voltage on VCC.
2Serial Clock Input. SCL is the clock input for the IC interface and is used to synchronize data movement on the serial interface. The pullup voltage can be up to 5.5V regardless of the voltage on VCC.
Square Wave/Output Driver. When enabled, the SQWE bit set to 1, the SQW/OUT pin outputs one of four square-wave frequencies (1Hz, 4kHz, 8kHz, 32kHz). The SQW/OUT pin is open drain and requires an external pullup resistor. SQW/OUT operates with either VCC or VBAT applied. The pullup voltage can be up to 5.5V regardless of the voltage on VCC. If not used, this pin can be left floating.
Primary Power Supply. When voltage is applied within normal limits, the device is fully accessible and data can be written and read. When a backup supply is connected to the device and VCC is below VTP, read and writes are inhibited. However, the timekeeping function continues unaffected by the lower input voltage.
22 X2
3 VBAT
7 SQW/OUT
8 VCC
DETAILED DESCRIPTION
The DS1307 is a low-power clock/calendar with 56 bytes of battery-backed SRAM. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The DS1307 operates as a slave
2
device on the IC bus. Access is obtained by implementing a START condition and providing a device identification code followed by a register address. Subsequent registers can be accessed sequentially until a STOP condition is executed. When VCC falls below 1.25 x VBAT, the device terminates an access in progress and resets the device address counter. Inputs to the device will not be recognized at this time to prevent erroneous data from being written to the device from an out-of-tolerance system. When VCC falls below VBAT, the device switches into a low-current battery-backup mode. Upon power-up, the device switches from battery to VCC when VCC is greater than VBAT +0.2V and recognizes inputs when VCC is greater than 1.25 x VBAT. The block diagram in Figure 1 shows the main elements of the serial RTC.
DS1307 64 x 8, Serial, IC Real-Time Clock
2
OSCILLATOR CIRCUIT
The DS1307 uses an external 32.768kHz crystal. The oscillator circuit does not require any external resistors or capacitors to operate. Table 1 specifies several crystal parameters for the external crystal. Figure 1 shows a functional schematic of the oscillator circuit. If using a crystal with the specified characteristics, the startup time is usually less than one second.
CLOCK ACCURACY
The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the match between the capacitive 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. Refer to Application Note 58: Crystal Considerations with Dallas Real-Time Clocks for detailed information.
Table 1. Crystal Specifications*
PARAMETER Nominal Frequency Series Resistance Load Capacitance
SYMBOL
fO ESR CL
MIN
TYP 32.768 12.5
MAX 45
UNITS kHz k? pF
*The crystal, traces, and crystal input pins should be isolated from RF generating signals. Refer toApplication Note 58: Crystal Considerations for Dallas Real-Time Clocks for additional specifications.
Figure 2. Recommended Layout for Crystal
LOCAL GROUND PLANE (LAYER 2) X1 CRYSTAL X2 GND NOTE: AVOID ROUTING SIGNAL LINES IN THE CROSSHATCHED AREA (UPPER LEFT QUADRANT) OF THE PACKAGE UNLESS THERE IS A GROUND PLANE BETWEEN THE SIGNAL LINE AND THE DEVICE PACKAGE. RTC AND RAM ADDRESS MAP
Table 2 shows the address map for the DS1307 RTC and RAM registers. The RTC registers are located in address locations 00h to 07h. The RAM registers are located in address locations 08h to 3Fh. During a multibyte access, when the address pointer reaches 3Fh, the end of RAM space, it wraps around to location 00h, the beginning of the clock space.
DS1307 64 x 8, Serial, IC Real-Time Clock
The DS1307 can operate in the following two modes:
1.Slave Receiver Mode (Write Mode): Serial data and clock are received through SDA and SCL. After
each byte is received an acknowledge bit is transmitted. START and STOP conditions are recognizedas the beginning and end of a serial transfer. Hardware performs address recognition after reception ofthe slave address and direction bit (see Figure 4). The slave address byte is the first byte receivedafter the master generates the START condition. The slave address byte contains the 7-bit DS1307address, which is 1101000, followed by the direction bit (R/W), which for a write is 0. After receiving anddecoding the slave address byte, the DS1307 outputs an acknowledge on SDA. After the DS1307acknowledges the slave address + write bit, the master transmits a word address to the DS1307. Thissets the register pointer on the DS1307, with the DS1307 acknowledging the transfer. The master canthen transmit zero or more bytes of data with the DS1307 acknowledging each byte received. Theregister pointer automatically increments after each data byte are written. The master will generate aSTOP condition to terminate the data write.2.Slave Transmitter Mode (Read Mode): The first byte is received and handled as in the slave receiver
mode. However, in this mode, the direction bit will indicate that the transfer direction is reversed. TheDS1307 transmits serial data on SDA while the serial clock is input on SCL. START and STOPconditions are recognized as the beginning and end of a serial transfer (see Figure 5). The slaveaddress byte is the first byte received after the START condition is generated by the master. The slaveaddress byte contains the 7-bit DS1307 address, which is 1101000, followed by the direction bit (R/W),which is 1 for a read. After receiving and decoding the slave address the DS1307 outputs anacknowledge on SDA. The DS1307 then begins to transmit data starting with the register addresspointed to by the register pointer. If the register pointer is not written to before the initiation of a readmode the first address that is read is the last one stored in the register pointer. The register pointerautomatically increments after each byte are read. The DS1307 must receive a Not Acknowledge toend a read.
2
Figure 4. Data Write—Slave Receiver Mode
2
Figure 6. Data Read (Write Pointer, Then Read)—Slave Receive and Transmit