It’s an example of 8051 Digital Clock On 16×2 LCD.
In this example we have configured 8051 timer0 for time calculation. There are 4 different modes for timer0 in 8051. We have selected 8 bit auto reload mode. In this mode timer0 hardware is automatically reset upon overflow to a predefined value and again starts counting up. Timer0 counts up 1 after 12 clocks of main system clock oscillator. So if we are using 12 MHz crystal then timer0 input frequency will be 1 MHz.
Here in this project system clock is of 24 MHz and timer0 input clock is 2 MHz. It is reset to value 6 after each overflow. Simply each timer interrupt is occurred after 125 micro seconds. And so in this way if 8 interrupts has occurred then 1 millisecond has passed and if 8000 interrupts has occurred then 1 second has passed and so on. In this way we calculate hours and minutes also. This time is updated on 16×2 LCD regularly. For detail of LCD interfacing please see 8051 To 16×2 LCD Interfaing. Buttons are provided for time settings.
For basic operation & components used in an 8051 based microcontroller based systems see
8051 Basic LED Flasher.
8051 Timer0 As Second Counter On 7 Segment
8051 Digital Clock On 7 Segment (Non Multiplexed)
PC Serial RS232 Port Interface To 16×2 LCD