pcbway




digital clock with 8051 microcontroller, 8051 digital clock,digital clock 8051, digital clock with 8051, interrupt based digital clock, digital clock with interruptHello friends, hope you all are fine and having fun with your lives. In today’s post, I am going to share Interrupt based Digital clock with 8051 Microcontroller. In the previous post, I have explained in detail How to use Timer Interrupt in 8051 Microcontroller. We have seen in that post that we can use two timers in 8051 Microcontroller which are Timer0 and Timer1. Using these timers we can easily generate interrupts. So, before going into details of this post, you must read that timer post as I am gonna use these timer interrupts in today’s post.

After reading this post, you will also get the skilled hand on timer interrupt and can understand them more easily. In today’s post, I am gonna design a digital clock which will increment after every one second and we will calculate this one second increment using timer interrupt. This clock will be displayed on LCD so if you are not familiar with LCD then must read Interfacing of LCD with 8051 Microcontroller. You can also implement this digital clock with any other microcontroller like Arduino or PIC Microcontroller but today we are gonna implement it on 8051 Microcontroller. The complete simulation along with code is given at the end of this post but my suggestion is to design it on your own so that you get most of it. Use our code and simulation as a guide. So, let’s get started with Interrupt based Digital clock with 8051 Microcontroller. 🙂

Interrupt Based Digital Clock with 8051 Microcontroller

  • First of all, design a circuit as shown in below figure:

digital clock with 8051 microcontroller, 8051 digital clock,digital clock 8051, digital clock with 8051, interrupt based digital clock, digital clock with interrupt

  • Now use the below code and get your hex file. I have designed this code in Keil uvision 3 compiler for 8051 Microcontroller.

  • Now run your simulation and if everything goes fine then you will get results as shown in below figure:

digital clock with 8051 microcontroller, 8051 digital clock,digital clock 8051, digital clock with 8051, interrupt based digital clock, digital clock with interrupt

  • The above figure is taken after 10 seconds of start of simulation in Proteus ISIS.
  • As the simulation keeps on running the clock will also keep on ticking.
  • The code is self explanatory but let me explain the interrupt function.
  • I have used Timer0 interrupt in this digital Clock.
  • The timer interrupt function is incrementing the userCounter variable by 250 which is in micro seconds. So we need 1000us as it will become 1 second. That’s why I have placed the check that when userCounter == 1000 then increment the second.
  • I have added comments in the code so read it in detail and still if you stuck somewhere then ask in comments and I will resolve them.
  • You can download the complete code along with Proteus Simulation by clicking the below button:

Download Proteus Simulation and Code for Digital Clock

That’s all for today. Hope you have enjoyed today’s project. Will meet you guys soon in the next post. Till then take care !!! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment