Digital Clock in Assembly Code for a 8051 microcontroller using EdSim51 simulator. In this project, you are required to design a Digital Clock. You may use three neighbor memory addresses (RAM) to show the digital clock; for example, you may use RAM addresses 30H, 31H, and 32H respectively to show seconds, minutes, and hours (refer to Figure1). In this project I've explained to you about how to make a simple digital clock using 8051 microcontroller with 7-segment display. Find this and other hardware projects on Hackster.io. 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. Programming is not an easy stuff for every one, and when it comes to program a microcontroller it becomes more complex to write a code for desired output if you are not familiar with the basics of programming. Digital alarm with 8051 (89c51,89c52) microcontroller is an extension of digital clock with 8051 (89c51,89c52) microcontroller project.
In this simple tutorial, we will interface the 7 segment display with 8051 microcontrollers. we will program using Assembly language or Machine language which is very essential and the mother of all recent programming languages such as C or Embedded C.
Program For Digital Clock Using 8051 Microcontroller
About 7 segment Display: A seven-segment is one of the most basic displays that we can display number from 0 to 9( In Binary) or 0-F (in Hexadecimal). The seven-segment display pins (a,b,c,d,e,f,g) in addition to the decimal point of both a common anode and common cathode displays are connect to port pins of LPC1768 via current limiting resistors (220 Omega).
Assembly Language Code For Digital Clock Using 8051
Working principles: The Working principle of this project is very easy. The Counter will count Numbers from 0 to 9 and Loop it again and again. As the name suggests 7 segment displays with 8051 MCU, The code is written in Assembly language.
We have done some other useful tutorials using 7 segment displays such as counter from 0000 to 999 and also Full Digital clock.
Pins Configuration
Seven segments LED is a device having seven light-emitting diodes with either anode terminals (common anode or cathode) terminals. So, they form the shape of number 8.
To use this seven-segment display, once should know the pin configurations very well. As you came to know that, the display has got 9 pins in total,(Ag+DP+Common pins) but essentially, incase of Common Cathode, the display has 2 GNDs that are internally connected, so, the Sum is 9+1 = 10 pins.
A 7-Segment display has 7-segments/pins named as a, b, c, b, e, f, g to form the shape of “8” and another pin called ‘h’ for a decimal point along with two extra pins for GND when it comes to Common Cathode.
Common Cathode: All the positive terminals (Anodes) of all the 8 LEDs are connected together, named as COM Cathode. So, the negative terminals are left alone with a-g
Common Anode: All the negative terminals (Cathodes) of all the 8 LEDs are connected together, named as COM A. Then, all the positive terminals are left alone with a-g so as to connect to the port.
Components Required
- AT89C51 Microcontroller
- 7 segment display
- Crystal oscillator
- 22pf Capacitor
- Power Source 5v-9v
Circuit Diagram
Project Code
You should save the code as .asm since it’s written in Assembly language.
8051 Microcontroller Applications
Project Simulation
Program For Digital Clock Using 8051 Programming
![Program For Digital Clock Using 8051 Program For Digital Clock Using 8051](/uploads/1/1/7/7/117774175/432119853.jpg)
8051 Program Counter
That is the end of our simple tutorial. Hope you liked it, don’t forget to subscribe my channel at