《电子万历中英文翻译.doc》由会员分享,可在线阅读,更多相关《电子万历中英文翻译.doc(5页珍藏版)》请在三一办公上搜索。
1、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 Dallass DS12C887A real-time clock chip achieved a time and date display, it increased functionalit
2、y 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 Introduction E-ca
3、lendar-bedroom at home,schools,stations and more and more extensive use of plaza for peoples 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
4、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 practic
5、ality of the circuit add temperature measurement circuit,timekeeping and alarm functions. 2 System hardware design Schematic circuit shown in Figure 2: Real-Time Clock Core片Audio signal generator and driver Single-chip controllerAT89S52LEDKey circuitTemperature measurement circuitPower circuit Syste
6、m architecture diagram2.1 Power Supply Circuit In order to reduce circuit costs,the system power supply circuit by the transformer transformer,three-terminal integrated regulator (L7805 circuit 5V, has a simple,reliable, inexpensive and so on. 2.2 Host Controller Host controller using ATMELs latest
7、MCU Products AT89S52. Apart from the single-chip microcomputer has a MCS-51 series single-chip all the benefits of things,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 rel
8、iable job for the circuit provides greater assurance. 2.3 digital tube display circuit Show 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 s
9、ystem 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
10、 line of control into the circuit only 4 control lines,a great save system resources. The decoder by the decoder constitute both 3-8. 2.4 Real-time clock chip This design uses the United States Dallas company DS12C887A, the chip can automatically generate century,year,month,day,hour,minute,second,su
11、ch 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 internal battery-keng,external brown-out,the internal time information also be able to maintain for 10 years. Time for a single day record of 12 h
12、ours and there is a 24-hour mode. Time Table Ways 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,11
13、3-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. 2.5 Buttons and temperature measurements and circuit The system in order to
14、 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 Dallass DS1280. The
15、 device because of its low price,easy circuits,measurement precision,etc. 2.6 audio signal generator and driver circuit The circuits 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 audio signal
16、s,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 design Procedures of the system by the main program interrupt service function and pose a number of Functions. Main function and inter
17、rupt 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 mai
18、n source code is as follows: 中文译文:基于实时钟芯片的电子万年历的设计摘要:电子万年历以AT89S52单片机为控制核心,采用Dallas公司的DS12C887A实时钟芯片构成计时电路,实现了时间和日期的显示,还增加了温度显示和整点报时的功能。文章对该系统的硬件电路、工作原理做了详细介绍,同时给出了软件设计的流程图及主要程序源代码。关键词:单片机,实时钟.温度测量1引言电子万年历在家庭居室、学校、车站和广场使用越来越广泛,给人们的生活、学习、工作带来极大的方便。针对以往的电子万年历断电后需重新调整时间与日期,且计时误差大的现象。本系统设计采用实时钟芯片(DS12C8
19、87A)作为计时器件,该芯片内部自带晶体振荡器,这样就有效的保证了计时的精确性,并且内部自带铿电池使得在断电情况能继续更新时间信息。本设计采用AT89S52作为主控制器,为了提高电路的实用性加入温度测量电路、报时和闹钟功能。2系统硬件的设计电路原理图如图所示:实时时钟芯片音频信号产生及驱动电路电源电路 单片机控制器AT89S52数码显示管按键电路温度测量电路 该系统的结构框图系统的工作原理是:主控制器每隔一段时间(小于一秒钟)读一次时钟芯片的内部寄存器的值,将读出的日历、时间信息实时的显示在LED数码显示器一上。同时,主控制器不断的扫描按键电路和温度测量电路,当有键按下时,识别出按键的值并调整
20、相应的时间或日历的值再写入时钟芯片内部。温度数据由测量电路(DS1280)获得的温度值送入显示电路显示。2. 1电源电路为了减少电路成本,本系统电源电路由变压器变压、三端集成稳压(L7805电路产生5V,具有简单、可靠、价格低廉等特点。2. 2主控制器主控制器采用ATMEL公司的最新系列单片机产品AT89S52。该单片机除了拥有MCS-51系列单片机的所有优点外,内部还具有8KB的在系统可编程FLASH存储器,低功耗的空闲和掉电模式,极大的降低了电路的功耗。另外,还具有一个看门狗电路,为电路的可靠工作提供了更大的保证。2. 3数码管显示电路显示电路采用具有高亮度、使用寿命长、价格低廉等特点的L
21、ED数码管。整个显示电路由LED数码管和显示驱动电路和译码电路构成。由于本系统中显示的内容较多,共需要16个数码管,分别用八位显示年、月、日,四位显示时间,二二位显示星期,二位显示温度。为了节省控制器的资源,在控制器和显示器之间加入一个译码电路使本来需要16根控制线的电路变成只需四根控制线,极大的节省了系统资源。该译码器由两个3-8译码器构成。2. 4实时钟芯片本设计采用美国Dallas公司的DS12C887A,该芯片能够自动产生世纪、年、月、日、时、分、秒等时间信息。利用内部的世纪寄存器,配合软件就能解决千年,的问题。该芯片内部自带有铿电池,外部掉电时,其内部的时间信息还能够保持10年之久。
22、对于一天内的时间记录有 12小时制和24小时制两种模式。时间的表示方法也有两种,一种用二进制数表示,另一种用BCD码表示。该芯片内部带有128字节的RAM,其中11字节用来存储时间信息,4字节用来存储芯片的控制信息,称为控制寄存器,113字节通用RAM可供用户存储临时信息。此外,用户还可以对芯片进行编程控制输出各种方波,并可对其内部的三路中断通过软件进行屏蔽。2. 5按键与温度测且电路本系统为了使电路更简单,按键电路只设计了三个按键,分别是设置、+、-,三个键用来调整日历以及时钟。本系统为了提高电路的实用性,增加了一个温度显示功能。该系统的温度测量电路采用Dallas公司的DS1280。该器件由于其具有价格低廉、电路简单、测量精确等优点。2. 6音频信号产生及驱动电路本电路的功能是接收控制电路发送来的整点报时及定时信号,根据系统设定产生不同频率的音频信号,由驱动电路加以放大驱动扬声器发出声音,从而实现整点报时及闹钟的功能。 3系统的软件设计本系统程序由主程序、中断服务函数和多个子函数构成。主函数主要完成各子函数和中断函数的初始化。定时中断函数主要完成时钟芯片的定时扫描及键盘扫描。时钟芯片的读写函数主要是将时间、日历信息读出来,并把要修改的具体值写入时钟芯片内部。主要源程序代码如下: