天津职业技术师范大学
Tianjin University of Technology and Education
毕 业 设 计
专 业: 电气技术教育 班级学号: 电气0611 - 17 学生姓名: 刘涛 指导教师: 路海龙 讲师
二〇一一年六月
天津职业技术师范大学本科生毕业设计
基于单片机的多功能万年历设计
The Design Of Multi-Function Calendar Based on
Microcomputer
专业班级:电气0611班 学生姓名:刘涛 指导教师:路海龙讲师
学 院:自动化与电气工程学院
2011 年 6 月
摘 要
单片机应用技术飞速发展,纵观我们现在生活的各个领域,从导弹的导航装置,到飞机上各种仪表的控制,从计算机的网络通讯与数据传输,到工业自动化过程的实时控制和数据处理,以及我们生活中广泛使用的各种智能IC卡、电子宠物等,这些都离不开单片机。单片机是集CPU ,RAM ,ROM ,定时,计数和多种接口于一体的微控制器。它体积小,成本低,功能强,广泛应用于智能产业和工业自动化上。而51系列单片机是各单片机中最为典型和最有代表性的一种。本设计以AT89S52单片机为核心,结合DS1302时钟芯片,并采用LCD12864液晶显示。该多功能电子万年历具有时间显示、及具有温度计功能功能。以时、分、秒格式显示时间(精度为1秒)。计算器通过4×4按键对时间、日期进行调整,进行功能切换。同时具有自动调整功能。整机电路使用+5V稳压电源,可稳定工作。在实现硬件电路的基础上,通过软件控制程序实现其功能。
关键词:状态显示;时钟;温度;计算器;AT89S52单片机
ABSTRACT
With the rapid development of microcomputer application technology, we now look at all areas of life, from the missile's navigation devices to various instruments on the aircraft, from the computer network communication and data transmission, to industrial automation, real-time process control and data processing, and we live in a variety of widely used smart IC cards, electronic pets, these are inseparable from the microcomputer. Microcomputer is a CPU, RAM, ROM, timing, counting and multiple interfaces in one of the microcomputer. Its small size, low cost, powerful, widely used in smart industries and industrial automation. The 51 microcomputer series is the most typical of the microcontroller and the most representative one. The AT89S52 microcomputer as the core design, combined with DS1302 clock chip and liquid crystal display using LCD12864. The multi-function electronic calendar with a time display, and has a thermometer function function. Hours, minutes, seconds format time (an accuracy of 1 second). 4×4 Calculator by keys on the time, date, adjust the function switch. Also has automatic adjustment function. Machine using the +5 V regulated power supply circuit can be stability. In the realization of hardware based on software control program to achieve its function.
Key Words: Status display;Clock;Temperature;Calculator;AT89S52 Microcomputer
目 录
1 绪论 ........................................................................................................................... 1
1.1多功能万年历设计的背景及意义 ................................................................ 1 1.2总体要求和规划 ............................................................................................ 1
1.2.1方案选择与论证 ................................................................................ 1 1.2.2电路设计最终方案 ............................................................................ 2 1.2.3主要技术指标 .................................................................................... 3
2主要元器件简介 ........................................................................................................ 4
2.1 AT89S52 .......................................................................................................... 4 2.2温度传感器DS18B20 .................................................................................... 6 2.3 DS1302时钟芯片 ........................................................................................... 8 3 系统硬件电路的设计 ............................................................................................... 9
3.1系统总体硬件结构设计 ................................................................................. 9 3.2 AT89S52及其外围电路 ................................................................................. 9
3.2.1温度传感器DS18B20 ....................................................................... 12 3.2.2液晶显示电路 .................................................................................... 14
4 软件设计 ................................................................................................................. 17
4.1系统总软件的设计流程 ............................................................................... 17 4.2 DS18B20的软件设计 .................................................................................. 17 4.3 键盘输入的软件设计 .................................................................................... 1 5测试过程及结果 ........................................................................................................ 1
5.1硬件测试 ....................................................................................................... 20 5.2软件测试 ....................................................................................................... 20 5.3测试结果 ....................................................................................................... 20 结 论 ..................................................................................................................... 21 参考文献 ..................................................................................................................... 22 附录1:整体电路图 .................................................................................................. 23 附录2:源程序 .......................................................................................................... 24 致 谢 ..................................................................................................................... 56
I