PerfectMoney

Tuesday, February 24, 2015

Digital Clock Circuit using 8051 and DS12C887

Digital clock displays the time using numbers. This circuit is used in many applications like cars, railway stations, houses, offices, etc. in order to provide accurate time and date. In this type of applications, normally we use RTC (Real Time Clock) ICs to display the time and date accurately. This circuit displays the time on LCD. For this clock, we can set the time at any instant. Here the clock works in 24 hour mode and the RTC chip is configured by programming 8051 controller.

Digital Clock using 8051 Microcontroller and DS12C887 Circuit Principle:

Here 8051 controller continuously reads the data from Real time clock and process it in correct order to display the time on LCD. INT1 of the 8051 controller is used to set the time to the digital clock. If you make P3.3 pin LOW then interrupt arises and set_time function is called to set the time. To set the time to the clock use P1.4 and P1.5 pins. P1.4 is used to vary the hours and P1.5 is used to vary the minutes. After setting the time make P1.6 high to run the clock with the time set by user.

Digital Clock Circuit Diagram using 8051 Microcontroller and DS12C887:

Circuit Diagram of Digital Clock using 8051 Microcontroller and RTC DS12C887
Circuit Diagram of Digital Clock using RTC DS12C887 and 8051 Microcontroller
Circuit Components:
  • 8051 microcontroller
  • Project PCB
  • Programming cable
  • DC Battery or 12V, 1A adaptor
  • DS12C887 RTC IC
  • 16*2 alphanumeric LCD
  • Push buttons – 4
  • Slide switches – 3
  • 2 ceramic capacitors – 33pF
  • 12 MHz crystal
  • Electrolytic capacitor – 10uF, 16V
  • Resistor (1/4 watt) – 10k
  • Pot – 10k
  • 5V DC power supply circuit
  • Single pin connecting wires

Digital Clock Circuit Design using 8051 Microcontroller and DS12C887:

The circuit shows you how interface RTC IC to the 8051 controller. Port P0 is used as a data port of Real time clock.  Port P2 of controller is connected to the data pins of LCD. Pins P1.1, P1.2 and P1.3 of controller are connected to the RS, RW, EN pins respectively. P1.0 is connected to the RESET of RTC. Push buttons are connected to the P1.4 and P1.5. These are used set the time. P1.6 is configured as START pin used to run the clock with time set by the user. P3.3 is connected to the push button used to call the set_time function.
DS12C887 Real Time Clock:
This IC is used most of the applications to provide accurate time and date. This IC provides the time in both 12 hour mode and 24 hour mode. This IC also provides calendar components day, month and year. This RTC uses internal lithium battery to keep the time and date updated when power is failed. This IC has 128 bytes of RAM memory. In these 128 bytes of RAM 14 bytes are used for time, date and registers. Remaining 114 bytes are used to store general purpose data.
The control registers of RTC are accessible only when the power is applied from external source. This IC requires more than 4.25V power supply and the control registers are accessible after 200ms when external power is supplied.
DS12C887 IC
DS12C887 IC
Pin Description:
  • MOT: It is a bus type selection pin used to select between Intel and Motorolabus types. This pin is connected to VCC to select Motorola bus type and connected to GND or unconnected to select Intel bus type.
  • 2, 3: Unused pins
  • 4 – 11 (AD0 – AD7): These pins are bidirectional address and data lines of RTC. On these pins address is present in the first portion of cycle and data is present in the second portion of bus cycle.         
  • 12 (GND): This pin is connected to Ground.
  • 13 (CS): This pin must be low to access the chip during read and write operations.
  • 14 (AS): The high pulse on this pin is used to demultiplex the data and address.
  • 15 (R/W): This pin is used for read or writes operations.
  • 16: Unused pin
  • 17 (DS): This is a Data Strobe pin.
  • 18 (RESET): The low pulse on this pin resets all the flags and interrupts but it does not affects time and date.
  • 19 (IRQ): Thisis active low pin used as an interrupt input to the controller.
  • 20 – 22: Unused pins
  • 23 (SQW): Used to generate square wave with predefined frequencies
  • 24 (VCC): This pin is connected 5V supply
RTC Address Map:
This RTC has 128 bytes of RAM with addresses 00H – 07H. The first ten locations (00 – 09) are used for clock, calendar and alarm data. 0A – 0D address locations are used for status and control registers. Remaining address locations are used to for general data. The following table shows the address locations for clock, calendar and alarm.
Address Locations for Time, Date and Alarm
Address Locations for Time, Date and Alarm
This IC has 4 control and status registers namely register A, register B, Register C, register D. We need to configure all these registers to get the accurate time and date. In order to configure these registers go through the DS12C887 Datasheet

How to Operate Digital Clock Circuit using DS12C887 and 8051 Microcontroller?

  1. Initially burn the program to the 8051 microcontroller
  2. Now give the connections as per the circuit diagram
  3. Switch on the board supply
  4. Now you can observe the time on LCD. If you want to set the time make the start pin low and press the push button connected to the P3.3
  5. LCD shows set time message. Now use push button which is connected to P1.4 to set hours and use other push button to set minutes.
  6. Now make start pin high to run the clock.

Digital Clock Circuit Applications:

  • This project is used in offices, houses, hotels and auto mobiles to display the time and date.
  • We can also set the alarm in this project with a little modification.

No comments:

Post a Comment

some simple projects for Electrical&Electronics students