In this tutorial we will learn How to interface RTC DS1307 with AVR microcontroller.
We are using Atmega8 for the demo.
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 transferred serially through
an I2C™, 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 battery supply.
- Real-Time Clock (RTC) Counts Seconds, Minutes, Hours, Date of the Month, Month,
- Day of the week, and Year with Leap-Year Compensation Valid Up to 2100
- 56-Byte, Battery-Backed, Nonvolatile (NV) RAM for Data Storage
- I2C Serial Interface
- Programmable Square-Wave Output Signal
- Automatic Power-Fail Detect and Switch Circuitry
- Consumes Less than 500nA in Battery-Backup Mode with Oscillator Running
- Optional Industrial Temperature Range: -40°C to +85°C
- Available in 8-Pin DIP or SO
X1 and X2 (pin 1,2): 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.