摘 要
随着当今世界经济的快速发展和信息化时代的来临,各种各样的小型智能家电产品陆续出现在我们的生活当中。日历是人们不可或缺的日常用品。但一般日历都为纸制用品,使用不便,寿命不长。电子万年历采用智能电子控制和显示技术,改善了纸制日历的缺陷。本设计以AT89S52单片机为核心,构成单片机控制电路,AT89C52是一种带8K字节闪速可编程可擦除只读存储器(PEROM)的低电压、高性能CMOS 8位为控制器。该器件采用ATMEL 非易失存储器制造技术制造,与工业标准的80C51和 80C52指令集和输出管脚相兼容。结合DS1302时钟芯片和24C02 FLASH存储器,完成时间的自动调整和掉电保护,全部信息用液晶显示。时间、日期调整由三个按键来实现,并可对闹铃开关进行设置。日历能显示阳历和阴历年、月、日以及星期、时、分、秒。在显示阴历月份时,能标明是否闰月。
关键词:电子万年历;单片机;时钟芯片;FLASH存储器;液晶显示
ABSTRACT
With the rapid development of world economy and the forthcoming of information era, many kinds of mini-type intelligent domestic electric appliances appear in our life one after another. Calendars are necessary daily goods in people’s life. But they are generally paper goods with inconvenient use and short life. Electronic calendar adopts the technology of intelligent electronic control and display, and then improves the deficiency of paper calendars. The design adopts the core of AT89S52 MCU, which is a low-power, high-performance, CMOS 8-bit microcomputer with 8K bytes of Flash programmable and erasable read only memory memory (PEROM).The device is manufactured using Atmel’s high density nonvolatile memory technology and is compatible with the industry standard 80C51 and 80C52 instruction set and pin out,which constitutes controlling circuit, and integrates DS1302 clock chip and 24C02 FLASH memory, which achieve self-adjusting of time and no power protecting. LCD displays all information. Time and date adjusting is carried out by three keys, which can also set the alarm clock. The calendar can display solar and lunar year, month, day, week, hour, minute, second. When displaying lunar months, leap month is showed.
Key Words: electronic calendar; MCU; clock chip; flash memory; LCD
目 录
1 引言………………………………………………………………………………………………………………….. 1
1.2方案选择…………………………………………………………………………………………………… 1
1.2.1 方案1——基于AT89S52单片机的电子万年历设计………………………….. 1
1.2.2方案2——基于AT89S52单片机和DS1302的电子万年历设计…………… 2
2 系统概述…………………………………………………………………………………………………………… 3
3 系统硬件电路的设计…………………………………………………………………………………………. 4
3.1 系统核心部分——单片机 AT89S52…………………………………………………………… 4
3.1.1 AT89S52具有下列主要性能…………………………………………………………….. 4
3.1.2 AT89S52的引脚及功能……………………………………………………………………. 5
3.2 DS1302时钟电路……………………………………………………………………………………….. 7
3.2.1 DS1302芯片介绍……………………………………………………………………………… 7
3.2.2 DS1302 的应用……………………………………………………………………………….. 11
3.3 存储电路…………………………………………………………………………………………………. 11
3.3.1 AT24C02管脚介绍…………………………………………………………………………… 11
3.3.2 AT24C02的特性……………………………………………………………………………… 12
3.4 液晶显示电路…………………………………………………………………………………………. 14
3.4.1 液晶显示控制驱动器HD61202的特点…………………………………………….. 14
3.4.2 液晶显示控制驱动器HD61202的引脚功能……………………………………… 14
3.4.3 液晶显示控制驱动器HD61202的指令系统……………………………………… 15
3.4.4 HY-12864的电路结构特点……………………………………………………………… 16
3.4.5 HY-12864的应用……………………………………………………………………………. 17
3.5 键盘电路………………………………………………………………………………………………… 19
3.6 闹铃电路………………………………………………………………………………………………… 19
4 系统程序的设计………………………………………………………………………………………………. 20
4.1 阳历程序的设计……………………………………………………………………………………… 20
4.2 时间调整程序设计………………………………………………………………………………….. 20
4.3 阴历程序设计…………………………………………………………………………………………. 22
5 测试结果…………………………………………………………………………………………………………. 25
6 结论………………………………………………………………………………………………………………… 26
参考文献…………………………………………………………………………………………………………….. 27
附录1:电子万年历设计电路原理图…………………………………………………………………… 28
附录2:主程序…………………………………………………………………………………………………… 29
致 谢………………………………………………………………………………………………………………… 43
英文原文及中文翻译