In this tutorial we will see hot to interface DS1307(RTC) with Pic16f877a.
First we will see the internals of DS1307 and later how to read and write the date and time.

DS1307 Basics

The Real time clock DS1307 IC basically is stand alone time clock with following 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
  • Two-wire(I2C) serial interface
  • Programmable squarewave 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