Design of Electronic Clock Based on AT89C51 Single Chip Microcomputer

Click the link to get Keil source code and Project Backups simulation diagram:
insert image description here
https://download.csdn.net/download/qq_64505944/87695258?spm=1001.2014.3001.5503
Source code acquisition

Main content:
1. Design the circuit of the electronic digital clock, and use protus to simulate and draw the corresponding circuit diagram
2. Design the source program of the electronic digital clock, and use Keil to edit and generate a HEX file
3. Test in protus.
Basic requirements:
1. Electronic digital clock circuit design diagram;
2. Electronic digital clock design source program;
2. Keil operation source program;
3. Simulation in protus;
4. Running result analysis.
Main reference materials:
[1] Tan Haoqiang. C. Program Design. Beijing: Tsinghua University Press, 2002
[2] Wang Weiqing, Cheng Guogang. Single-chip Keil Cx51 Application Technology Development, Beijing: People's University of Posts and Telecommunications Press, 2007
[3] Ma Zhongmei et al. .C language application programming design of single chip microcomputer. Beihang University Press, 2003.

           完  成  期  限:12 月 11 日 - 12 月 26 日  
        指导教师签名:                     
           课程负责人签名:                          

With the
development of science and technology and the progress of the times, digital electronic clocks have become a necessity in our lives. Digital clocks use digital circuits to realize the timing of hours, minutes, seconds, and digital displays. They are widely used in personal homes and stations. , wharf offices and other public places have become an indispensable necessity in people's daily life. Due to the development of digital integrated circuits and the wide application of quartz crystal oscillators, the accuracy of digital clocks far exceeds that of old-fashioned clocks. Life has brought great convenience, and greatly expanded the original timekeeping function of clocks and watches. Such as timing automatic alarm, automatic bell on time, automatic control of time program, timing broadcasting, automatic opening and closing of street lights, timing switch oven, on-off power equipment, and even automatic activation of various timing electrical appliances, etc., all of which are digitized by clocks and watches. based on. Therefore, it is of great practical significance to study digital clocks and expand their applications.
Compared with traditional mechanical clocks, electronic clocks have more prominent advantages. Due to the development of digital integrated circuits and the adoption of advanced quartz technology, the electronic clock has the advantages of accurate travel time, stable performance, and convenient portability. Various fields such as timing broadcasting and automatic control. This course design will use protus to simulate the circuit, and use Keil to complete the programming of the program. Finally realize the simulation of digital electronic clock

Key words: protus; Keil; 1602 digital electronic clock;

Table of contents

Abstract I
Contents II

  1. 1602 Digital Electronic Clock Development Method 1
    1.1 Development Background 1
    1.2 Development Platform 1
    1.3 Design Purpose 2
    1.4 Design Requirements 2

  2. System Design 3
    2.1 Function Design 3
    2.2 Circuit Design 3
    2.3 Single Chip Computer Control System 3
    2.4 LM016L Display 4

  3. Overall Circuit Design 6
    3.1 Display Module Design 6
    3.2 Button Module Design 6
    3.3 Reset Circuit Module Design 7
    3.4 Buzzer Design 8
    3.5 Circuit Overall Design 8

  4. Program design 10
    4.1 Overall program design 10
    5. Test and operation 24
    5.1 Electronic clock display test 24
    5.2 Time adjustment test 24
    5.3 Alarm clock setting test 26

  5. Summary 27
    References 28

  6. 1602 Digital electronic clock development method
    1.1 Development background
    1602 Digital electronic clock is an indispensable necessity in people's daily life. Electronic clock mainly uses modern electronic technology to digitize and digitize the clock. Compared with traditional mechanical clocks, it has accurate clock display and intuitive without machinery. The advantages of transmission devices have been widely used. In addition, in life and industrial and agricultural production, people have put forward many requirements for the functions of electronic clocks. Time-telling, alarm clocks, calendars, temperature display, this requires the multi-functionality of electronic clocks. Compared with traditional mechanical clocks, electronic clocks Clock has more prominent advantages. Due to the development of digital integrated circuits and the adoption of advanced quartz technology, the electronic clock has the advantages of accurate travel time, stable performance, and convenient portability. Various fields such as timing broadcasting and automatic control.
    1.2 Development platform
    (1) The platform used for the development of the digital electronic clock is proteus, and the Proteus software is an EDA tool software published by Lab Center Electronics in the United Kingdom. It not only has the simulation function of other EDA tool software, but also can simulate single-chip microcomputer and peripheral devices. It is a better tool for simulating microcontrollers and peripheral devices. Although domestic promotion has just started, it has been favored by single-chip microcomputer enthusiasts, teachers engaged in single-chip microcomputer teaching, and scientific and technological workers dedicated to the development and application of single-chip microcomputers.
    Proteus is a famous EDA tool (simulation software) in the UK. From schematic layout, code debugging to co-simulation of MCU and peripheral circuits, one-click switching to PCB design, it truly realizes the complete design from concept to product. It is the only design platform in the world that integrates circuit simulation software, PCB design software and virtual model simulation software. Its processor model supports 8051, HC11, PIC10/12/16/18/24/30/DSPIC33, AVR, ARM , 8086 and MSP430, etc. In 2010, Cortex and DSP series processors were added, and other series of processor models continued to be added. In terms of compilation, it also supports various compilers such as IAR, Keil and MATLAB.
    (2) Keil C51 is a 51 series compatible single-chip microcomputer C language software development system produced by Keil Software Company of the United States. Compared with assembly, C language has obvious advantages in function, structure, readability and maintainability, so Easy to learn and use. Keil provides a complete development solution including C compiler, macro assembler, linker, library management and a powerful emulation debugger, etc. These parts are combined through an integrated development environment (μVision). Running Keil software requires WIN98, NT, WIN2000, WINXP and other operating systems. If you use C language programming, then Keil is almost your best choice. Even if you do not use C language but only use assembly language programming, its convenient and easy-to-use integrated environment and powerful software simulation and debugging tools will make you get twice the result with half the effort.
    (3) Windows 11 is an operating system developed by Microsoft Corporation (Microsoft), which is used in devices such as computers and tablets. Published June 24, 2021, October 5, 2021.
    Windows 11 provides many innovative features, adds a new version of the start menu and input logic, etc., supports a mixed work environment that matches the times, and focuses on improving end-user productivity in a flexible and changeable experience.

1.3 Design purpose
Through this course design, a simple 1602 electronic clock is designed by using the knowledge of "Single-chip microcomputer principle and application", so as to combine the theoretical knowledge taught in the classroom with the actual operation. Review knowledge and improve your hands-on ability.
1.4 Design requirements
Design a single-chip microcomputer system, use Keil to write and program the program, and use proteus software to complete the system hardware and software design and simulation debugging. It is required to use AT89C51 as the control system, LM016 as the display, and a suggested electronic digital clock that is convenient and can adjust the time of the clock through buttons. Finally, the time can be normally displayed on the display, and the time can be adjusted.

2. System design
2.1 Functional design
1. Design an electronic clock with "hour", "minute" and "second" (23 hours, 59 minutes, 59 seconds) display and adjustable time.
2. Electronic clocks are composed of small and medium-sized integrated circuits.
2.2 Circuit design
If you want to make a single-chip microcomputer system, you must first think about what kind of circuit should be used, and take out the required circuit components, as shown in Figure 2-1 circuit design flow chart:

insert image description here

Figure 2-1 Control system

2.3 Single-chip control system
The control system used to realize the 1602 digital clock is AT89C51. AT89C51 is a low-voltage, high-performance CMOS 8-bit microprocessor with 4K bytes of Flash Programmable and Erasable Read Only Memory (FPEROM—Falsh Programmable and Erasable Read Only Memory), commonly known as a single-chip microcomputer. AT89C2051 is a single-chip microcomputer with 2K bytes flash programmable erasable read-only memory. The erasable read-only memory of the single-chip microcomputer can be repeatedly erased 100 times. The device is fabricated using ATMEL's high-density nonvolatile memory manufacturing technology and is compatible with the industry-standard MCS-51 instruction set and output pins. Due to the combination of multifunctional 8-bit CPU and flash memory in a single chip, ATMEL's AT89C51 is a high-efficiency microcontroller, and AT89C2051 is a stripped-down version of it. The AT89C51 single-chip microcomputer provides a flexible and cheap solution for many embedded control systems. The control system is shown in Figure 2-2:
insert image description here

Figure 2-2 Control system

2.4 LM016L display The
LM016L LCD module adopts the HD44780 controller. The hd44780 has a simple and powerful instruction set, which can realize functions such as character movement and flashing. The communication between the LM016L and the single-chip MCU can adopt two ways of 8-bit or 4-bit parallel transmission. The hd44780 The controller consists of two 8-bit registers, instruction register (IR) and data register (DR) busy flag (BF), display number RAM (DDRAM), character generator ROMA (CGOROM)_character generator RAM (CGRAM), address Counter RAM (AC) IR is used for resource storage instruction code, which can only be written and read; DR is used for resource storage data. The data is automatically written into DDRAM and CGRAM by internal operation, or the data read from DDRAM and CGRAM is temporarily stored. When BF is 1, the liquid product module is in internal mode and does not respond to external operation commands and accept data. DDTAM is used to store and display Characters can store 80 character codes. CGROM generates 5 to 7 dot matrix characters 160 and 5 to 10 dot matrix characters from 8-bit character codes to 32 types. The corresponding relationship between 8-bit character codes and characters, CGRAM is reserved for users to write special characters Yes, its capacity is only 64 bytes, you can customize 8 characters of 5 7 dot matrix or 4 characters of 5 10 dot matrix, AC can store the address of DDRAM and CGRAM, if the address code is written into R with the instruction, then R will automatically Load the address code into the AC, and select DDRAM or CGRA at the same time, the pin functions of the LM016L liquid product module are shown in Figure 2-3:
insert image description here

Figure 2-3 LM016L display

  1. Overall circuit design
    3.1 Display module design
    This course design uses LM016L as the display, and uses RESPACK-8 and 3214G-1-104E to form the display module. The display module diagram is shown in Figure 3-1:

insert image description here

Figure 3-1 LM016L display module

3.2 Button module design
Because the clock is required to adjust the time, the button module needs to use 5 buttons to adjust the time. Use five adjustment buttons to adjust the time, which are KI·K2·K3·K4·K5, among which K1 is the function selection key, which can adjust the hour or minute; K2 is the value plus one key; K3 is the value minus one key, K4 is the Confirm key, K5 is the key to adjust the alarm clock. The button module design is shown in Figure 3-2:
insert image description here

Figure 3-2 Button module design

3.3 Reset circuit module design
The microcontroller needs to be reset when starting, so that the CPU and system components are in a definite initial state, and start working from the initial state. The reset signal of the 89 series MCU is input from the RST pin to the Schmitt trigger in the chip. When the system is in normal working condition and the oscillator is stable, if there is a high level on the RST pin and maintains for more than 2 machine cycles (24 oscillation cycles), the CPU can respond and reset the system. The reset circuit is shown in Figure 3-3:

insert image description here

Figure 3-3 Reset circuit module design

3.4 Buzzer design
What is the single-chip SOUNDER, and the sounder is a digital buzzer component. The buzzer is an electronic sounder with an integrated structure. It is powered by DC voltage and is widely used as a sounding device in electronic products such as computers, printers, copiers, alarms, electronic toys, automotive electronic equipment, telephones, and timers. . Buzzers are mainly divided into two types: piezoelectric buzzers and electromagnetic buzzers. The design of the buzzer is shown in Figure 3-4:
insert image description here

Figure 3-4 Buzzer design
3.5 Overall circuit design
The electronic circuit design of the single-chip microcomputer requires that it can meet the requirements of a single operation, that is, the system function of the electronic device can be completed through simple operations. However, electronic circuit design requires comprehensive development in its functional role. The current application of single-chip microcomputers in electronic equipment systems can improve the security functions, display functions, early warning functions and other auxiliary functions of electronic equipment systems, and better promote the intelligent and refined development of electronic equipment systems. The overall design of the circuit is related to the success of the course design, and it is the top priority of this course design.
The overall circuit design diagram of the 1602 electronic digital clock is shown in Figure 3-5:
insert image description here

Figure 3-4 Overall circuit design

  1. Program design
    4.1 Overall program design
    After completing the circuit design, if you want to run the circuit, of course, you cannot do without the program design. Only when the program design meets the working conditions of the circuit and is combined with the circuit can the circuit run. Therefore, the programming code of the electronic clock is as follows:
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit RS=P2^6;
sbit RW=P2^5;
sbit E=P2^7;
sbit K1=P1^0;
sbit K2=P1^1;
sbit K3=P1^2;
sbit K4=P1^3;
sbit K5=P1^4;
sbit BEEP=P3^0;
unsigned char cishu=0;
unsigned char mode_flag;//状态标志位 0表示正处于正常,1设置时间,2设置闹钟
unsigned char Current_Time[]={
    
    "Current Time  "};	   //正常运行模式
unsigned char Set_time[]={
    
    "Set New Time..."};		   //设置时间模式
unsigned char Set_nao[]={
    
    "Set nao Time..."};		   //设置闹钟模式
unsigned char show_time[]={
    
    ">00:00:00"};
unsigned char now_shi=12,now_fen=30,now_miao;//运行时的时间变量
unsigned char temp_shi,temp_fen,temp_miao;//调时间的时间变量
unsigned char nao_shi=13,nao_fen=30,nao_miao;//闹钟的时间变量
unsigned char flag_sf; //0表示设置时,1表示设置分
//歌曲音调编码
uchar code SONG_TONE[]={
    
    212,212,190,212,159,169,212,212,190,212,142,159,212,212,106,126,159,169,190,119,119,126,159,142,159,0};
//歌曲长音节
uchar code SONG_LONG[]={
    
    9,3,12,12,12,24,9,3,12,12,12,24,9,3,12,12,12,12,12,9,3,12,12,12,24,0};
void display_mode();
void display_time(unsigned char shi,unsigned char fen,unsigned char miao);	
void keyscan();
void PlayMusic();
void lcd_w_cmd(unsigned char com);
void lcd_w_dat(unsigned char dat);
void lcd_int ();
void delay1(unsigned int i);
unsigned char lcd_r_start();
void been(unsigned int time);
void main()
{
    
    			 
	lcd_int ();	   //初始化lcd
	mode_flag=0;//运行
	display_mode();	  //调用显示模式函数
	TMOD=0x01;		//初始化定时器
	EA=1;			 //打开总中断
	TH0=(65536-50000)/256;			//赋初值
	TL0=(65536-50000)%256;
	ET0=1;						   //打开定时器T0中断标志位
	TR0=1;							//启动T0
	while(1){
    
    			
			if(mode_flag==0)display_time(now_shi,now_fen,now_miao);		  //状态标志位mode_flag=0表示正处于时间正常运行
			else display_time(temp_shi,temp_fen,temp_miao);			  //否则mode_flag为1时设置时间,为2时设置闹钟
			keyscan();			   //调用按键开关控制函数
			if(now_shi==nao_shi&&now_fen==nao_fen&&now_miao==nao_miao) PlayMusic();	  //如果正在运行的时间为闹钟的时间,则闹铃响(此为音乐)
	}	
}
void display_mode()//第一行模式的显示,有三种模式:(1)正在运行的显示Current_Time[]字符串(2)设置时间的显示Set_time[]字符串	(3)设置闹钟的显示Set_nao[]字符串
{
    
    
	 
	unsigned char i;
	lcd_w_cmd(0x82);	   //设置显示地址(第一行)
	if(mode_flag==0)		  //状态标志位mode_flag=0表示正处于时间正常运行
	{
    
    
		for(i=0;Current_Time[i]!='\0';i++)		//此处显示Current_Time[]字符串,字符串结束符为‘0’
		{
    
    
			lcd_w_dat(Current_Time[i]);
			
		}	
	}
	else if(mode_flag==1)
	{
    
    	
		for(i=0;Set_time[i]!='\0';i++)		//此处显示Set_time[]字符串,字符串结束符为‘0’
		{
    
    
			lcd_w_dat(Set_time[i]);
		
		}
	}
	else if(mode_flag==2)
	{
    
    
		 for(i=0;Set_nao[i]!='\0';i++)		//此处显示Set_nao[]字符串,字符串结束符为‘0’
		{
    
    
			lcd_w_dat(Set_nao[i]);		
		}
	}
}
void display_time(unsigned char shi,unsigned char fen,unsigned char miao)//第二行的数字显示
{
    
    
	unsigned char i;
	if(mode_flag==0)show_time[0]=' ';	 //如果mode_flag=0,第二行第0位显示' '
	else  show_time[0]='>';				 //否则第二行第0位显示'>'

	show_time[1]=shi/10+0x30;			 //第一位显示时的十位数
	show_time[2]=shi%10+0x30;			//第二位显示时的个位数

	show_time[4]=fen/10+'0';			 //第四位显示分的十位数
	show_time[5]=fen%10+'0';			 //第五位显示分的个位数

	show_time[7]=miao/10+'0';			  //第七位显示秒的十位数
	show_time[8]=miao%10+'0';			  //第八位显示秒的个位数

	lcd_w_cmd(0xC3);  //更改显示位置用
	for(i=0;show_time[i]!='\0';i++)		//此处显示show_time[]字符串,字符串结束符为‘0’
	{
    
    
		lcd_w_dat(show_time[i]);
	
	}
}
void keyscan()					  //按键控制,k1调时或分,k2加时或分,k3减时或分,k4确定调好的时间,k5调闹钟
{
    
    
	if(K1==0)
	{
    
    
		delay1(1000);
		if(K1==0)
		{
    
    
			if(mode_flag==0)			 //正在运行的时间要进入调时间的状态
			{
    
    
				been(300);
			   	temp_shi=now_shi;		
				temp_fen=now_fen;
				temp_miao=now_miao;
				mode_flag=1;
			}
			else{
    
     
					been(300);
				 	flag_sf=~flag_sf; //切换状态,flag_sf=0调时钟 flag_sf=1调分钟
				 }
				display_mode();
			while(!K1);	//松手检测
		}
	}
	if(K2==0)						  //加时或分
	{
    
    
		delay1(1000);
		if(K2==0)
		{
    
    
			if(mode_flag!=0)			
			{
    
     
				 been(300);
			   if(flag_sf==0)			//调时钟状态
			   {
    
    
			   	  temp_shi++;
				  if(temp_shi==24)temp_shi=0;		 //如果加时钟到24就清零
			   }
			   else {
    
    							   //调分钟状态
			   	  temp_fen++;
				  if(temp_fen==60)temp_fen=0;		  //如果加分钟到60就清零
			   }			  	
			}
			while(!K2);	//松手检测
		}	
	}	
	if(K3==0)						   //减时或分
	{
    
    
		delay1(1000);
		if(K3==0)
		{
    
    
			if(mode_flag!=0)
			{
    
    
				been(300);
			   if(flag_sf==0)			   //调时钟状态
			   {
    
    
			   	
				if(temp_shi==0)temp_shi=24;		//如果减时钟减到最低到0就又回到最高位24
			   	  temp_shi--;
				  
			   }
			   else {
    
    						 //调分钟状态

if(temp_fen==0)temp_fen=60;	//如果减分钟减到最低到0就又回到最高位60
			   	  temp_fen--; 
			   }	
			}
			while(!K3);	//松手检测
		}
	}
							 //确定设置的时间和调好闹钟的时间
	if(K4==0)
	{
    
    
		delay1(1000);
		if(K4==0)
		{
    
    
			if(mode_flag==1) //设置时间  设置好的时间确定后正常运行
			{
    
    
				been(300);
				now_shi=temp_shi;			   
				now_fen=temp_fen;
				now_miao=temp_miao;
				mode_flag=0;
			}
		if(mode_flag==2)	//设置闹钟	设置好的时间确定好之后定为闹钟
			{
    
    									 
				been(300);
				nao_shi=temp_shi;
				nao_fen=temp_fen;
				nao_miao=temp_miao;
				mode_flag=0;
			}
			while(!K4);	//松手检测
		}
		display_mode();			   //调用显示模式函数
	
	}

	if(K5==0)					   //设置闹钟
	{
    
    
		delay1(1000);
		if(K5==0)
		{
    
    
			if(mode_flag==0)
			{
    
    
			   been(300);
			   mode_flag=2;
			   temp_shi=nao_shi;
			   temp_fen=nao_fen;
			   temp_miao=nao_miao;
			}		  
			display_mode();
			while(!K5);	//松手检测
		}
	}
}
void been(unsigned int time)
{
    
    
	unsigned int i;
	for(i=0;i<time;i++)
	{
    
    
		 BEEP=~BEEP;		  
		 delay1(10);	
	}
}
void delay(uint ms)	   //闹铃的延时函数
{
    
    
 char t;
 while(ms--) for(t=0;t<120;t++);
}
void PlayMusic()
{
    
    
uint i=0,j,k;
while (SONG_LONG[i]!=0||SONG_TONE[i]!=0)
 {
    
    
  for(j=0;j<SONG_LONG[i]*30;j++)
  {
    
    
   BEEP=~BEEP;
   for(k=0;k<SONG_TONE[i]/4;k++);
  }
  delay(10);
  i++;
  display_time(now_shi,now_fen,now_miao);	
 }
}
//函数名:time0
//函数功能:定时器T0的中断函数,T0在工作方式1下每50ms产生中断,执行该中断函数
void time0() interrupt 1		 
{
    
    
	TH0=(65536-50000)/256;
	TL0=(65536-50000)%256;
	cishu++;
	if(cishu==20)			   //一秒时间到后,次数清零,秒数加一
	{
    
    
		cishu=0;
		now_miao++;
	}
	if(now_miao==60)			//60秒时间到后,秒数清零,分钟加一
	{
    
    
	 	now_miao=0;
		now_fen++;
	}

	if(now_fen==60)			//60分钟时间到后,分钟清零,时钟加一
	{
    
    		
	  now_fen=0;
	  now_shi++;
	}
	if(now_shi==24)				 //24小时到后,时钟清零
	{
    
    
	   now_shi=0;
	}
}
//函数名:lcd_int
//函数功能:lcd初始化
void lcd_int()
{
    
    
	lcd_w_cmd(0x3c);	//设置工作方式
	lcd_w_cmd(0x0c);	  //设置显示状态
	lcd_w_cmd(0x01);	 //清屏
	lcd_w_cmd(0x06);	 //设置输入方式
	lcd_w_cmd(0x80);	 //设置初始显示位置
}
//函数名:lcd_w_cmd
//函数功能:写命令
//形式参数:命令字已经存入com单元中
void lcd_w_cmd(unsigned char com)
{
    
    
	unsigned char i;
	do
	{
    
    						 //查lcd忙状态
	i=lcd_r_start();		  //调用读状态字函数
	i&=0x80;				   //“与”操作屏蔽掉低7位
	delay1(2);
	}while(i!=0);				//lcd忙,继续查询,否则退出循环 
	RW=0;
	delay1(1);
	RS=0;						 //RW=0,RS=0,写lcd命令字
	delay1(1);
	E=1;						  //E端时序以0或1高低波动
	delay1(1);
	P0=com;						  //将com中的命令字写入lcd数据口
	delay1(1);
	E=0;
	delay1(1);
	RW=1;
	delay1(2);
}
void lcd_w_dat(unsigned char dat)
{
    
    
	unsigned char i;
	do
	{
    
    						   //查忙操作
	i=lcd_r_start();		   //调用读状态字函数
	i&=0x80;				   //“与”操作屏蔽掉低7位
	delay1(2);
	}while(i!=0);			   //lcd忙,继续查询,否则退出循环 
	RW=0;
	delay1(1);
	RS=1;						 //RW=0,RS=1,写lcd命令字
	delay1(1);
	E=1;						  //E端时序以0或1高低波动
	delay1(1);
	P0=dat;					   //将dat中的显示数据写入lcd数据口
	delay1(1);
	E=0;
	delay1(1);
	RW=1;
	delay1(2);
}
void delay1(unsigned int i)
{
    
    
	unsigned int k;
	for(k=0;k<i;k++);
}
//函数名:lcd_r_start
//函数功能:读状态字
unsigned char lcd_r_start()
{
    
    
	unsigned char s;
	RW=1;			  //RW=1,RS=0,读lcd状态
	delay1(1);
	RS=0;
	delay1(1);
	E=1;			   //E端时序以0或1高低波动
	delay1(1);
	s=P0;				 //从lcd的数据口读状态  
	delay1(1);
	E=0;
	delay1(1);
	RW=0;
	delay1(1);
	return(s);			 //返回值s读取状态忙或空闲
}

5. Test and operation
5.1 Electronic clock display test
After completing the circuit design and program design, make the program into a project, put the generated HEX file into the AT89C51 controller, and then start the test. After starting the test, the display of the electronic clock As shown in Figure 5-1:

insert image description here

Figure 5-1 Electronic clock display test
5.2 Time adjustment test
After completing the display test of the above electronic clock, the time adjustment test of the electronic clock will start. Whether the electronic clock can be adjusted normally is the most important thing in this course design Heavy, only electronic clocks capable of time adjustment can be truly used in the production of electronic clocks. The time adjustment tests of electronic clocks are shown in Figures 5-2 and 5-3:
insert image description here

Figure 5-2 Electronic clock time adjustment test
insert image description here

Figure 5-3 Electronic clock time adjustment test

5.3 Setting the alarm clock test
After completing the above test, you can intuitively feel that the electronic clock can be adjusted normally, which can add or subtract time. Next, set the alarm clock. The test result is shown in Figure 5 -4 shows:

insert image description here

Figure 5-4 Electronic clock setting alarm clock test

After completing all the above tests, it can be proved that the 1602 digital electronic clock can operate normally. It can adjust the time, set the alarm clock, and the buzzer can also work normally. Although the functions are very limited, it is basically The design requirements have been fulfilled.

  1. Summary
    Through the production of this course design work, I have a deeper understanding of the theory of single-chip microcomputers. The electronic digital clock I designed this time is a very common item in daily life. However, the real In the design, I found that I encountered a lot of troubles, circuit design, program design. There are many difficulties, not only the knowledge of single-chip microcomputer used in the classroom, but also the knowledge of c language and circuit knowledge learned in freshmen and sophomores. At the same time, in the specific production process We found that there is a big gap between the knowledge in books and the actual application. Many of the knowledge in books are idealized conclusions, ignoring many practical factors, or not comprehensive. These cannot be ignored, and we have to consider this aspect of the problem, which prevents us from easily obtaining the expected results based on the theories in the book, and sometimes the results are even very different. Through this practice, I have a deeper understanding of the importance of linking theory with practice.
    Through this course design, I understand that the combination of theory and practice is very important, and it has further deepened my understanding of the theoretical knowledge of single-chip microcomputers, the use of C language and the understanding of circuits. I understand that only theoretical knowledge is not enough. Only by combining the theoretical knowledge learned with practice and drawing conclusions from the theory can we truly serve the society, thereby improving our practical level and independent thinking level. It can be said that there were many difficulties encountered in the design process, but the good news is that they were all resolved in the end.

Guess you like

Origin blog.csdn.net/qq_64505944/article/details/130187122