Circuit Diagram
This clock works in 12 hour mode and is configured by programming the microcontroller AT89S51. The program uses a delay function for producing a delay of 1 second.
The connections in the circuit are as following: port P2 of microcontroller is used as data input port which is connected to data pins (7-14) of LCD. P3^0, P3^1 and P3^6 pins of microcontroller are connected to control pins RS, RW and EN of LCD. P1^0, P1^1, P1^2 and P1^3 pins of microcontroller are connected to tactile switches to take manual inputs.
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 AT89S51. 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 that the LCD prompts the user to set time. 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 controller. 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. The clock starts when start pin is connected to Vcc by pressing the switch.
The set time is displayed on LCD screen and changes as the time passes on. Seconds are increased after every one second by making use of delay function. As second reaches 59, minute is incremented by one and second is reset to 0. Similarly, as minute reaches 59, hour is increased by one and minute is set to 0. After hour reaches 11, minute reaches 59 and second reaches 59, all of them are set to 0 and the AM/PM mode is changed accordingly.
CODE
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.
Crystal value?
ReplyDeleteIts OK, but don't forget a link back to my blog.
ReplyDeleteThanks awesome reach Best Spy Alarm Clock Camera
ReplyDeleteHey, thank you for this awesome information about digital alarms. Buy cubietime which is an alarm clock that you can use in hotel guestrooms.
ReplyDelete