Interface RTC With 8051

A Real Time Clock is like a watch – it runs on a battery and keeps time even when there is a power outage.

  • DS1307 is an I2c based serial real time clock (RTC).
  • RTC keep track of seconds, minutes, hours, date of month, month, day of month and year with leap year compensation which is valid upto year 2100.
  • The clock can be programmed to operate either in 12-hour or 24-hour format.
  • DS1307 requires very less number of components to operate.
  • RTC DS1307 operate in frequency of crystal oscillator 32.768kHz.
  • DS1307 uses I2C Protocol.
  • RTC act as a slave device and I2C Master can read/write register of RTC.
  • To communicate with the slave device, master need the slave address of device connected on bus.
  • DS1307 has fixed slave address.
    • Slave Address
    • 7-Bit format: 0b1101000 = 0x68
    • Slave address for I2C Write: 0b11010000 = 0xD0
    • Slave address for I2C Read: 0b11010001 = 0xD1.


  • Digital Clock.

Hardware Required

  • DS1307.
  • 3.3v Cmos battery.
  • 8051 MicroController.


  • SCL and SDA to port pins.
  • Gnd: Gnd.