8051 Microcontroller Digital Alarm – Project Requirements
- 8051 Microcontroller (89c51 or 89c52)
- alarm (I used a bell)
- LCD 16×2
- Variable potentiometer/resistor (to set LCD contrast)
- 4×3 Keyboard (You can also use 4×4. 4×4 contains 4×3:D)
- Crystal (11.0592 MHz)
- Breadboard (Designing circuit. You can also design circuit on PCB (Printed Circuit Board))
Tutorials on the 8051 Digital Alarm Clock Project
- How to generate a one second delay with the 8051 microcontroller.
- How to generate a one minute delay with the 8051 microcontroller.
- How the 16×2 LCD works.
- Digital clock with 8051 microcontroller.
All the above tutorials play a vital role in the 8051 digital alarm clock project. I will say that the code of all the above tutorials is part of this project. I just arranged the code in sequence with some minor modifications and made a one-line code flow to achieve the digital alarm clock functionality.
Digital Alarm Clock – Code Flow
Note: No external RTC (real time clock) interfaces with the 8051 microcontroller for time calculation. Instead, the 89c51 myrocontroller's internal timers are used to produce the clock time (see above digital clock with 89c51 tutorial).
89c51 Microcontroller Digital Alarm – Circuit Diagram
Microcontroller digital alarm clock 89c51 – Project code
Then keyboard function is declared. This function checks the keys pressed on the 4×3 keyboard. Next comes the torch function. It is used to handle integer type numbers to be displayed on 16×2 LCD. Integers must be converted to 8-bit character format for display on 16×2 LCD.
Then single bits of ports are declared to connect our 4x3 doorbell and keypad. The next character matrices are declared and are used as messages to be displayed on 16×2 LCD under suitable conditions. delay function is used to generate some delay for suitable purposes. lcdcmd function is sending commands to lcd. LCD data function is sending and printing data on the LCD screen. checking conditions The function is checking conditions such as whether the seconds have reached 60 minute increments, whether the minutes have reached 60 hour increments, check whether the clock has reached the alarm time ring the bell.
Clock delay function is producing seconds, minutes and hours for us. lcdinit initializing the lcd. set time The function is to set the clock time each time the program is restarted. The user must enter the time using the 4×3 keyboard. start The function is printing the time on 16×2 LCD at the beginning of the program execution.
The above tutorials are very important if you want to understand the functions used in the code. If you don't care about code, just record the hex code, make the circuit and enjoy your creation