版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、毕业论文(设计)外文翻译学 生 姓 名: 指导教师: 合作指导教师: 专业名称: 自动化 所在学院: 2012年 6月design of single chip real time clock and calendar based onabstract: this clock and calendar uses the at89s52 microcontroller as the core for the control. time circuit which is constituted by dallass ds1302 real-time clock chip achieved a ti
2、me 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
3、clock; temperature measurement1 introduction clock and calendar-bedroom at home, schools, stations and more and more extensive use of plaza for peoples lives, study, work great convenience. clock and calendar for the past need to re-adjust after power-off time and date, and time is a big error. desi
4、gned the system using real-time clock chip (ds1302) 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 at8
5、9s52 as the main controller, in order to improve the practicality of the circuit add temperature measurement circuit, timekeeping and alarm functions. 2 system hardware design schematic circuit shown in figure 2:system architecture diagram2.1 power supply circuit in order to reduce circuit costs, th
6、e 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 mcu products at89s52. apart from the single-chip microcomputer has a mcs-51 seri
7、es 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 reliable job for the circuit provides greater assurance. 2.3 digital tube display c
8、ircuit 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 system to display the contents of more,a total of 16 digital tube, respectively,w
9、ith 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 resou
10、rces. the decoder by the decoder constitute both 3-8. 2.4 real-time clock chip this design uses the united states dallas company ds1302, 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 wil
11、l 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 hours and there is a 24-hour mode. time table ways that also has two kinds of binary
12、 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,us
13、ers 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 make the circuit more easy,button circuit design only three keys, which are set,+,
14、-, 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 ds18b20. the device because of its low price,easy circuits,measurement precision,etc. 2.6 audi
15、o 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 signals,amplification by the drive circuit to drive speakers to voice their opinions in
16、order to realize the whole point timekeeping and alarm functions. descriptionthe at89s52 is a low-power, high-performance cmos 8-bit microcomputer with 4k bytes of flash programmable and erasable read only memory (perom). the device is manufactured using atmels high-density nonvolatile memory techno
17、logy and is compatible with the industry-standard mcs-52 instruction set and pinout. the on-chip flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. by combining a versatile 8-bit cpu with flash on a monolithic chip, the atmel at89s52 is a
18、 powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.function characteristicthe at89s52 provides the following standard features: 4k bytes of flash, 128 bytes of ram, 32 i/o lines, two 16-bit timer/counters, a five vector two-leve
19、l interrupt architecture, a full duplex serial port, on-chip oscillator and clock circuitry. in addition, the at89s52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. the idle mode stops the cpu while allowing the ram, timer/
20、counters, serial port and interrupt system to continue functioning. the power-down mode saves the ram contents but freezes the oscillator disabling all other chip functions until the next hardware reset.pin descriptionvcc:supply voltage.gnd:ground.port 0:port 0 is an 8-bit open-drain bi-directional
21、i/o port. as an output port, each pin can sink eight ttl inputs. when 1s are written to port 0 pins, the pins can be used as highimpedance inputs.port 0 may also be configured to be the multiplexed loworder address/data bus during accesses to external program and data memory. in this mode p0 has int
22、ernal pullups.port 0 also receives the code bytes during flash programming,and outputs the code bytes during programverification. external pullups are required during programverification.port 1port 1 is an 8-bit bi-directional i/o port with internal pullups.the port 1 output buffers can sink/source
23、four ttl inputs.when 1s are written to port 1 pins they are pulled high by the internal pullups and can be used as inputs. as inputs,port 1 pins that are externally being pulled low will source current (iil) because of the internal pullups.port 1 also receives the low-order address bytes during flas
24、h programming and verification.port 2port 2 is an 8-bit bi-directional i/o port with internal pullups.the port 2 output buffers can sink/source four ttl inputs.when 1s are written to port 2 pins they are pulled high by the internal pullups and can be used as inputs. as inputs,port 2 pins that are ex
25、ternally being pulled low will source current, because of the internal pullups.port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses. in this application, it uses strong internal pullupswhen emitting
26、 1s. during accesses to external data memory that use 8-bit addresses, port 2 emits the contents of the p2 special function register.port 2 also receives the high-order address bits and some control signals during flash programming and verification.port 3port 3 is an 8-bit bi-directional i/o port wi
27、th internal pullups.the port 3 output buffers can sink/source four ttl inputs.when 1s are written to port 3 pins they are pulled high by the internal pullups and can be used as inputs. as inputs,port 3 pins that are externally being pulled low will source current (iil) because of the pullups.port 3
28、also serves the functions of various special features of the at89c51 as listed below:port 3 also receives some control signals for flash programming and verification.rstreset input. a high on this pin for two machine cycles while the oscillator is running resets the device.ale/progaddress latch enab
29、le output pulse for latching the low byte of the address during accesses to external memory. this pin is also the program pulse input (prog) during flash programming.in normal operation ale is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking
30、 purposes. note, however, that one ale pulse is skipped during each access to external data memory.if desired, ale operation can be disabled by setting bit 0 of sfr location 8eh. with the bit set, ale is active only during a movx or movc instruction. otherwise, the pin is weakly pulled high. setting
31、 the ale-disable bit has no effect if the microcontroller is in external execution mode.psenprogram store enable is the read strobe to external program memory.when the at89s52 is executing code from external program memory, psen is activated twice each machine cycle, except that two psen activations
32、 are skipped during each access to external data memory.ea/vppexternal access enable. ea must be strapped to gnd in order to enable the device to fetch code from external program memory locations starting at 0000h up to ffffh. note, however, that if lock bit 1 is programmed, ea will be internally la
33、tched on reset.ea should be strapped to vcc for internal program executions.this pin also receives the 12-volt programming enable voltage(vpp) during flash programming, for parts that require12-volt vpp.xtal1input to the inverting oscillator amplifier and input to the internal clock operating circui
34、t.xtal2output from the inverting oscillator amplifier.oscillator characteristicsxtal1 and xtal2 are the input and output, respectively,of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in figure 1.either a quartz crystal or ceramic resonator may be used. to
35、 drive the device from an external clock source, xtal2 should be left unconnected while xtal1 is driven as shown in figure 2.there are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum
36、and maximum voltage high and low time specifications must be observed. figure 1. oscillator connections figure 2. external clock drive configurationidle modein idle mode, the cpu puts itself to sleep while all the onchip peripherals remain active. the mode is invoked by software. the content of the
37、on-chip ram and all the special functions registers remain unchanged during this mode. the idle mode can be terminated by any enabled interrupt or by a hardware reset.it should be noted that when idle is terminated by a hard ware reset, the device normally resumes program execution,from where it lef
38、t off, up to two machine cycles before the internal reset algorithm takes control. on-chip hardware inhibits access to internal ram in this event, but access to the port pins is not inhibited. to eliminate the possibility of an unexpected write to a port pin when idle is terminated by reset, the ins
39、truction following the one that invokes idle should not be one that writes to a port pin or to external memory.power-down modein the power-down mode, the oscillator is stopped, and the instruction that invokes power-down is the last instruction executed. the on-chip ram and special function register
40、s retain their values until the power-down mode is terminated. the only exit from power-down is a hardware reset. reset redefines the sfrs but does not change the on-chip ram. the reset should not be activated before vcc is restored to its normal operating level and must be held active long enough t
41、o allow the oscillator to restart and stabilize.program memory lock bitson the chip are three lock bits which can be left unprogrammed (u) or can be programmed (p) to obtain the additional features listed in the table below.when lock bit 1 is programmed, the logic level at the ea pin is sampled and
42、latched during reset. if the device is powered up without a reset, the latch initializes to a random value, and holds that value until reset is activated. it is necessary that the latched value of ea be in agreement with the current logic level at that pin in order for the device to function properl
43、y.基于基于单片机进行实时日历和时钟显示设计摘要:日历及时钟显示以at89s52单片机为控制核心,采用dallas公司的ds1302实时钟芯片构成计时电路,实现了时间和日期的显示,还增加了温度显示和整点报时的功能。文章对该系统的硬件电路、工作原理做了详细介绍,同时给出了软件设计的流程图及主要程序源代码。关键词:单片机,实时钟.温度测量1引言日历及时钟显示在家庭居室、学校、车站和广场使用越来越广泛,给人们的生活、学习、工作带来极大的方便。针对以往的电子万年历断电后需重新调整时间与日期,且计时误差大的现象。本系统设计采用实时钟芯片(ds1302)作为计时器件,该芯片内部自带晶体振荡器,这样就有效的
44、保证了计时的精确性,并且内部自带铿电池使得在断电情况能继续更新时间信息。本设计采用at89s52作为主控制器,为了提高电路的实用性加入温度测量电路、报时和闹钟功能。2系统硬件的设计电路原理图如图所示: 该系统的结构框图系统的工作原理是:主控制器每隔一段时间(小于一秒钟)读一次时钟芯片的内部寄存器的值,将读出的日历、时间信息实时的显示在led数码显示器一上。同时,主控制器不断的扫描按键电路和温度测量电路,当有键按下时,识别出按键的值并调整相应的时间或日历的值再写入时钟芯片内部。温度数据由测量电路(ds18b20)获得的温度值送入显示电路显示。2. 1电源电路为了减少电路成本,本系统电源电路由变压
45、器变压、三端集成稳压(l7805电路产生5v,具有简单、可靠、价格低廉等特点。2. 2主控制器主控制器采用atmel公司的最新系列单片机产品at89s52。该单片机除了拥有mcs-51系列单片机的所有优点外,内部还具有8kb的在系统可编程flash存储器,低功耗的空闲和掉电模式,极大的降低了电路的功耗。另外,还具有一个看门狗电路,为电路的可靠工作提供了更大的保证。2. 3数码管显示电路显示电路采用具有高亮度、使用寿命长、价格低廉等特点的led数码管。整个显示电路由led数码管和显示驱动电路和译码电路构成。由于本系统中显示的内容较多,共需要16个数码管,分别用八位显示年、月、日,四位显示时间,二
46、二位显示星期,二位显示温度。为了节省控制器的资源,在控制器和显示器之间加入一个译码电路使本来需要16根控制线的电路变成只需四根控制线,极大的节省了系统资源。该译码器由两个3-8译码器构成。2. 4实时钟芯片本设计采用美国dallas公司的ds12c887a,该芯片能够自动产生世纪、年、月、日、时、分、秒等时间信息。利用内部的世纪寄存器,配合软件就能解决千年,的问题。该芯片内部自带有铿电池,外部掉电时,其内部的时间信息还能够保持10年之久。对于一天内的时间记录有 12小时制和24小时制两种模式。时间的表示方法也有两种,一种用二进制数表示,另一种用bcd码表示。该芯片内部带有128字节的ram,其
47、中11字节用来存储时间信息,4字节用来存储芯片的控制信息,称为控制寄存器,113字节通用ram可供用户存储临时信息。此外,用户还可以对芯片进行编程控制输出各种方波,并可对其内部的三路中断通过软件进行屏蔽。2. 5按键与温度测且电路本系统为了使电路更简单,按键电路只设计了三个按键,分别是设置、+、-,三个键用来调整日历以及时钟。本系统为了提高电路的实用性,增加了一个温度显示功能。该系统的温度测量电路采用dallas公司的ds1280。该器件由于其具有价格低廉、电路简单、测量精确等优点。2. 6音频信号产生及驱动电路本电路的功能是接收控制电路发送来的整点报时及定时信号,根据系统设定产生不同频率的音
48、频信号,由驱动电路加以放大驱动扬声器发出声音,从而实现整点报时及闹钟的功能。 描述at89s52是一个低电压,高性能cmos8位单片机带有4k字节的可反复擦写的程序存储器(penrom)。和128字节的存取数据存储器(ram),这种器件采用atmel公司的高密度、不容易丢失存储技术生产,并且能够与mcs-52系列的单片机兼容。片内含有8位中央处理器和闪烁存储单元,有较强的功能的at89s52单片机能够被应用到控制领域中。功能特性at89s52提供以下的功能标准:4k字节闪烁存储器,128字节随机存取数据存储器,32个i/o口,2个16位定时/计数器,1个5向量两级中断结构,1个串行通信口,片内
49、震荡器和时钟电路。另外,at89s52还可以进行0hz的静态逻辑操作,并支持两种软件的节电模式。闲散方式停止中央处理器的工作,能够允许随机存取数据存储器、定时/计数器、串行通信口及中断系统继续工作。掉电方式保存随机存取数据存储器中的内容,但震荡器停止工作并禁止其它所有部件的工作直到下一个复位。引脚描述vcc:电源电压 gnd:地p0口:p0口是一组8位漏极开路双向i/o口,即地址/数据总线复用口。作为输出口时,每一个管脚都能够驱动8个ttl电路。当“1”被写入p0口时,每个管脚都能够作为高阻抗输入端。p0口还能够在访问外部数据存储器或程序存储器时,转换地址和数据总线复用,并在这时激活内部的上拉
50、电阻。p0口在闪烁编程时,p0口接收指令,在程序校验时,输出指令,需要接电阻。p1口:p1口一个带内部上拉电阻的8位双向i/o口,p1的输出缓冲级可驱动4个ttl电路。对端口写“1”,通过内部的电阻把端口拉到高电平,此时可作为输入口。因为内部有电阻,某个引脚被外部信号拉低时输出一个电流。闪烁编程时和程序校验时,p1口接收低8位地址。p2口:p2口是一个内部带有上拉电阻的8位双向i/o口,p2的输出缓冲级可驱动4个ttl电路。对端口写“1”,通过内部的电阻把端口拉到高电平,此时,可作为输入口。因为内部有电阻,某个引脚被外部信号拉低时会输出一个电流。在访问外部程序存储器或16位地址的外部数据存储器
51、时,p2口送出高8位地址数据。在访问8位地址的外部数据存储器时,p2口线上的内容在整个运行期间不变。闪烁编程或校验时,p2口接收高位地址和其它控制信号。p3口:p3口是一组带有内部电阻的8位双向i/o口,p3口输出缓冲故可驱动4个ttl电路。对p3口写如“1”时,它们被内部电阻拉到高电平并可作为输入端时,被外部拉低的p3口将用电阻输出电流。p3口除了作为一般的i/o口外,更重要的用途是它的第二功能,如下表所示:端口引脚第二功能p3.0rxdp3.1txdp3.2int0p3.3int1p3.4t0p3.5t1p3.6wrp3.7rdp3口还接收一些用于闪烁存储器编程和程序校验的控制信号。rst
52、:复位输入。当震荡器工作时,ret引脚出现两个机器周期以上的高电平将使单片机复位。ale/:当访问外部程序存储器或数据存储器时,ale输出脉冲用于锁存地址的低8位字节。即使不访问外部存储器,ale以时钟震荡频率的1/16输出固定的正脉冲信号,因此它可对输出时钟或用于定时目的。要注意的是:每当访问外部数据存储器时将跳过一个ale脉冲时,闪烁存储器编程时,这个引脚还用于输入编程脉冲。如果必要,可对特殊寄存器区中的8eh单元的d0位置禁止ale操作。这个位置后只有一条movx和movc指令ale才会被应用。此外,这个引脚会微弱拉高,单片机执行外部程序时,应设置ale无效。psen:程序储存允许输出是外部程序存储器的读选通信号,当at89c51由外部程序存储器读取指令时,每个机器周期两次psen 有效,即输出两个脉冲。在此期间,当访问外部数据存储器时,这两次有效的psen 信号不出现。ea/vpp:外部访问允许。欲使中央处理器仅访
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年度技术转让合同including技术支持与后续改进
- 2024年度面粉厂产品生产线柔性改造合同
- 2024年度北京车牌租赁合同实例
- 2024版租赁合同标的为商业办公设备
- 延期采购合同范本
- 2024年度损害赔偿合同:餐饮业意外事件责任协议
- 二零二四年度汽车4S店销售合同
- 2024工程设计合同(项目类)
- 2024药品销售合作合同协议书
- 二零二四年度资产买卖合同标的明细
- 商品混凝土生产供应保证方案范本
- 手术室专科护士培训计划(3篇)
- MOXO-d-CPT工具在儿童青少年执行功能评估课件
- 青光眼病人的护理-课件
- 中国祥瑞-貔貅流传和演变
- 诗词大会训练题库-十二宫格课件
- 2022年江苏凤凰出版传媒集团有限公司招聘笔试试题及答案解析
- 光伏发电项目工程施工分包合同
- 腐蚀与防护概述课件
- 信息中心应急演练记录表(含内容)
- 饰面用花岗岩矿普查实施方案
评论
0/150
提交评论