Pages

Sunday 17 November 2013

Real Time Clock




Overview
Real Time Clock based on most popular RTC IC DS1307 which can maintain clock & calendar information. Life of 3V battery is 10 years which maintains accurate clock even without any external power. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The Interface to board is simple I2C with SCK and SDA pins which can be interfaced with any microcontroller easily.

Real Time Clock



Features:
  • 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
  • Automatic Power-Fail Detect and Switch Circuitry.
  • Consumes Less than 500nA in Battery Backup Mode with Oscillator Running.


PIN Out Details


Working
           The DS1307 Serial Real Time Clock is a low power, full BCD clock/calendar plus 56 bytes of nonvolatile SRAM.  Address and data are transferred serially via a 2-wire bi-directional 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 less 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 which detects power failures and automatically switches to the battery supply
OPERATION
The DS1307 operates as a slave device on the serial 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 Real Time Clock.

Block Diagram:
 
 ATMEL Schematic
 

ATMEL CODE:
For Atmel Code Click Here

 PIC Schematic:



PIC CODE:
Fpr PIC Code Click Here