Arduino Projects    |   Raspberry Pi  |     Electronic Circuits    |    AVR    |    PIC    |    8051    |    Electronic Projects   |   Free TI Design & Simulation Tools 

Clock using RTC DS12C887 & 8051 microcontroller (AT89C51) with alarm set function


Developed By: 
Himanshu Choudhary

DS12C887 is a real time clock (RTC) IC from Dallas Semiconductors. The RTCs provide precise time and date information. This article explains the making of a digital clock with alarm setting functionalities. RTC has been interfaced with AT89C51 to perform desired operations. This project is an improvement over Digital clock using RTC DS12C887 and 8051 microcontroller (AT89C51) with time set and has the alarm setting function also. The alarm setting function allows user to set the alarm. The clock time is displayed on the LCD.  The free source code for the program is available in C.



Alarm Clock using RTC DS12C887 & 8051 microcontroller (AT89C51)



The circuit for interfacing the RTC and 16x2 LCD with the microcontroller 8051 is shown in the circuit diagram. Port P2 is set as data port for LCD to send the data on the LCD while port P0 is set as data port for the RTC DS12C887. This is used to extract the time, date and other information from the RTC. The pins of port P1 and P3 of the controller AT89C51 are used to provide the input signals for setting the time, alarm etc. They also provide control signals for the RTC and the LCD.

This project is an improved version of Digital clock using RTC DS12C887 and 8051 microcontroller (AT89C51) with time set with only difference that we can set alarm in it. It helps in understanding the concept of setting alarm in the RTC 12C887.  The program uses the two external interrupt 0 and 1 for setting the time and alarm respectively. For setting the time the pin P3^2 of the microcontroller 8051 is made low, which is the external interrupt 0. For alarm setting the pin P3^3 of the microcontroller is made low which is the external interrupt 1.
When any of the interrupts occur, the microcontroller stops its current operation and gets ready to set the time or alarm depending on the interrupt activated. The alarm can be set by using the pins digalarm_hr1 and digalarm_min1. The time can be set by using the pins dig_hr1 and dig_min1. When the alarm time matches the clock time, ‘Alarm’ is displayed on the LCD and the alarmport pin is set high for 10 sec. This pin can further be connected to a speaker or buzzer to sound the alarm.


Circuit Diagram



This Code is only visible to Registered users. Please Login/Register


This Code is only visible to Registered users. Please Login/Register


AT89C51 Microcontroller, Atmel 89C51 Controller Image
AT89C51 Microcontroller

AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash programmable and erasable read only memory (...

16 x 2 LCD | 16x2 Character LCD Module


LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments...

RTC DS12C887 Image
RTC DS12C887

RTC DS 12C887 is widely used to provide exact time and date in many applications such as x86 IBM PC. This RTC provides time components hour, minute and second in addition to the date/calendar components of year, month and day. This chip uses an internal lithium battery, which keeps the time and da...

Free Circuit Design & Simulation Tool by TI

Free Powerful Circuit Design & Simulation Tool by Texas Instruments

TINA-TI is a powerful circuit design and simulation tool. TINA-TI is ideal for designing, testing, and troubleshooting a broad variety of basic and advanced circuits, including complex architectures, without any node or number of device limitations.

Download It Here


Tina TI

TINA is an easy-to-use, powerful circuit simulation tool based on a SPICE engine. TINA-TI is a fully functional version of TINA, loaded with a library of TI macromodels plus passive and active models.

TINA-TI's new version 9 has changes from Version 7.0 in the following areas:

  • Schematic Symbol Editor (useable with the Macro Wizard) is included, so you can create your own symbols for imported SPICE macromodels.
  • Macros do not have to be from TI - you can import anyone's SPICE model now!
  • Does not require active or non-linear components for analysis (so you can now run a circuit using just passives).
  • TINA-TI includes Initial Condition and Nodeset components
  • TINA-TI includes Linear and nonlinear controlled sources (VCVS, CCVS, VCCS, CCCS), and the Controlled Source Wizard.
  • TINA-TI now allows WAV files to be used as stimulus (signal sources). You can play calculated waveforms on PC's multimedia system, and export calculated waveforms as a *.wav file.
  • TINA-TI has Multi-core processor support; this along with other optimizations makes simulations run 2-20 times faster.
  • Schematic file import/export in XML format
  • Block Wizard included for making block diagrams
  • TINA-TI has more SPICE models and example circuits included.
  • Circuits developed in TINA-TI 9 will work with TINA Industrial version 9.
  • TINA-TI Version 7.0 is forward compatible with Version 9, and version 9 supports saving schematics in version 7.0 format.
  • Available in English, Traditional and Simplified Chinese, Japanese, and Russian versions.

Download The Tool Here Free

You are here