Comprehensive Library of AD Package Components:Package Library
Resource Directory:
This design
Electronic Clock with Calendar Using 51 Microcontroller and LCD1602 Display (Proteus Simulation + Program + Report + Component List)
Simulation Diagram: Proteus 7.8
Compiler: Keil 4/Keil 5
Programming Language: C
Number: C0002
Main Functions:
1. Uses LCD1602 display, DS1302 records calendar and time.
2. Button settings for date, time, and alarm.
3. When the actual time reaches the set alarm time, the buzzer sounds an alarm.
Simulation Diagram (Source files provided):
Program (Source code provided):
The following is part of the program; the complete program can be obtained from the download link:
/*****************Main Function********************/
void main(){
beep = 0; // Beep once on startup
delay_1ms(150);
P0 = P1 = P2 = P3 = 0xff; // Initialize microcontroller IO ports to 1
init_time0(); // Initialize timer
//init_ds1302(); // Initialize DS1302
init_1602(); // Initialize LCD1602
init_1602_dis_csf(); // Initialize LCD1602 display
while(1) {
key(); // Key program
if(key_can < 10) {
if(flag_beep_en == 0) // Only enter settings when alarm is off
key_with();
else {
flag_beep_en = 0; // Press any key to turn off alarm
beep = 1;
clock_value = 0;
read_time();
}
}
if(flag_200ms == 1) {
flag_200ms = 0;
if(menu_1 == 0) {
read_time(); // Read time
init_1602_ds1302(); // Display clock
}
}
menu_dis(); // Alarm function
delay_1ms(1);
}
}
Report:
Component List:
Download Link for Materials:
Note: The simulation program and other source files need to be opened on a computer. Download them to your computer and use the extraction password to decompress! Do not use a mobile phone to decompress! For more resources, scan the QR code at the top of the article to search for related designs.