基于AT89S52单片机和DS1302的电子万年历设计英文翻译
- 格式:doc
- 大小:96.00 KB
- 文档页数:17
Design of the digital Perpetual Calendar based onreal-time clock chipAbstract:This Electronic calendar uses the AT89S52 microcontroller as the core for the control. Time Circuit which is constituted by Dallas's DS12C887A real-time clock chip achieved a time and date display, it increased functionality for the temperature display and the whole point timekeeping. This paper discusses the hardware circuit of the system, principle in detail,and gives the flow chart of the software design and the major source code. keywords:microcontroller; real-time clock; Temperature measurement1 IntroductionE-calendar-bedroom at home,schools,stations and more and more extensive use of plaza for people's lives,study,work great convenience. Electronics calendar for the past need to re-adjust after power-off time and date,and time is a big error. Designed the system using real-time clock chip (DS12C887A) as a timer parts,the chip comes with an internal crystal oscillator,so that effectively guarantee the accuracy of the time and hang own internal battery power makes the situation will continue to update the time information . This design uses AT89S52 as the main controller,in order to improve the practicality of the circuit add temperature measurementcircuit,timekeeping and alarm functions.2 System hardware designSchematic circuit shown in Figure 2:System architecture diagramPower Supply CircuitIn order to reduce circuit costs,the system power supply circuit by the transformer transformer,three-terminal integrated regulator (L7805> circuit 5V, has asimple,reliable, inexpensive and so on.Host ControllerHost controller using ATMEL's latest MCU Products AT89S52. Apart from the single-chip microcomputer has a MCS-51 series single-chip all the benefits ofthings,also has 8KB of internal in-system programmable FLASH memory,free and low-power brown-out mode, greatly reducing the power circuit . In addition,also has a watchdog circuit,a reliable job for the circuit provides greater assurance.digital tube display circuitShow circuit with a high brightness,long life,low cost features such as the LED digital tube. Throughout the show circuit by the digital control and display LED drive circuit and decoding circuit. Because of the system to display the contents of more,a total of 16 digital tube, respectively,with eight shows year,month,day,four show time,show that 22 weeks,2 show the temperature. Controller in order to save resources,between the controller and displays add a decoding circuit 16 so that would have required the line of control into the circuit only 4 control lines,a great save system resources. The decoder by the decoder constitute both 3-8.Real-time clock chipThis design uses the United States Dallas company DS12C887A, the chip can automatically generate century,year,month,day,hour,minute,second,such as time information. Century the use of internal registers with the software will be able to resolve the 'Millennium', the problem. The chip has its own internalbattery-keng,external brown-out,the internal time information also be able to maintain for 10 years. Time for a single day record of 12 hours and there is a 24-hour mode. Time TableWays that also has two kinds of binary numbers,and the other with BCD code express. The chip with 128 bytes of internal RAM,one of 11 bytes used to store time information,4 bytes of memory chips used to control information,known as the control register,113-byte general-purpose RAM for users to store temporary information. In addition,users can also program the chip to control a variety of square-wave output,and its internal three-way through the software interrupt shielding.Buttons and temperature measurements and circuitThe system in order to make the circuit more easy,button circuit design only three keys, which are 'set','+','-', three keys to adjust the calendar and clock. The system in order to improve the practicality of the circuit,an increase of a temperature display. The system temperature measurement circuit using Dallas's DS1280. The device because of its low price,easy circuits,measurement precision,etc..audio signal generator and driver circuitThe circuit's function is to receive control circuit to send to the entire point of time and timing signal,according to system settings produce different frequencies of audiosignals,amplification by the drive circuit to drive speakers to voice their opinions in order to realize the whole point timekeeping and alarm functions.3 system software designProcedures of the system by the main program interrupt service function and pose a number of Functions. Main function and interrupt the completion of the initialization function. Timer interrupt function main timing clock chip to complete scanning and keypad scanning. Clock chip main function is to read and write time,read out the calendar information and to amend the specific value of the internal write clock chip. The main source code is as follows:中文译文:基于实时钟芯片的电子万年历的设计摘要:电子万年历以AT89S52单片机为控制核心,采用Dallas公司的DS12C887A 实时钟芯片构成计时电路,实现了时间和日期的显示,还增加了温度显示和整点报时的功能。
毕业设计(论文)基于单片机的多功能万年历设计on MCU论文主题词:多功能万年历单片机DS1302数码管外文主题词LED论文答辩日期:答辩委员会主席:评阅教师:毕业设计(论文)原创性声明和使用授权说明原创性声明本人郑重承诺:所呈交的毕业设计(论文),是我个人在指导教师的指导下进行的研究工作及取得的成果。
尽我所知,除文中特别加以标注和致谢的地方外,不包含其他人或组织已经发表或公布过的研究成果,也不包含我为获得及其它教育机构的学位或学历而使用过的材料。
对本研究提供过帮助和做出过贡献的个人或集体,均已在文中作了明确的说明并表示了谢意。
作者签名:日期:指导教师签名:日期:使用授权说明本人完全了解大学关于收集、保存、使用毕业设计(论文)的规定,即:按照学校要求提交毕业设计(论文)的印刷本和电子版本;学校有权保存毕业设计(论文)的印刷本和电子版,并提供目录检索与阅览服务;学校可以采用影印、缩印、数字化或其它复制手段保存论文;在不以赢利为目的前提下,学校可以公布论文的部分或全部内容。
作者签名:日期:学位论文原创性声明本人郑重声明:所呈交的论文是本人在导师的指导下独立进行研究所取得的研究成果。
除了文中特别加以标注引用的内容外,本论文不包含任何其他个人或集体已经发表或撰写的成果作品。
对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。
本人完全意识到本声明的法律后果由本人承担。
作者签名:日期:年月日学位论文版权使用授权书本学位论文作者完全了解学校有关保留、使用学位论文的规定,同意学校保留并向国家有关部门或机构送交论文的复印件和电子版,允许论文被查阅和借阅。
本人授权大学可以将本学位论文的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫描等复制手段保存和汇编本学位论文。
涉密论文按学校规定处理。
作者签名:日期:年月日导师签名:日期:年月日注意事项1.设计(论文)的内容包括:1)封面(按教务处制定的标准封面格式制作)2)原创性声明3)中文摘要(300字左右)、关键词4)外文摘要、关键词5)目次页(附件不统一编入)6)论文主体部分:引言(或绪论)、正文、结论7)参考文献8)致谢9)附录(对论文支持必要时)2.论文字数要求:理工类设计(论文)正文字数不少于1万字(不包括图纸、程序清单等),文科类论文正文字数不少于1.2万字。
基于89C52单片机和DS1302的万年历设计摘要古人依靠日冕、漏刻记录时间,而随着现代科技的发展,电子万年历已经成为日渐流行的日常计时工具。
本文研究的万年历系统拟用STC89C52单片机控制,以DS1302时钟芯片计时、1602液晶屏显示。
系统主要由单片机控制电路,显示电路以及校正电路三个模块组成。
本文阐述了系统的硬件工作原理,所应用的各个接口模块的功能以及其工作过程,论证了设计方案理论的可行性。
系统程序采用C语言编写,经Keil软件进行调试后在Proteus软件中进行仿真测试,可以显示年、月、日、星期、时、分、秒,并具有校准功能和与即时时间同步的功能。
实验结果表明此万年历实现后具有读取方便、显示直观、功能多样、电路简洁等诸多优点,符合电子仪器仪表的发展趋势,具有广阔的市场前景。
关键词:万年历单片机DS1302 lcd1602目录第一章前言............................................................................................. 错误!未定义书签。
1.1引言(课题研究的意义) (1)1.2本课题主要的研究工作 (1)1.2.1研究内容 (1)1.2.2论文章节安排 (2)1.3本章小结 (2)第二章单片机的概述 (3)2.1单片机的定义和特点 (3)2.1.1单片机的定义 (3)2.1.2单片机的特点 (3)2.2单片机的发展现状和趋势 (3)2.3编程语言的选择 (4)2.4本章小结 (4)第三章设计要求和方案论证 (5)3.1设计要求 (5)3.2单片机芯片的选择方案和论证 (5)3.3显示模块选择方案和论证 (5)3.4时钟芯片的选择方案和论证 (6)3.5电路设计最终方案决定 (6)3.6本章小结 (6)第四章系统的硬件设计与实现 (7)4.1电路设计框图 (7)4.2系统硬件概述 (7)4.3主要单元电路的设计 (7)4.3.1 STC89C52单片机简介 (7)4.3.2单片机主控制模块的设计 (10)4.3.3时钟电路模块的设计 (11)4.3.4独立式键盘设计 (13)4.3.5显示模块的设计 (13)4.4本章小结 (15)第五章系统的软件设计 (16)5.1程序流程图 (16)5.1.1系统总流程图 (16)5.1.2时钟程序流程图 (16)5.1.3液晶显示程序流程图 (17)5.2程序的设计 (18)5.2.1读写DS1302程序 (18)5.2.2液晶显示程序 (19)5.3本章小结 (19)第六章结束语 (20)致谢词 (21)参考文献 (22)附录一:系统电路图 (23)附录二:系统程序 (24)第一章前言1.1引言(课题研究的意义)万年历是我国古代传说中最古老的一部太阳历。
多功能数字万年历设计摘要:本设计是一种基于AT89C52单片机控制的数字万年历设计。
它具有多项显示和控制功能:能用LCD实时显示当前年、月、日、星期、时间;可对时间进行调整;具有闹铃及整点报时功能;可显示万年历等功能。
并且它以单片机的 C51 语言进行软件设计,增加了程序的可读性和可移植性,便于扩展和更改。
本文通过对一个基于单片机的能实现万年历功能电子时钟的设计,从而达到学习、了解单片机相关指令在各方面的应用。
系统由主控制器AT89C51、时钟电路DS1302、显示电路、按键电路、和复位电路等部分构成,能实现时钟日历显示的功能,能进行时、分、秒的显示。
关键词:单片机万年历时钟电路DS1302 C51Abstract:The design is a single-chip microcomputer 51 based on the number of calendar control design. It has a number of display and control functions: real-time use LCD displays the current year, month, day, week, time; may be time to adjust; with alarm as well as the whole point timekeeping function; calendar function displays. And the C51 it single-chip software design language, an increase of procedures to improve the readability and portability, ease of expansion and change.based on a microcontroller based on the will to achieve calendar of a multi-functional electronic clock designThereby achieve studying and understanding the relevant directives SCM in all aspects of the application. By main control AT89C51、clock circuit DS1302、display circuit、keystroke circuit and restore circuit componented to achieve clock calendar display function can be carried out hours seconds of the show and real-time of the show and real-time temperature display.Keywords : Single-chip clock circuit calendar DS1302 C51 language引言多功能数字万年历已成为人们日常生活中必不可少的物品,广泛用于个人家庭以及车站、码头、医院、办公室等公共场所,给人们的生活、学习、工作、娱乐带来极大的方便。
南通纺织职业技术学院毕业设计(论文)基于AT89S52单片机万年历的设计董刚班级: 09电子信息专业:电子信息工程教学系:机电系指导老师:荀磊完成时间: 年月日至年月日摘要电子万年历是一种非常广泛日常计时工具。
它可以对年、月、日、时、分、秒进行计时,还具有闰年补偿等多种功能,对于数字电子万年历采用直观的数字显示,可以同时显示年、月、日、时、分、秒和温度等信息,还具有时间校准等功能。
该电路采用AT89S52单片机作为核心,功耗小,能在3V的低压工作,电压可选用3---5V电压供电。
此次是基于52系列的单片机进行的电子万年历设计,相比传统的万年历来说,精确度更高。
可以显示温度、年、月、日、时、分、秒及周信息,具有可调整日期和时间功能。
对单片机的理论基础和外围扩展知识进行了比较全面准备。
在硬件与软件方面进行同步设计。
硬件部分主要由单片机,LED显示电路,以及调时按键电路等组成。
在单片机的选择上使用了AT89S52单片机,该单片机适合于许多较为复杂控制应用场合。
显示器使用共阴极的数码管。
使用MAX7219来驱动显示,然后并行输出。
软件方面主要包括日历程序、时间调整程序、温度程序、显示程序等。
程序采用汇编语言编写,以便更简单地实现调整时间及阴历显示功能。
所有程序编写完成后,在keil软件中进行调试,确定没有问题后,在Proteus 软件中嵌入单片机内进行仿真。
关键词:时钟芯片、MAX7219、DS18B20、动态扫描、单片机。
目录摘要 (1)1 绪论 (4)1.1设计背景 (4)1.2设计思想 (4)1.3设计框图 (5)2 系统硬件设计 (6)2.1最小化电路设计 (6)2.1.1 主控芯片简介 (6)2.1.2 复位电路、晶振电路设计 (7)2.2显示电路设计 (9)2.2.1 显示器简介 (9)2.2.2 驱动芯片简介 (11)2.2.3 显示电路 (16)2.3温度采集电路设计 (17)2.3.1 温度采集芯片简介 (17)2.3.2 温度采集电路 (21)2.4实时时钟电路设计 (21)2.4.1时钟芯片简介 (22)2.4.2时钟电路 (22)3 系统软件设计 (25)3.1主程序流程图 (26)3.2系统子程序的设计 (27)3.2.1送显示流程图 (27)3.2.2 时钟流程图 (28)3.2.3 温度采集流程图 (29)4 系统仿真 (30)4.1仿真软件简介 (30)4.2 软件仿真过程 (34)4.3仿真结果 (36)5 系统的制作与调试 (37)5.1 系统的制作 (37)5.2 系统的调试 (37)5.3 实物展示 (38)致谢 (39)参考文献 (40)附录一 (41)附录二 (42)1 绪论1.1设计背景随着人们生活水平的提高和生活节奏的加快,对时间的要求越来越高,精准数字计时的消费需求也是越来越多。
分类号密级U D C中国地质大学江城学院毕业设计(论文)基于单片机的多功能万年历设计姓名:专业:电子信息工程班级:学号:指导教师:荣讲师MCU论文主题词:多功能万年历单片机 DS1302 数码管论文答辩日期:答辩委员会主席:评阅教师:原创性声明本人呈交的毕业论文,是在导师的指导下,独立进行研究工作所取得的成果,所有数据、图片资料真实可靠。
尽我所知,除文中已经注明引用的容外,本毕业论文的研究成果不包含他人享有著作权的容。
对本论文所涉及的研究工作做出贡献的其他个人和集体,均已在文中以明确的方式标明。
本毕业论文的知识产权归属于培养单位。
本人签名:日期:摘要随着当今世界经济的快速发展和信息化时代的来临,各种各样的小型智能家电产品陆续出现在我们的生活当中。
日历是人们不可或缺的日常用品。
但一般日历都为纸制用品,使用不便,寿命不长。
电子万年历是一种非常广泛的日常计时工具,它采用智能电子控制和显示技术,改善了纸制日历的缺陷。
它可以对年、月、日、星期、时、分、秒进行计时,还具有闰年补偿等多种功能。
本设计采用STC89C52单片机为核心,构成单片机控制电路,用DS1302时钟芯片计时,完成时间的自动调整和掉电保护,DS18B20检测温度,再经过单片机处理后把时间和温度信号通过MAX7219和74HC573驱动20位共阴极数码管显示。
日历能显示阳历和阴历年、月、日以及星期、时、分、秒、温度。
该万年历设有四个按键:S1、S2、S3、S4键,可以实现日期调整,闹钟功能,秒表功能。
关键词:多功能万年历单片机 DS1302 DS18B20 数码管ABSTRACTWith 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 is a very wide range of daily timing tool,it adopts the technology of intelligent electronic control and display, and then improves the deficiency of paper calendars.It can be years, month, day, week, hour, minutes and seconds for time, but also has a leap year compensation and other functions.The design adopts the core of AT89S52 single chip microcomputer, which constitutes controlling circuit,and integrates DS1302 clock chip, which achieve self-adjusting of time and no power protecting.DS18B20 temperature detection, and then through the single-chip processing time and temperature signal and use 20 common cathode led that driven by MAX7219 and 74HC573 to display.The calendar can display solar and lunar year, month, day, week, hour, minute, second. The calendar has four buttons: S1, S2, S3, S4, can achieve the date of adjustment, alarm function, stopwatch function.Keywords: Multi function calendar MCU DS1302 DS18B20 LED目录1 引言 02 系统方案选择 (2)2.1 控制模块 (2)2.2 时钟模块 (2)2.3 显示模块 (3)2.4 温度检测模块 (3)2.5 最终方案选择 (4)3 系统硬件电路的设计 (5)3.1 系统核心部分——STC89C52主控模块 (5)3.1.1 STC89C52单片机特性 (5)3.1.2 STC89C52单片机引脚及功能 (6)3.1.3 STC89C52单片机最小系统设计 (7)3.2 时钟模块 (9)3.3 温度检测模块 (10)3.4 键盘模块 (11)3.5 显示模块 (11)3.6 扬声器模块 (14)4 系统软件的设计 (15)4.1 系统初始化 (15)4.2 开机显示函数 (16)4.3 DS18B20温度检测函数 (16)4.3.1 DS18B20的初始化 (16)4.3.2 DS18B20的写操作 (17)4.3.3 DS18B20的读操作 (17)4.3.4 温度检测函数 (18)4.4 按键函数 (19)4.5 DS1302函数 (19)4.6 阴历函数 (20)4.7 显示函数 (21)4.8 闹钟函数及整点报时函数 (21)4.9 秒灯函数 (22)5 调试中的问题与解决方法 (23)结束语 (25)致参考文献 (28)附录 (29)1 引言随着科技的不断进步与发展,越来越多的电子类产品变得人性化与智能化,在这种大的变化趋势下,钟表类产品当然不会示弱。
基于AT89S52单片机的电子万年历系统设计周颖;俞吉【摘要】To design a convenient household electronic calendar which has simple circuit, accurate time and multi-function, microcontroller AT89S52 is used for programmable control. The external temperature sensor and LCD (liquid crystal display) are adopted to realize the accurate display of date and time, humanization setup of alarm clock and and real-time display of ambient temperature. The modularization management is employed in the system structure design. Since its program is compiled with C language, it has low cost of hardware and strong transportability which is helpful to the post-expansion. It is suitable for home users.%为设计一款电路简洁、走时准确、功能齐全的家用电子万年历,利用AT89S52单片机进行可编程控制,结合外围温度传感器、液晶屏等,实现了万年历的时间日期准确显示,人性化的闹钟设置以及环境温度的实时显示.设计结构模块化管理,基于C语言编写,可移植性强,便于后期扩展,硬件成本低,适合家庭用户使用.【期刊名称】《现代电子技术》【年(卷),期】2012(035)013【总页数】3页(P178-179,182)【关键词】电子万年历;单片机编程;温度传感器;液晶显示【作者】周颖;俞吉【作者单位】西北工业大学电子信息学院,陕西西安 710129;西北工业大学电子信息学院,陕西西安 710129【正文语种】中文【中图分类】TN710-34;TP368目前基于单片机控制技术的微电子技术得到空前的发展。
目录1 引言 (1)**方案选择 (1)** 方案1——基于AT89S52单片机的电子万年历设计 (1)**方案2——基于AT89S52单片机和DS1302的电子万年历设计 (2)2 系统概述 33 系统硬件电路的设计 (4)** 系统核心部分——单片机 AT89S52 (4)** AT89S52具有下列主要性能 (4)** AT89S52的引脚及功能 (5)** DS1302时钟电路 (7)** DS1302芯片介绍 (7)** DS1302 的应用 (11)** 存储电路 (11)** AT24C02管脚介绍 (11)** AT24C02的特性 (12)** 液晶显示电路 (14)** 液晶显示控制驱动器HD61202的特点 (14)** 液晶显示控制驱动器HD61202的引脚功能 (14)** 液晶显示控制驱动器HD61202的指令系统 (15)** HY-12864的电路结构特点 (17)** HY-12864的应用 (17)** 键盘电路 (19)** 闹铃电路 (19)4 系统程序的设计20** 阳历程序的设计 (20)** 时间调整程序设计 (20)** 阴历程序设计 (22)5 测试结果 256 结论 (26)参考文献 (27)附录1:电子万年历设计电路原理图 (28)附录2 主程序 (29)致谢 (43)1 引言随着科技的不断进步和发展,单片机的使用已经渗透到我们日常生活当中的各个领域,几乎很难找到有哪个领域没有使用单片机的踪迹。
导弹的导航装置,飞机上各种仪表的控制,计算机的网络通讯与数据传输,工业自动化过程的实时控制和数据处理,广泛使用的各种智能IC卡,民用豪华轿车的安全保障系统,录相机、摄像机、全自动洗衣机的控制,以及程控玩具、电子宠物等等,这些都离不开单片机。
更不用说自动控制领域的机器人、智能仪表、医疗器械了。
本文设计的电子万年历属于小型智能家用电子产品。
利用单片机进行控制,实时时钟芯片进行记时,外加掉电存储电路和显示电路,可实现时间的调整和显示。
摘要:本文介绍了基于AT89S52单片机的多功能电子万年历的硬件结构和软硬件设计方法。
本设计由数据显示模块、温度采集模块、时间处理模块和调整设置模块四个模块组成。
系统以AT89S52单片机为控制器,以串行时钟日历芯片DS1302记录日历和时间,它可以对年、月、日、时、分、秒进行计时,还具有闰年补偿等多种功能。
温度采集选用DS18B20芯片,万年历采用直观的数字显示,数据显示采用1602液晶显示模块,可以在LCD1602上同时显示年、月、日、周日、时、分、秒,还具有时间校准等功能。
此万年历具有读取方便、显示直观、功能多样、电路简洁、成本低廉等诸多优点,具有广阔的市场前景。
关键字:单片机AT89S52 时钟芯片DS1302 温度传感器DS18B20 1602液晶显示器前言随着科技的快速发展,时间的流逝,从观太阳、摆钟到现在电子钟,人类不断研究,不断创新纪录。
目前,单片机技术的应用产品已经走进了千家万户。
电子万年历的出现给人们的生活带来了诸多方便。
随着微电子技术的高速发展,单片机在国民经济的个人领域得到了广泛的运用。
单片机以体积小、功能全、性价比高等诸多优点,在工业控制、家用电器、通信设备、信息处理、尖端武器等各种测控领域的应用中独占鳌头,单片机开发技术已成为电子信息、电气、通信、自动化、机电一体化等专业技术人员必须掌握的技术。
单片机单芯片的微小体积和低的成本,可广泛地嵌入到如玩具、家用电器、机器人、仪器仪表、汽车电子系统、工业控制单元、办公自动化设备、金融电子系统、舰船、个人信息终端及通讯产品中,成为现代电子系统中最重要的智能化工具,于是基于单片机的醒目而时尚的电子版万年历顺应而生。
基于单片机的电子万年历结合了时钟和日历的功能,将其二者融为一体,在显示时间的同时还能显示日期和年、月,它主要是通过单片机来读取时钟芯片的时间、日期,然后送给显示设备显示出来。
而电子万年历作为电子类小设计不仅是市场上的宠儿,也是是单片机实验中一个很常用的题目。
摘要:电子万年历是一种应用非常广泛的日常计时工具,本设计利用美国DALLAS 公司推出的具有涓细电流充电的低功耗实时时钟电路DS1320,研制了一种多功能电子万年历,主要功能包括:电子万年历要求能显示的阳历/阴历、年、月、日、星期、小时、分、秒,除此之外还有显示润年,记忆时间。
DS1302可以对年、月、日、周日、时、分、秒进行计时,还具有润年补偿的功能,而且DS1320的使用寿命长,误差小。
对于数字电子万年历采用它,具有较准的计时。
关键词:AT89S52 DS1302 74LS164 万年历The production of the calendar with the single-chipAT89S52Abstract:Electronic calendar application is a kind of tool ,which is widely used in our daily life.The design using the United States with DALLAS small trickle charge current of the low-power real-time clock circuit DS1320, developed a multi-function electronic calendar.The main features include E-calendar requirements which are shown in the solar calendar / lunar calendar, year, month, day, weeks, hours, minutes and seconds, in addition to indicate Leap year, the memory of the time. DS1302 can remember year, month, day, weekdays, hours, minutes, seconds for time,which also has the function of a leap year compensation, and long life of the DS1320, the error small. The use of digital electronic calendar for it has a quasi-time.Keywords: AT89S52 DS1302 74LS164 calendar目录第一章绪论 (3)1.1 课题背景 (3)1.2 电子万年历的目的和意义 (3)第二章系统硬件电路设计 (4)2.1 硬件设计框图 (4)2.2 AT89S52原理 (4)2.374LS164电路原理 (5)2.4 DS1302电路原理 (5)2.5 电源原理 (7)2.6 数码管原理 (8)第三章系统软件实现 (9)3.1显示及调整时间子程序流程 (9)3.2调整时间子程序流程 (9)3.3显示闰年子程序流程 (10)3.4显示星期的子程序流程 (11)3.5阳历日期推算阴历日期流程图 (11)总结 (12)致谢 (13)参考文献 (14)附录1.元件清单 (15)附录2.电路原理图 (16)附录3.程序 (17)第一章绪论1.1课题背景在生活中,我们经常能看到各种各样的制作精美的万年历,万年历大有取代常规钟表的趋势.随着人们生活水平的提高,智能产品越来越受到人们的欢迎.而单片机,传感器各种集成电路起到关键作用.希望通过本设计能够对未来的趋势有所把握,从而适应社会需要.1.2 电子万年历的目的和意义电子万年历是一种应用非常广泛的日常计时工具,液晶显示的万年历已经越来越普及,特别是适合在家庭居室、办公室、大厅、会议室和广场使用。
英文翻译OverviewThe 8051 family of micro controllers is based on an architecture which is highly optimized for embedded control systems. It is used in a wide variety of applications from military equipment to automobiles to the keyboard on your PC. Second only to the Motorola 68HC11 in eight bit processors sales, the 8051 family of microcontrollers is available in a wide array of variations from manufacturers such as Intel, Philips, and Siemens. These manufacturers have added numerous features and peripherals to the 8051 such as I2C interfaces, analog to digital converters, watchdog timers, and pulse width modulated outputs. Variations of the 8051 with clock speeds up to 40MHz and voltage requirements down to 1.5 volts are available. This wide range of parts based on one core makes the 8051 family an excellent choice as the base architecture for a company's entire line of products since it can perform many functions and developers will only have to learn this one platform.The basic architecture consists of the following features:12which can be individually accessed34567paces for DA TA and CODE memoryOne 8051 processor cycle consists of twelve oscillator periods. Each of the twelve oscillator periods is used for a special function by the 8051 core such as op code fetches and samples of the interrupt daisy chain for pending interrupts. The time required for any 8051 instruction can be computed by dividing the clock frequency by 12, inverting that result and multiplying it by the number of processor cycles required by the instruction in question. Therefore, if you have a system which is using an 11.059MHz clock, you can compute the number of instructions per second by dividing this value by 12. This gives an instruction frequency of 921583 instructions per second. Inverting this will provide the amount of time taken by each instruction cycle (1.085 microseconds).Memory OrganizationThe 8051 architecture provides the user with three physically distinct memory spaces which can be seen in Figure A - 1. Each memory space consists of contiguous addresses from 0 to the maximum size, in bytes, of the memory space. Address overlaps are resolved by utilizing instructions which refer specifically to a given address space. The three memory spaces function as described below.The CODE SpaceThe first memory space is the CODE segment in which the executable program resides. This segment can be up to 64K (since it is addressed by 16 address lines) . The processor treats this segment as read only and will generate signals appropriate to access a memory device such as an EPROM. However, this does not mean that the CODE segment must be implemented using an EPROM. Many embedded systems these days are using EEPROM which allows the memory to be overwritten either by the 8051 itself or by an external device. This makes upgrades to the product easy to do since new software can be downloaded into the EEPROM rather than having to disassemble it and install a new EPROM. Additionally, battery backed SRAM can be used in place of an EPROM. This method offers the same capability to upload new software to the unit as does an EEPROM, and does not have any sort of read/write cycle limitations such as an EEPROM has. However, when the battery supplying the RAM eventually dies, so does the software in it. Using an SRAM in place of an EPROM in development systems allows for rapid downloading of new code into the target system. When this can be done, it helps avoid the cycle of programming/testing/erasing with EPROM, and can also help avoid hassles over an in circuit emulator which is usually a rare commodity.In addition to executable code, it is common practice with the 8051 to store fixed lookup tables in the CODE segment. To facilitate this, the 8051 provides instructions which allow rapid access to tables via the data pointer (DPTR) or the program counter with an offset into the table optionally provided by the accumulator. This means that oftentimes, a table's base address can be loaded in DPTR and the element of the table to access can be held in the accumulator. The addition is performed by the 8051 during the execution of the instruction which can save many cycles depending on the situation. An example of this is shown later in this chapter in.The DATA SpaceThe second memory space is the 128 bytes of internal RAM on the 8051, or the first 128 bytes of internal RAM on the 8052. This segment is typically referred to as the DA TA segment. The RAM locations in this segment are accessed in one or two cycles depending on the instruction. This access time is much quicker than access to the XDA TA segment because memory is addressed directly rather than via a memory pointer such as DPTR which must first be initialized. Therefore, frequently used variables and temporary scratch variables are usually assigned to the DATA segment. Such allocation must be done with care, however, due to the limited amount of memory in this segment.V ariables stored in the DATA segment can also be accessed indirectly via R0 or R1. The register being used as the memory pointer must contain the address of the byte to be retrieved or altered. These instructions can take one or two processor cycles depending on the source/destination data byte.The DATA segment contains two smaller segments of interest. The first sub segment consists of the four sets of register banks which compose the first 32 bytes of RAM. The 8051 can use any of these four groups of eight bytes as its default register bank. The selection of register banks is changeable at any time via the RS1 and the RS0 bits in the Processor Status Word (PSW). These two bits combine into a number from 0 to 3 (with RS1 being the most significant bit) which indicates the register bank to be used. Register bank switching allows not only for quick parameter passing, but also opens the door for simplifying task switching on the 8051.The second sub-segment in the DA TA space is a bit addressable segment in which each bit can be individually accessed. This segment is referred to as the BDA TA segment. The bit addressable segment consists of 16 bytes (128 bits) above the four register banks in memory. The 8051 contains several single bit instructions which are often very useful in control applications and aid in replacing external combinatorial logic with software in the 8051 thus reducing parts count on the target system. It should be noted that these 16 bytes can also be accessed on a "byte-wide" basis just like any other byte in the DATA space.Special Function RegistersControl registers for the interrupt system and the peripherals on the 8051 are contained in internal RAM at locations 80 hex and above. These registers are referred to as special functionRegisters (or SFR for short). Many of them are bit addressable. The bits in the bit addressable SFR can either be accessed by name, index or bit address. Thus, you can referto the EA bit of the Interrupt Enable SFR as EA, IE.7, or 0AFH. The SFR control things such as the function of the timer/counters, the UART, and the interrupt sources as well as their priorities. These registers are accessed by the same set of instructions as the bytes and bits in the DATA segment. A memory map of the SFRS indicating the registers..The IDATA Spac eCertain 8051 family members such as the 8052 contain an additional 128 bytes of internal RAM which reside at RAM locations 80 hex and above. This segment of RAM is typically referred to as the IDATA segment. Because the IDA TA addresses and the SFR addresses overlap, address conflicts between IDATA RAM and the SFRs are resolved by the type of memory access being performed, since the IDA TA segment can only be accessed via indirect addressing modes.The XDATA Space.The final 8051 memory space is 64K in length and is addressed by the same 16 address lines as the CODE segment. This space is typically referred to as the external data memory space (or the XDA TA segment for short). This segment usually consists of some sort of RAM (usually an SRAM) and the I/O devices or external peripherals to which the 8051 must interface via its bus. Read or write operations to this segment take a minimum of two processor cycles and are performed using either DPTR, R0, or R1. In the case of DPTR, it usually takes two processor cycles or more to load the desired address in addition to the two cycles required to perform the read or write operation. Similarly, loading R0 or R1 will take minimum of one cycle in addition to the two cycles imposed by the memory access itself. Therefore, it is easy to see that a typical operation with the XDA TA segment will, in general, take a minimum of three processor cycles. Because of this, the DA TA segment is a very attractive place to store any frequently.It is possible to fill this segment entirely with 64K of RAM if the 8051 does not need to perform any I/O with devices in its bus or if the designer wishes to cycle the RAM on and off when I/O devices are being accessed via the bus. Methods for performing this technique will be discussed in chapters later in this book.On-Board Timer/CountersThe standard 8051 has two timer/counters (other 8051 family members have varying amounts), each of which is a full 16 bits. Each timer/counter can be function as a freerunning timer (in which case they count processor cycles) or can be used to count falling edges on the signal applied to their respective I/O pin (either T0 or T1). When used as a counter, the input signal must have a frequency equal to or lower than the instruction cycle frequency divided by 2 (ie: the oscillator frequency /24) since the incoming signal is sampled every instruction cycle, and the counter is incremented only when a 1 to 0 transition is detected (which will require two samples). If desired, the timer/counters can force a software interrupt when they overflow.The TCON (Timer Control) SFR is used to start or stop the timers as well as hold the overflow flags of the timers. The TCON SFR is detailed below in Table A - 7. The timer/counters are started or stopped by changing the timer run bits (TR0 and TR1) in TCON. The software can freeze the operation of either timer as well as restart the timers simply by changing the Trx bit in the TCON register. The TCON register also contains the overflow flags for the timers. When the timers overflow, they set their respective flag (TF0 or TF1) in this register. When the processor detects a 0 to 1 transition in the flag, an interrupt occurs if it is enabled. It should be noted that the software can set or clear this flag at any time. Therefore, an interrupt can be prevented as well as forced by the software.Microcomputer interfaceA microcomputer interface converts information between two forms .Outside the microcomputer the information handled by an electronic system exists as a physical signals, but within the program , it is represented numerically . The function of any interface can be broken down into a number of operations which modify the data in some way ,so than the process of conversion between the external and internal forms is carried out in a number or steps.This can be illustrated by means of an example such as than or Fig 10-1,which shows an interface between a microcomputer and a transducer producing a continuously variable analog signal. transducers often produce very small out requiring amply frication, or they may generate signals .in a form that needs to be converted again before being handled by the rest of the system .For example ,many transducers these variable resistance which must be converted to a voltage by a special circuit. This process of converting the transducer output into a voltage4 signal which can be connected to the rest of the system is called signal conditioning .In the example of Figure 10-1, the sigma conditioning section translates the range lf voltage or current signals from the transducer to one which can be converted to digital forum by an analog-to-digital converter.。