基于单片机的电子时钟电子时钟直接设置定时时间,并实时显示剩余时间

关于电子时钟扫描时间设定的【单片机吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:149,628贴子:
关于电子时钟扫描时间设定的收藏
程序如下 #include&reg52.h&#define uchar unsigned char#define ulong unsigned long#define uint unsigned intuchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};uchar code wela[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdF,0xbF,0x7F};
//位选控制
查表的方法控制ulong num1,shi,ge,bai,qian,wan,top,x,y;uchar num,i;void delayms(uint);void display(ulong,ulong,ulong,ulong,ulong,ulong);void main(){TMOD=0x01;//设置定时器0为工作方式1(M1M0为01)TH0=()/256;//12.000MHz晶振定时50ms,N=52MHz为45872 TL0=()%256;EA=1;
//开总中断ET0=1;
//开定时器0中断TR0=1;
//启动定时器0P2=0X00;while(1)
//程序停止这里等待中断发生{
if(num==20)
//20次说明1秒时间到{
//num1清零重新再计20次
if(num1==86400)//数码管显示,到60后清零,说明一分钟到
x=num1/60;
y=num1/3600;
shi=(num1-60*x)/10;
ge=(num1-60*x)%10;
qian=(num1-3600*y)/60/10;
bai=(num1-3600*y)/60%10;
wan=num1/3600%10;
top=num1/3600/10;
display(shi,ge,bai,qian,wan,top);
void display(ulong shi,ulong ge,ulong bai,ulong qian,ulong wan,ulong top) {uint LedOut[10];
LedOut[0]=table[ge];
LedOut[1]=table[shi];
LedOut[2]=0x40;
LedOut[3]=table[bai];
LedOut[4]=table[qian];
LedOut[5]=0x40;
LedOut[6]=table[wan];
LedOut[7]=table[top];
for( i=0; i&9; i++) {
P0 = LedOut[i]; P2 = wela[i];
//使用查表法进行位选
/*switch(i)
//使用switch 语句控制位选
case 0:P2 = 0x7F;
case 1:P2 = 0xbF;
case 2:P2 = 0xdF;
case 3:P2 = 0xeF; case 4:P2 = 0xf7;case 5:P2 = 0case 6:P2 = 0case 7:P2 = 0
delayms(8); //扫描间隔时间
太长会数码管会有闪烁感P0=0x00;
void T0_time()interrupt 1{
TH0=()/256;
//重装初值
TL0=()%256;
void delayms(uint xms){
for(a=a&0;a--)
//延时x毫秒
for(j=50;j&0;j--);}
同步整流升压芯片,小封装升压芯片,大电流升压芯片,免费提供样品及DEM板测试,快充3V升12V/1.5A升压方案 免费提供样品板联系:
不管怎么设置
数码管总会闪烁
不懂帮顶。。。
顶顶顶。。。。
求大神帮主设置扫描时间
用两组IO口控制的位选
实物图如上
求顶求帮助
一共就8位,你的i&9 从何而来
超低功耗,256KB-512KB闪存,可扩展存储器,备有开发板
对啊,不是就8位么?ledout[8]也没定义,应该默认是0x00吧~
登录百度帐号51单片机可调电子时钟 - 单片机/MCU论坛 -
中国电子技术论坛 -
最好最受欢迎电子论坛!
后使用快捷导航没有帐号?
51单片机可调电子时钟
14:47:58  
28897&查看
1.元件清单1.STC89C52单片机一块、直插DIP-40插座2.三位七段共阳数码管LG3631BH型号两块3.12M晶振一枚4.蜂鸣器一只5.S85501PNP三极管一个6.9脚排阻10K一个7.1k电阻两个8.6脚自锁式开关3个、4脚按钮开关3个9.2个3V纽扣电池及其电池座两个10.发光二极管1支11.瓷片电容30pf两片12.芯片74HC245两片2.电路图
QQ截图08.jpg (80.55 KB, 下载次数: 186)
14:47 上传
file:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-3244.pngProteus仿真图3.实物图file:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-29706.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-32753.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-5034.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-31203.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-19450.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-19622.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-5693.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-1365.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-2150.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-12882.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-28323.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-20768.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-21068.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-18446.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-24933.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-12860.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-783.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-14528.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-2202.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-18933.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-10267.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-18488.pngfile:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-5291.png手工焊接实物图4.操作说明如上图实物图所示,按下电源开关后,电源指示灯亮,数码管从00.00.00开始走秒显示;按下单片机右边的上方自锁开关,时钟进入时间校准状态,通过第一个按钮开关切换秒、分、时部分的设置,中间按钮开关对相应部分进行加1调整,右边按钮开关对相应部分进行减1调整,设置完后将自锁式开关按起,回到正常的工作状态;同理,按下下方的自锁式开关,时钟进入时间校准状态。5.基本原理本次电子时钟项目设计对单片机定时器0装初值,使其初值对应50ms,定时器0的中断次数达到20次酒钢好为1s,当秒部分计数到60时置零,并向分部分进一;当分部分计数到60时置零,并向时部分进一,当时部分计数到24时置零,从而满足时钟的正常工作。& & & & 本次设计设置5个键依次对其进行时间校准设置、定时设置、秒分时切换、加1调整、减1调整。当时间校准设置键被按下,关闭T0定时器,时钟停止工作,此时数码管显示的即为当前时间校准设置的界面,设置好后,打开T0定时器,时钟在设置好的时刻上继续走秒工作;当定时设置键被按下,将当前的时刻赋给定时前的时分秒时刻变量,并将数码管显示切换到定时设置界面进行设置(此时的时钟仍在继续正常工作,只是在定时设置时没病显示出来罢了),当设置好后,记下要定时的时刻,数码管显示又还原到时钟正常工作的界面;当正常工作的时钟时刻到达了预置的定时时刻,蜂鸣器发声警报。6.元器件介绍相信你们对这上面的元器件都了解,我就不再赘述,主要讲一下就是74HC245芯片,总线收发器(bus transceiver),典型的CMOS型三态缓冲门电路。   由于单片机或CPU的数据/地址/控制总线端口都有一定的负载能力,如果负载超过其负载能力,一般应加。另外,也可以使用74HC244等其他电路,74HC244比74HC245多了。   74HC245实物图: 引脚定义:第1脚DIR,为输入输出端口转换用,DIR=“1”高电平时信号由“A”端输入“B”端输出,DIR=“0”低电平时信号由“B”端输入“A”端输出。   第2~9脚“A”信号输入输出端,A0=B0、、、、、、A7=B7,A0与B0是一组,如果DIR=“1”OE=“0”则A1输入B1输出,其它类同。如果DIR=“0”OE=“0”则B1输入A1输出,其它类同。   第11~18脚“B”信号输入输出端,功能与“A”端一样,不再描述。   第19脚OE,使能端,若该脚为“1”A/B端的信号将不导通,只有为“0”时A/B端才被启用,该脚也就是起到开关的作用。   第10脚GND,电源地。   第20脚VCC,电源正极。   TRUTH TABLE真值表file:///C:\Users\TSUI\AppData\Local\Temp\ksohtml\wps_clip_image-11896.pngH=高电平 L=低电平 ×=不定Absolute Maximum Ratings绝对最大额定值 Supply Voltage电源电压(VCC)-0.5 to -7.0V   DC Input Voltage DIR and G pins (VIN) 直流输入电压方向和G引脚(输入电压) -1.5 to VCC -1.5V   DC Input/Output Voltage (VIN, VOUT)直流输入/输出电压 -0.5 to VCC -0.5V Clamp Diode Current 钳位二极管电流(ICD)±20 mA DC Output Current直流输出电流,每个引脚(输出)   ±35 mA   DC VCC or GND Current, per pin (ICC)   ±70 mA   Storage Temperature Range 储存温度范围(TSTG)   -65℃ to -150℃   Power Dissipation (PD)功耗 (Note 3)   600 mW   S.O. Package only   500 mW   Lead Temperature (TL) (Soldering 10 seconds)   260℃74HC245的作用:信号功率放大。   第1脚DIR,为输入输出端口转换用, DIR=“1”高电平时信号由“A”端输入“B”端输出, DIR=“0”低电平时信号由“B”端输入“A”端输出。第2~9脚“A”信号输入输出端,A1=B1﹑﹑﹑﹑﹑﹑A8=B8,A1与B1是一组,如果 DIR=“1”G=“0”则A1输入B1输出,其它类同。如果DIR=“0”G=“0”则B1输入A1输出,其它类同。 第11~18脚“B”信号输入输出端,功能与“A”端一样,不在描述。第19脚G,使能端,若该脚为“1”A/B端的信号将不导通,只有为“0”时A/B 端才被启用,该脚也就是起到开关的作用 第10脚GND,电源地。第20脚VCC,电源正极。7.程序代码/***************************************************东方智达科技www.east027.com淘宝店铺:http://east027.taobao.com& & & & 具有闹钟功能的电子时钟程序设计,晶振为11.0592M***************************************************/#include&reg51.h&#define uchar unsigned char#define uint unsigned int& & & && & sbit s1=P2^0;& & & & & & & && &//数码管位选控制端sbit s2=P2^1;sbit s3=P2^2;sbit s4=P2^3;sbit s5=P2^4;sbit s6=P2^5;sbit s7=P2^6;/*k1设置时间,k2定时。k1,k2使用不自动弹起按键。k3时分秒选择,k4加数字,k5减数字。*/sbit k1=P1^0;& & & && & sbit k2=P1^1;sbit k3=P1^2;sbit k4=P1^3;sbit k5=P1^4;uchar count=0,sec,min,hour,ss=0;s=60,m=60,h=24;uchar code mum[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; //共阳数码管0-9编码void delayms(uint k)& & & && & //延时函数{& & & & uint i,j;& & & & for(i=k;i&0;i--)& & & & & & & & for(j=110;j&0;j--);}/*通过count获得hour,min,sec变量值& & & & */void timecontrol()& & & & { & & & & sec++;& & & & if(sec==60)& & & & {& & & & & & & & sec=0;& & & & & & & & min++;& & & & & & & & if(min==60)& & & & & & & & {& & & & & & & & & & & & min=0; & & & & & & & & & & & & hour++;& & & & & & & & & & & & if(hour==24)& & & & & & & & & & & & hour=0;& & & & & & & & }& & & & }}void display(uchar zs,uchar zm, uchar zh)& & & & & & & & & & & & //数码管显示函数{&&& & & & &&s1=1;&&P0=mum[zh/10];&&delayms(5);&&s1=0;& &&&s2=1;&&P0=mum[zh%10]&0x7f;& & & && & // 时的个位加上小数点&&delayms(5);&&s2=0;& &&&s3=1; &&P0=mum[zm/10];& & & & &&delayms(5);&&s3=0;&&&&s4=1;&&P0=mum[zm%10]&0x7f;& & & & & & & & //分的个位加上小数点&&delayms(5);&&s4=0;& &&&s5=1;&&P0=mum[zs/10];&&delayms(5);&&s5=0;& & &&s6=1;& & & & &&P0=mum[zs%10];&&delayms(5);&&s6=0; }void keyscan_settime()& & & & & & & && &//时间设置模块{& & & & uchar st,mt,& & & & if(k1==0)& & & & {& & & & & & & & delayms(10);& & & & & & & & if(k1==0)& & & & & & & & {& & & & & & & & st=sec,mt=min,ht=& & & & & & & & TR0=0;& & & & & & & &&&//关闭定时器& & & & & & & & while(k1==0) & & & & //等待用户按键& & & & & & & & {& & & & & & & & & & & & display(st,mt,ht);& & & & & & & & & & & & & & & & & & & & & & & & if(k3==0)& & & & & & & & & & & & {& & & & & & & & & & & & & & & & delayms(10);& & & & & & & & & & & & & & & & if(k3==0)& & & && && & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & while(!k3);& & & & & & & & & & & & & & & & ss++;& & & & & & & & & & & & & & & & if(ss==3)& & & & ss=0;& & & & & & & & & & & & & & & & }& & & & & & & & & & & & }& & & & & & & & & & & & /*通过ss选择时分秒设置*/& & & & & & & & & & & & if(k4==0)& & & & & & & & //加数& & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & &&&& & & & delayms(10);& & & & & & & & & & & & & & & & & & & & if(k4==0)& & & & & & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & & & while(!k4);& & & & & & & & & & & & & & & & & & & & switch(ss)& & & & & & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & & & case 0:st++;if(st==60)st=0;& & & & & & & & & & & & & & & & & & & & case 1:mt++;if(mt==60)mt=0;& & & & & & & & & & & & & & & & & & & & case 2:ht++;if(ht==24)ht=0;& & & & & & & & & & & & & & & & & & & & & & & & default :;& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & if(k5==0)& & & & & & & & //减数& & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & &&&& & & & delayms(10);& & & & & & & & & & & & & & & & & & & & if(k5==0)& & & & & & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & & & while(!k5);& & & & & & & & & & & & & & & & & & & & switch(ss)& & & & & & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & & & case 0:if(st&0)st--;& & & & & & & & & & & & & & & & & & & & & & & & & & & & else& & & & st=0;& & & & & & & & & & & & & & & & & & & & case 1:if(mt&0)mt--;& & & & & & & & & & & & & & & & & & & & & & & & & & & & else& & & & mt=0;& & & & & & & & & & & & & & & & & & & & case 2:if(ht&0)ht--;& & & & & & & & & & & & & & & & & & & & & & & & & & & & else& & & & ht=0;& & & & & & & & & & & & & & & & & & & & & & & & default : ;& & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & }& & & & & & & & & & & & TR0=1;& & & & & & & & & & & & sec=st,min=mt,hour=& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & display(sec,min,hour);}void keyscan_time()& & & & & & & & //用户定时模块{& & & & if(k2==0)& & & & {& & & & & & & & delayms(10);& & & & & & & & & & & & & & & & if(k2==0)& & & & & & & & {& & & & & & & & s=m=h=& & & & & & & & while(k2==0) & & & & //开始定时设置& & & & & & & & {& & & & & & & & & & & & display(s,m,h);& & & & & & & & & & & & if(k3==0)& & & & & & & & & & & & {& & & & & & & & & & & & & & & & delayms(10);& & & & & & & & & & & & & & & & if(k3==0)& & & && && & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & while(!k3);& & & & & & & & & & & & & & & & ss++;& & & & & & & & & & & & & & & & if(ss==3)& & & & ss=0;& & & & & & & & & & & & & & & & }& & & & & & & & & & & & }& & & & & & & & & & & & /*通过ss选择时分秒设置*/& & & & & & & & & & & & if(k4==0)& & & & & & & & //加数& & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & &&&& & & & delayms(10);& & & & & & & & & & & & & & & & & & & & if(k4==0)& & & & & & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & & & while(!k4);& & & & & & & & & & & & & & & & & & & & switch(ss)& & & & & & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & & & case 0:s++;if(s==60)s=0;& & & & & & & & & & & & & & & & & & & & case 1:m++;if(m==60)m=0;& & & & & & & & & & & & & & & & & & & & case 2:h++;if(h==24)h=0;& & & & & & & & & & & & & & & & & & & & & & & & default :;& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & if(k5==0)& & & & & & & & //减数& & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & &&&& & & & delayms(10);& & & & & & & & & & & & & & & & & & & & if(k5==0)& & & & & & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & & & while(!k5);& & & & & & & & & & & & & & & & & & & & switch(ss)& & & & & & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & & & case 0:if(s&0)s--;& & & & & & & & & & & & & & & & & & & & & & & & & & & & else& & & & s=0;& & & & & & & & & & & & & & & & & & & & case 1:if(m&0)m--;& & & & & & & & & & & & & & & & & & & & & & & & & & & & else& & & & m=0;& & & & & & & & & & & & & & & & & & & & case 2:if(h&0)h--;& & & & & & & & & & & & & & & & & & & & & & & & & & & & else& & & & h=0;& & & & & & & & & & & & & & & & & & & & & & & & default : ;& & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & }& & & & } }void buz(){if((hour==h)&&(min==m)&&(sec==s))& & & & {& & & & s7=0;& & & & delayms(20);& & & & s7=1;& & & & }}void main(){& & & & TMOD=0x01;& & & & & & & & & & & & & & & & //定时器0工作在方式1& & & & TH0=()/256;& & & && & //装初值,50ms& & & & TL0=()%256;& & & & EA=1;& & & & & & & && &//总中断允许& & & & ET0=1;& & & & & & & &&&//T0中断允许& & & & TR0=1;& & & & & & & &&&//开定时器0& & & & while(1)& & & & {& & & & & & & & keyscan_settime();& & & & & & & & keyscan_time();& & & & & & & & & & & & buz();& & & & & & & & }}void T0_ms() interrupt 1& & & && &//中断入口程序{& & & & TH0=()/256;& & & & & & & & //重新装初值& & & & TL0=()%256;& & & & count++;& & & & if(count==20)& & & & & & & &&&//判定1s时间是否已到& & & & {& & & & & & & & count=0; & & & & & & & & timecontrol();& & & & }}武汉东方智达:www.east027.com淘宝店网址:http://east027.taobao.com联系电话:027-QQ:
助理工程师
16:16:30  
最近也在搞这个
高级工程师
16:20:29  
助理工程师
10:54:45  
ddddddddddd
22:57:29  
实物图看不到
23:00:37  
助理工程师
21:27:39  
21:49:34  
00:19:35  
感觉程序有欠缺。。不过还是顶一下。。
助理工程师
22:43:17  
为什么没有图片????????
13:28:48  
07:25:34  
怎么没有焊接实物图!!!
高级工程师
08:48:43  
00:33:46  
01:37:18  
{:1:}{:1:}
高级工程师
09:15:36  
助理工程师
13:27:30  
程序不行啊
高级工程师
14:54:53  
15:56:02  
16:39:00  
Powered by
供应链服务
版权所有 (C) 深圳华强聚丰电子科技有限公司基于单片机的LCD电子时钟设计_自动化专业论文-人大经济论坛
您的位置:
基于单片机的LCD电子时钟设计_自动化专业论文
发布时间:
自动化专业论文范文
AbstractII
第一章 绪 论1
1.2 系统任务与实现1
1.3 芯片的选择2
1.3.1 单片机的选择3
1.3.2 时间芯片的选择3
1.3.3 显示器的选择4
第二章 AT89C51单片机介绍5
2.1 AT89C51简介5
2.2 AT89C51的主要特性6
2.3 AT89C51的管脚说明6
2.4 AT89C51振荡器特性8
2.5 AT89C51的芯片擦除功能8
第三章 时间芯片DS1302介绍9
3.1 DS1302的结构及工作原理9
3.1.1 引脚功能及结构9
3.1.2 DS1302的控制字节10
3.1.3 数据输入输出(I/O)10
3.1.4 DS1302的寄存器10
3.2 DS1302实时显示时间的硬件11
3.3 DS1302的实际应用11
第四章 硬件设计12
4.1 电子时钟系统的结构12
4.1.1 中央处理单元12
4.1.2 时钟部分12
4.1.3 LCD液晶显示部分12
4.1.4 报警部分12
4.1.5 按键设置部分13
4.2 硬件电路总体设计13
4.3 时钟电路14
4.4 LCD液晶显示电路14
4.4.1 LCD1602简介14
4.4.2 字符显示15
4.4.3 与单片机的接口17
4.5 报警电路18
4.6 按键设置电路19
第五章 软件设计20
5.1 系统主程序20
5.2显示部分程序21
5.3 按键部分程序21
第六章 系统调试与性能分析23
第七章 结 论25
参考文献27
附录一:28
附录二:30
单片机,是集CPU ,RAM ,ROM ,计数和多种接口于一体的微控制器。自20世纪70年代问世以来,以其极高的性能价格比,受到人们的重视和关注。它体积小、重量轻、抗干扰能力强、环境要求不高、价格低廉、可靠性高、灵活性好、开发较为容易,广泛应用于智能生产和工业自动化上。 本课题通过MCS-51单片机来设计电子时钟,采用汇编语言进行编程,可以实现以下一些功能:小时,分,秒和年,月,的显示、定时报警功能。本次设计的电子时钟系统由时钟电路,LCD显示电路,定时报警电路,按键调整电路四部分组成。51单片机通过软件编程,在LCD1602液晶屏上实现小时,分,秒和年,月,的显示;利用时钟芯片DS1302来实现计时,定时功能;通过两个按键开关,一个用于时钟的调节,一个用于闹钟的调节,来实现参数设置和调节功能;到达设置的闹钟时间时,由蜂鸣器发声,起报警作用。本次设计的电子时钟,经过对比测试,发现实际计时的走时精度较高,可满足多种场合的应用需求。 本文详细介绍了AT89C51单片机的基本原理,分析了AT89C51各个管脚的功能及它在设计电路中的作用。本文论述了LCD1602液晶屏和时钟芯片DS1302的工作原理及其软件设计过程。 关键词:单片机 电子时钟 时钟芯片
The single-chip microcomputer, collects CPU, RAM, ROM, the counting and many kinds of connections in a body. It has been published since the 70's of 20th century and has high performance, so it attracts lots of people’s attention.Its volume is small,the weight is light,the capacity of resisting disturbance is strong,the environmental challenge is not high,the price is not expensive and the development is easy,for that,it is widely used in the intelligent production and the industrial automation.
This topic designs the electronic clock through the MCS-51 single-chip microcomputer and the assembly language is adopted in this design. The electronic clock can achieve these functions: display the hour, the minute, the second and the year, the month, the date, alarm in the fixed time. The system of the electronic clock is composed of the LCD display circuit, the clock circuit,the parameter circuit and the timing warning circuit.In order to display the hour, the minute, the second and the year, the month, the date in the LCD1602, it use thit makes use of the clock chip DS1302 to achieve the functions of ait has two keyswitches,one is used to control time parameter and the other is used to sewhen the time is reach the set-up time,the buzzer sends out the sound which can react the effect of alarm.The design of the electronic clock, which contrasts to the home-use clock,we can find that the time keeping performance is good.For that, the electronic clock is suitable for many occasions.
We can learn the basic principles of the AT89C51 from this text.It is good for us to realize the function of the base pins and the function in the circuit.This article also discourses the working principles of the LCD1602 and the clock chip DS1302,we can understand their software design procedure from this passage.
Key words:single-chip Microcomputer;electronical clock;Timepiece chip
经管之家精彩文章推荐
加入经管之家,拥有更多权限。

我要回帖

更多关于 单片机电子时钟 的文章

 

随机推荐