基于AT89C51单片机的可调式电子时钟设计 下载本文

内容发布更新时间 : 2024/5/21 16:28:39星期一 下面是文章的全部内容请认真阅读。

摘 要

电子时钟主要是利用了电子技术将时钟电子化、数字化,拥有时钟精确、体积小、界面友好、可扩展性能强等特点,被广泛应用于生活和工作当中。对当前的电子时钟开发手段进行了比较和分析,最终确定了采用单片机技术实现的电子时钟。本次课题介绍了以AT89C51单片机为主控芯片的可调式电子时钟,功耗小,能在3V的低压工作。时钟芯片采用美国DALLAS公司提供的具有涓细电流低功耗的DS1302。它可以对年、月、日、周日、时、分、秒进行计时,还具有闰年补偿等多种功能,而且DS1302的使用寿命长,误差小。显示部分采用LCD1602液晶显示,液晶显示屏的显示功能强大,可显示大量文字,图形,显示多样,清晰可见,与普通数码管相比功耗较小,硬件连接简单,较直观。软件使用高级C语言编程,具有灵活的可移植性,同时该时钟具有按键可调的功能,能够对日期时间调整。本设计说明书首先介绍的是总体方案设计,接着是硬件设计,本部分详细的介绍了各模块的工作原理及相互的连接,再接着介绍了软件设计部分,最后是仿真调试。经仿真验证,该设计能满足所有的功能。 关键词:可调式; AT89C51; DS1302; C语言

ABSTRACT

Electronic clock basically is to use the electronic technology will clock electronic, digital, has the clock accurate, small volume, friendly interface, can be expanded performance is strong and other characteristics, are widely used in life and work. On the current development of the electronic clock means were compared and analyzed, finally determined by single chip microcomputer technology to the electronic clock. This subject introduces the AT89C51 as the controller chip adjustable electronic clock, power consumption is small, can be in 3 V of low-pressure work. The clock chip adopt American DALLAS company has Juan fine current DS1302 of low power consumption. It can be to year, month, day, Sunday, when, minutes and seconds for the time, also has a leap year compensation and other functions, and the DS1302 long service life and small error. Show LCD1602 part adopts LCD display, LCD screen shows powerful, can show a large text, graphics, show diversity, clearly visible, compared with common digital tube power consumption is small, hardware connect a simple, more intuitive. Senior software use the C programming language, has the flexible portability, and the clock is the key adjustable function to adjust to a time and date. The design manual introduced is first overall design, then the hardware design. This part describes in detail the modules and working principle of the mutual connection, then introduces the design of the software in part, and finally the simulation test. The simulation results, this design can meet all functions.

Keywords: adjustable; AT89C51; DS1302; C language

目录

绪论 ................................................................................................................................................................. 1 1 总体方案设计 ......................................................................................................................................... 2 1.1 设计要求 .......................................................................................................................................... 2 1.2 总体设计框图 ................................................................................................................................. 2 1.3 芯片的选择 ..................................................................................................................................... 2 2硬件设计与实现 ...................................................................................................................................... 4 2.1 电路图 ............................................................................................................................................... 4 2.1.1 Protel连接图 ......................................................................................................................... 4 2.1.2 硬件概述 ................................................................................................................................. 4 2.1.3 工作原理 ................................................................................................................................. 5 2.2 主要单元电路的设计 ................................................................................................................... 5 2.2.1 单片机主控制模块 .............................................................................................................. 5 2.2.2 时钟信号产生模块 .............................................................................................................. 6 2.2.3 液晶显示模块 ........................................................................................................................ 8 3 软件设计 .................................................................................................................................................. 11 3.1设计主程序流程图 ....................................................................................................................... 11 3.1.1 DS1302读写操作 ............................................................................................................ 12 3.1.2 LCD1602初始化 ............................................................................................................. 12 3.1.3 时间调整子程序 .............................................................................................................. 12 3.2延时函数 ......................................................................................................................................... 12 4 综合仿真 ................................................................................................................................................. 13 4.1编辑工具KEIL UVISION3............................................................................................................... 13 4.1.1 软件安装 ............................................................................................................................... 13 4.1.2 创建工程 ............................................................................................................................... 13 4.1.3 代码编辑 ............................................................................................................................... 13 4.2 仿真软件PROTEUS .......................................................................................................................... 14 4.3 软件仿真 ........................................................................................................................................ 14 结论 ............................................................................................................................................................... 16 参考文献 ...................................................................................................................................................... 17 附录 ............................................................................................................................................................... 18 致 谢 .......................................................................................................................................................... 27