AT89C4051 to work as a Real time clock

Summary of AT89C4051 to work as a Real time clock


This article describes a digital clock project utilizing the AT89C4051 microcontroller as a real-time clock. It features a 20x4 LCD display and employs custom characters generated via CGRAM to render larger digits (0-9). The system is programmed in C using the Keil compiler, with source code, schematics, and hex files available for download.

Parts used in the Digital Clock:

  • AT89C4051 Microcontroller
  • 20 x 4 Lines LCD Display
  • CGRAM (Character Generator RAM)
  • Keil C Compiler
  • Hex File (clockV1.1)
  • Circuit Schematic

Its a digial clock which make use of AT89C4051 to work as a Real time clock.

Figure 1 shows the circuit diagram for the digital clock. Port 1 of the controller (AT89C4051) is used as the data lines for the LCD (starting from pin 7- pin14 of LCD). As you can see there is not much change in the hardware except the LCD, here i am using a 20 x 4 lines LCD display.

 

clock

In figure 3 as you can see the digits are bigger than the normal size. For this purpose i’m maiking use of the CGRAM of the LCD, which gives the flexibility to the user to define user defined characters. so to create a character we first need to get the values which are to be written into the CGRAM area. The CGRAM area starts from address 0x40 and for every character there are 8 locations which are to be written. Figure 2 shows the custom character creation.

so when we get the values for all the pixels. we write these values to the CGRAM. the Digit 0 – 9 can be created with the help of eight such custom characters.
NOTE: You can only create upto 8 custom characters.

The source code for the project is written in C-language, and compiled using Keil C compiler, you can download the c-code, schematic, and if you don’t have a cross compiler then you can directly burn the HEX file on to your chip clockV1.1

Full circuit diagram can be downloaded from here Circuit

Quick Solutions to Questions related to Digital Clock:

  • What microcontroller is used in this digital clock?
    The project uses the AT89C4051 microcontroller to function as a real-time clock.
  • How are the large digits displayed on the screen?
    Larger digits are created by defining user-defined characters using the CGRAM area of the LCD.
  • Which port connects the data lines to the LCD?
    Port 1 of the controller serves as the data lines for the LCD, connecting from pin 7 to pin 14.
  • Where does the CGRAM area start in memory?
    The CGRAM area begins at address 0x40.
  • How many locations are required to write one character into CGRAM?
    Eight locations must be written for every single character created in the CGRAM.
  • What is the maximum number of custom characters that can be created?
    You can create up to eight custom characters only.
  • Which programming language was used for the source code?
    The source code was written in C-language.
  • What compiler is recommended for this project?
    The project uses the Keil C compiler to compile the code.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top