Ds1307 Programming

Ds1307 Programming 9,2/10 5102reviews
Overview

RTC Interfacing with 8051 Microcontroller Have you ever wondered, how your phones and laptops keep track of your time when the device is turned OFF. Redline Software Update. Well, there is a true clock which is named as an RTC (Real Time Clock). This clock is powered with unbroken battery even that the device is turned OFF.

When the device is turned ON & connects to the web, then the device connects to an NTP server and updates the date and time. This article is meant to give a little insight regarding RTC DS1307 (real time clock) interfacing with. It is attainable to outline a computer code I2C library if your controller doesn’t have an I2C bus. This article can walk you through the steps concerned in interfacing RTC DS1307 with a microcontroller. Interfacing of RTC Device with 8051 Microcontroller Interfacing RTC DS1307 with 8051 microcontroller is related to all other types of RTCs interfaced to it. So here is a brief information regarding interfacing of RTC DS1307 device with 8051 microcontroller.

In this tutorial, we will see how to interface DS1307(RTC) with 8051. First, we will see the internals of DS1307 and later how to read and write the date and time. The DS1307 in this example is connected directly to two of the I/O ports on a DS5000 microcontroller and the 2-wire handshaking is handled by low-level drivers, which are discussed in this application note. DS1307 Description The DS1307 Serial Real Time Clock is a low-power, full BCD clock/calendar plus 56 bytes of nonvolatile SRAM.

Step-1: Selection of RTC Device There are different types of devices are available in the and these are classified into different types like supply voltage, package type and pin diagram etc. A few kinds of RTC devices are; • 2-Wire Serial Interface (or) I2C Bus • 3-Wire Serial Interface (or) USB BUS • 4-wire Serial interface (or) SPI BUS First of all, we must select the type of device based on type like SPI bus RTC or I2C bus RTC, or any other device, which is apt for interfacing with a microcontroller. Then, choose the features of the RTC device depending on application like suitable package & clock frequency, battery life. Let us consider RTC DS1307 interfacing with 8051 microcontroller. Step2: Address and Internal Register of the RTC Device Based on the crystal frequency, the RTC device offers years, months, weeks, days, hours, minutes and seconds. The RTC device comprises of RAM memory and a battery. Here, RAM memory is used to store the data and battery is for backup in case of power supply failure.

Configuration of RTC DS1307. RTC Internal Blocks and Pin Diagram • A0, A1 and A2 pins are address pins • VCC and GND pins are power supply (1.8V to 5.5V range) and ground pins. • VBT is a battery power supply (2V to 3.5V) • SCL pin is a serial clock and it is used to synchronize data on the serial interface. • SDL pin is a serial i/p and o/p pin. • CLK Out pin is an optional square wave o/p pin.

• OSC0 & OSC1 pins are crystal oscillator pins Addressing of the Device The I2C bus protocol lets many dependent devices at a time. Every dependent device must comprise of own address to denote on it. The master device interconnects with a particular dependent device by an address. The address of the RTC device is OxA2 where 1010 is given by the manufacturer and, address pins A0, A1 and A2 are used to interconnect with eight RTC devices on the 2C bus protocol. Addressing of Devices • R/W bit is used to perform read or write operations in RTC.

Arduino Library