This is an improved version of digital clock with LCD display. It has an extra feature to set the alarm in the starting. On reset, the LCD prompts the user to set alarm. Only the hour and minute components can be set by pressing the corresponding switches, repeatedly. These switches are made active low and so they provide ground to the corresponding input pins of the microcontroller AT89C51. The AM/PM mode is set by toggling the switch between ground and Vcc. Ground would set the clock in AM mode while Vcc would set it in PM mode.
After the alarm is set, the alarm pin is connected to Vcc (high) through switch. The procedure of setting time remains the same as with a simple digital clock. When the clock time becomes equal to the alarm time, a message ‘Alarm’ is displayed on LCD and alarm pin of microcontroller goes high for some duration. This pin can be connected to a speaker or buzzer to sound the alarm at the pre-set time.