基于单片机的实时日历时钟显示系统_第1页
基于单片机的实时日历时钟显示系统_第2页
基于单片机的实时日历时钟显示系统_第3页
基于单片机的实时日历时钟显示系统_第4页
基于单片机的实时日历时钟显示系统_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、xxxxxxx学 院 本 科 毕 业 设 计(论文)基于单片机的实时时钟显示系统设计学 院(系): 计算机科学与技术系 专 业: 通信工程 学 生 姓 名: 学 号: 指 导 教 师: 完 成 日 期: 摘 要20世纪末,电子技术获得了飞速的发展,在其推动下,现代电子产品几乎渗透了社会的各个领域,有力地推动了社会生产力的发展和社会信息化程度的提高,同时也使现代电子产品性能进一步提高,产品更新换代的节奏也越来越快。现代生活的人们越来越重视起了时间观念,可以说是时间和金钱划上了等号。对于那些对时间把握非常严格和准确的人或事来说,时间的不准确会带来非常大的麻烦,所以以数码管为显示器的时钟比指针式的时

2、钟表现出了很大的优势。数码管显示的时间简单明了而且读数快、时间准确显示到秒。而机械式的依赖于晶体震荡器,可能会导致误差。数字钟是采用数字电路实现对“时”、“分”、“秒”数字显示的计时装置。数字钟的精度、稳定度远远超过老式机械钟。在这次设计中,我们采用led数码管显示时、分、秒,以24小时计时方式,根据数码管动态显示原理来进行显示,用12mhz的晶振产生振荡脉冲,定时器计数。在此次设计中,电路具有显示时间的其本功能,还可以实现对时间的调整。数字钟是其小巧,价格低廉,走时精度高,使用方便,功能多,便于集成化而受广大消费的喜爱,因此得到了广泛的使用。关键字:数字电子钟 单片机abstractthe

3、late 20th century, electronic technology has been rapid development in its promotion,penetration of modern electronic products will almost fields, a strong impetus to the development of social productive forces and social improvement in the level of information, while also further improve the perfor

4、mance of modern electronic products, replacement products have become increasingly fast pace. growing emphasis on modern life from the time the concept of time and money can be said to draw the equal sign. for those who are very strict and accurate grasp of time and things, time will not exactly bri

5、ng a very big trouble, so as to control the display of digital clock than the clock pointer showed a big advantage. digital display of time reading simple and fast, accurate display of time to seconds. the mechanical oscillator depends on the crystal may lead to errors. digital clock is a digital ci

6、rcuit implementation of the when, sub, seconds the figures show the timing device. digital clock precision, stability, far more than the old mechanical clock. in this design, we use led digital display hours, minutes, seconds, to 24-hour time mode, according to digital control theory to dynamic disp

7、lay to display, use the 12mhz crystal oscillation pulse, the timer count. in this design, the circuit has a display time of the this function, you can also realize the time adjustment. digital clock is its compact, low cost, travel time and high precision, easy to use, features and more, easy integr

8、ation and loved by the general consumer, so widely used. keywords: digital electronic clock scm前 言本例的功能是在51单片机系统中设置,获取,记录实时的日历时钟信息并通过数码管显示,要求能够进行长时间的记录,并且存储的时间信息在掉电情况下至少保存10年以上。该系统包含5个模块:51单片机模块,日历时钟模块,数码管显示模块,串行通信模块,c51程序。本系统用到的电路及程序如下: 程序代码如下:#define_calendarclk_h / 防止calendarclk.h被重复引用#define_cal

9、endarclk_h#include #include #define uchar unsigned char#define unint unsigned int/* ds12c887 内部专用寄存器宏定义 */#define min xbyte0x0102#define hour xbyte0x0104#define dayofweek xbyte0x0106#define dayofmonth xbyte0x0107#define month xbyte0x0108#define year xbyte0x0109#define reg_a xbyte0x010a#define reg_b

10、xbyte0x010b/* 由串口获得的日历时钟信息变量,用于对芯片时间的设置 */uchar year1,month1,dayofweek1,dayofmonth1,hour1,min1;/* 芯片ds12c887提供的日历时钟信息变量 */uchar year2,month2,dayofweek2,dayofmonth2,hour2,min2;/* 从串行口获取数据函数,数据包括:year1,month1,dayofweek1,dayofmonth1,hour1,min1。如果获取到正确数据则返回1,否则返回0 */uchar getdata()/ 略去/* 设置日历和时钟函数 */voi

11、d settime()reg_b = reg_b|0x80;/ set=1,芯片ds12c887处于设置状态min = min1;hour = hour1;dayofweek = dayofweek1;dayofmonth = dayofmonth1;month = month1;year = year1;reg_b = reg_b&0x7f; / set=0,芯片ds12c887恢复正常数据更新状态/* 获取日历时钟信息函数 */void gettime()while (reg_a&0x80=0x00)/ 直到uip=0时,才能读取日历时钟信息min2 = min ;hour2 = hour

12、;dayofweek2 = dayofweek;dayofmonth2 = dayofmonth; month2 = month;year2 = year;/* 13位数码管显示年、月、日、星期、时、分 */void display()/ 略去/* 串口初始化函数 */void init_serial()tmod = 0x20;/ 定时器t1使用工作方式2th1 = 250;tl1 = 250;tr1 = 1;/ 开始计时pcon = 0x80;/ smod = 1scon = 0x50;/ 工作方式1,波特率9600kbit/s,允许接收 void main(void)uchar setflag;init_serial();/* 设置dv2、dv1、dv0为010,打开芯片ds12c877内部晶振 */reg_a = reg_a&0xaf;/ dv2=dv0=0reg_a = reg_a|0x20;/ dv1=0reg_b = reg_b&0x7b;/ set=0,时间数据正常更新;dm=0,二进制数

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论