




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、温度控制系统的设计摘要:研究了基于at89s 51单片机温度控制系统的原理和功能,温度测量单元由 单总线数字温度传感器ds18b 20构成。该系统可进行温度设定,时间显示和保存 监测数据。如果温度超过任意设置的上限和下限值,系统将报警并可以和自动控制 的实现,从而达到温度监测智能一定范围内。基于系统的原理,很容易使其他各种 非线性控制系统,只要软件设计合理的改变。该系统己被证明是准确的,可靠和满 意通过现场实践。关键词:单片机;温度;温度i. 导言温度是在人类生活屮非常重要的参数。在现代社会屮,温度控制(tc)不仅用 于工业生产,还广泛应用于其它领域。随着生活质量的提高,我们可以发现在酒店,
2、工厂和家庭,以及比赛设备。而比赛的趋势将更好地服务于整个社会,因此它具冇 十分重耍的意义测量和控制温度。在at89s51单片机和温度传感器ds18b20的基础上,系统环境温度智能控 制。温度可设定在一定范围内动任意。该系统可以显示在液晶显示屏的吋间,并保 存监测数据,并口动地控制温度,当环境温度超过上限和下限的值。这样做是为了 保持温度不变。该系统具冇很高的抗干扰能力,控制精度高,灵活的设计,它也非 常适合这个恶劣的环境。它主要应用于人们的生活,改善工作和生活质量。这也是 通用的,因此它可以方便地扩大使用该系统。因此,设计具有深刻的重要性。一般 的设计,硬件设计和软件系统的设计都包括在内。11
3、系统总体设计该系统硕件包括微控制器,温度检测电路,键盘控制电路,时钟电路,显示, 报警,驱动电路和外部ram。基t at89s51单片机,ds18b20的将温度信号传送到数 字信号的检测。和信号发送到微控制器进行处理。最后,温度值显示在液晶12232f。 这些步骤是用来实现温度检测。使用键盘接口芯片hd7279在设定温度值,使用微控 制器保持一定的温度,并使用液晶显示的温度控制设定值。此外,时钟芯片ds1302 用于显示时间和外部ra.m6264是用来保存监测数据。报警将给予及时蜂鸣器如果温 度超过了上限和下限温度值。iii. 硬件设计a. 微控制器在at89s51单片机是一种低功耗,高性能c
4、mos 8位4k的系统内可编程闪存字节 微控制器。该设备是釆用atmel的高密度非易失性内存技术,并与业界标准的80c51 指令集和引脚兼容。片上闪存程序存储器可以编程就可以在系统或由传统的非易失 性存储器编程。通过结合在系统灵活的8位cpu集成在一个芯片可编程闪存,atmel 的单片机at89s51是-个功能强大的微控制器提供了一个高度灵活的和具有成木效 益的解决方案很多嵌入式控制应用。为了节省监测数据,6264是用来作为外部raw 它是一个静态ram芯片,低功耗具冇8k字节的内存。b. 温度检测电路温度传感器是该系统的关键部分。达拉斯ds18b20的使用,它支持1 - wire 总线接口,
5、板上专利是在内部使用。所有的传感器部分和转换电路集成在-个晶体 管集成电路像。其测量范围为-55°c125°c,在-10°c85°c精度为土0.5°c2, 3o由ds18b20的温度釆集传输在1 - wire总线的方式,这种高度提高了系统的 抗干扰,使z适合在恶劣的环境现场温度测量4。有两个电源ds18b20的供应方 式。首先是外部电源供给:ds18b20的第-脚连接到地面,第二引脚用作信号线, 三是连接到电源。第二种方式是寄生电源5。由于寄生电源会导致硬件电路,软 件控制的难度和芯片的性能下降等,但ds18b20的(s)的复杂性,可以连接到i
6、/o 端口的单片机在外部电源供电方式,它更受欢迎。因此,外部电源供应使用,i佃第 二个接脚连接到引脚pl3可单片机at89s51o其实,如果多有被检测,ds18b20的(s)可以连接到1 - wire总线。但是,当数超过8,冇一个向驾驶和更复杂的软 件设计,以及1 -wire总线长度的关注。一般而言,这是不超过50米。为了实现 远程控制,该系统可在一个无线之一,旨在打破了 1- wire总线长度的限制6。c. lcd显示器电路液品显示12232f使用,这可以用来显示字符,温度值和时间,并提供一个友好 的显示界面。该12232f是一个具冇8192128x32像索的汉字数据库和128个16 x8
7、像素的ascii字符集图形液晶显示。它主要由行驱动器/列驱动器和128x 32点阵 的充分显示图形,以及7. 5 x2个汉字功能的液晶显示器。它是在并行或串行方式 连接到外部cpu7o为了节约硬件资源,12232f应以串行方式连接到单片机 at89s51,只有4个输出使用的端口。液品显示屏灰度可以通过调整可变电阻连接的 液晶vlcd的pin码。clk是用于传输串行通信时钟。std是用于传输串行数据。cs 是用来使能控制,液晶显示。l+是用来控制lcd背光电源。d. 时钟电路达拉斯ds1302的使用,这是一种高性能,低功耗和实时时钟芯片与ram。在 ds1302的服务于带有口历时钟系统,用于监测
8、的时间。读取数据的时间由at89s51 单片机,再曲液晶显示处理。另外的时间可以调整键盘。在ds1302的晶体振荡器设 定为32768hz的,建议的补偿电容是6pf。振荡器的频率较低,所以有可能不连接的 电容器,这不会有很大的不同的时间精度。备用电源可以连接到3. 6v的可充电电池。e. 键盘控制电路系统中的键盘接口 1id7279a的驱动下,它有一个+5 v单电源,这是连接,无需 使用任何冇源设备的键盘和显示。根据基本要求和系统功能,只冇6个按钮是必要 的。该系统的功能是由输入的数据接收单片机at89s5u为了节省外部电阻器,1 x 6使用键盘和键盘代码定义为:07h的,ofh, 17h条,
9、1fh, 27h款,2fh的。该 命令可以读出通过阅读代码指令。hd7279a是连接到单片机at89s51的串行模式, 只有4个端ii的需耍。digodig5和dp分别列线和六个键是实现键盘监控,解码和 识别关键代码行线端口。f. 报警电路为了简化电路,调试方便,是一个5v的蜂鸣器自动报警电路中的应用8。这 使得软件编程简化。它是由9012 pnp品体管的基连接到at89s51单片机的引脚p2. 5。 当温度超过上限和下限的值,p2.5输出低电平使晶体管上,然后由一个报警蜂鸣器 定。g. 驱动电路一个步进电机作为駆动装置来控制温度。四相和八打脉冲分配模式是用来张动 电机和简单的延时程序是用来处
10、理脉冲z间的时间间隔,获得不同的传速。冇两个 步进电机的输出状态。一:当温度超过上限值时,电机反向旋转(以低的温度), 而当低于下限值吋,电机旋转正常(提高温度),除了不等于预设值。二:当温度 在两者之间的某处结束,等于设定值时,电机停止。这些步骤是用来实现温度控制。 此外,电机的转速也可以调整相对按钮。代码数据是通过港口答11-a8的输入(p2. 3 p2.0的是)的逆变器74ls04由at89s51单片机和反向输出。最后,它被放大功 放2803a权力电机。iv. 软件设计按照一般设计要求,该系统的硬件电路原理,以及该程序的可读性,可移植性 和改进的调试方便,软件设计模块化。系统流程主要包折
11、以下8个步骤:post (加 电自检),系统启动,温度检测,报警处理,温度控制,时钟芯片ds1302的操作, 液晶显示和键盘操作。给一点分析,上述8个任务,很容易地发现,过去五年任务 需要实时操作。但对温度的检测,口j与ttmero计吋1秒,即出现温度检测达到每秒。 系统启动包括全局变量的定义,内存启动,启动特殊功能寄存器和外围设备的启动。 全局变量的定义,主要完成对外部接口连接到单片机at89s51芯片,内存单位和一 些特殊的定义的接口定义。开始主要是指ram的内存处理。例如,当系统通电时间 码将在内部单位地址或闪烁标志存储的信息将被清除。特殊功能寄存器包括加载启 动定吋器初值的开放中断。例
12、如,当系统通电定时器初始化。外围设备的启动,是 指设置外围设备的初始值。例如,当系统通电后,lcd应该被初始化,启动显示器 应该叫,温度转换命令时,必须先发出的时钟芯片ds1302也要被初始化。报警处理 主要是降低和温度的捉高使温度保持在预设范围。当温度z间的上限和下限的值, 这是不言而喻的温度控制处理,即需要的温度升高或降低根据预设值。这样做的条 件温度等于设定值,从而达到温度的目标。v. 结论温度控制系统具有友好的人机交互界面,硕件简单,成本低,温度控制精度高 (误差在±l°c范围内误差),便利性和多功能性等,它可广泛的场合使用的优点与 -55°c至125
13、176;c范围内,且有一定的实用价值。design of the temperature control system based on at89s51abstractthe principle and functions of the temperature control system based on microcontroller at89s51 are studied, and the temperature measurement unit consists of the 1-wire bus digital temperature sensor ds18b20. the syst
14、em can be expected to detect the preset temperature, display time and save monitoring data. an alarm will be given by system if the temperature exceeds the upper and lower limit value of the temperature which can be set discretionarily and then automatic control is achieved, thus the temperature is
15、achieved monitoring intelligently within a certain range. basing on principle of the system, it is easy to make a variety of other non-linear control systems so long as the software design is reasonably changed. the system has been proved to be accurate, reliable and satisfied through field practice
16、.keywords: at89s51; microcontroller; ds18b20; temperaturei. introductiontemperature is a very important parameter in human life. in the modern society, temperature control (tc) is not only used in industrial production, but also widely used in other fields. with the improvement of the life quality,
17、we can find the tc appliance in hotels, factories and home as well. and the trend that tc will better serve the whole society, so it is of great significance to measure and control the temperature.based on the at89s51 and temperature sensor ds18b20, this system controls the condition temperature int
18、elligently. the temperature can be set discretionarily within a certain range. the system can show the time on lcd, and save monitoring data; and automatically control the temperature when the condition temperature exceeds the upper and lower limit value. by doing so it is to keep the temperature un
19、changed. the system is of high anti-jamming, high control precision and flexible design; it also fits the rugged environment. it is mainly used in people's life to improve the quality of the work and life. it is also versatile, so that it can be convenient to extend the use of the system. so the
20、 design is of profound importance. the general design, hardware design and software design of the system are covered.ii. system general designthe hardware block diagram of the tc is shown in fig. 1. the system hardware includes the microcontroller, temperature detection circuit, keyboard control cir
21、cuit, clock circuit, display, alarm, drive circuit and external ram. based on the at89s51, the ds18b20 will transfer the temperature signal detected to digital signal. and the signal is sent to the microcontroller for processing. at last the temperature value is showed on the lcd 12232e these steps
22、are used to achieve the temperature detection. using the keyboard interface chip hd7279 to set the temperature value, using the microcontroller to keep a certain temperature, and using the lcd to show the preset value for controlling the temperature in addition, the clock chip ds 1302 is used to sho
23、w time and the external ram 6264 is used to save the monitoring data. an alarm will be given by buzzer in time if the temperature exceeds the upper and lower limit value of the temperature.iii. hardware designa. microcontrollerthe at89s51 is a low-power, high-performance cmos 8-bit microcontroller w
24、ith 4k bytes of in-system programmable flash memory. the device is manufactured using atmel's high-density nonvolatile memory technology and is compatible with the industry-standard 80c51 instruction set and pinout. the on-chip flash allows the program memory to be reprogrammed in-system or by a
25、 conventional nonvolatile memory programme匸 by combining a versatile 8-bit cpu with in-system programmable flash on a monolithic chip, the atmel at89s51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. minimum system of
26、 the microcontroller is shown in fig 2. in order to save monitoring data, the 6264 is used as an external ram it is a static ram chip, low-power with 8k bytes memory.b temperature detection circuitthe temperature sensor is the key part in the system. the dallas ds18b20 is used, which supports the 1-
27、wire bus interface, and the on-board patented is used internally. all the sensor parts and the converting circuit are integrated in integrated circuit like a transistor 1. its measure range is -55°c 25 °c, and the precision between -10°c 85 °c is ±0.5°c 2 ,3. the temper
28、ature collected by the ds18b20 is transmitted in the 1 - wire bus way, and this highly raises the system anti-jamming and makes it fit in situ temperature measurement of the rugged environment 4.there are two power supply ways for the ds18b20. the first is external power supply: the first pin of the
29、 ds18b20 is connected to the ground; the second pin serves as signal wire and the third is connected to the power. the second way is parasite power supply 5. as the parasite power supply will lead to the complexity of the hardware circuit, the difficulty of the software control and the performance d
30、egradation of the chip, etc. but the ds18b20(s) can be connected to the i/o port of the microcontroller in the external power supply way and it is more popula匚 therefore the external power supply is used and the second pin is connected to the pin pl.3 of the at89s51. actually, if there are multipoin
31、t to be detected, the ds18b20(s) can be connected to the 1-wire bus. but when the number is over & there is a concern to the driving and the more complex software design as well as the length of the 1-wire bus. normally it is no more than 50m. to achieve distant control, the system can be design
32、ed in to a wireless one to break the length limit of the 1-wire bus 6.c. lcd circuitthe lcd 12232f is used, which can be used to show characters, temperature value and time, and supply a friendly display interface. the 12232f is a lcd with 8192 128x32 pixels chinese character database and 128 16x8 p
33、ixels ascii character set graphics. it mainly consists of row drive/column drive and 128x32 full lattice lcd with the function of displaying graphics as well as 7.5x2 chinese characters. it is in a parallel or serial mode to connect to external cpu 7. in order to economize the hardware resource, the
34、 12232f should be connected to the at89s51 in serial mode with only 4 output ports used.the lcd grayscale can be changed by adjusting the variable resistor connected the pin vied of the lcd clk is used to transmit serial communication clock. sid is used to transmit serial data. cs is used to enable
35、control the lcd. l+ is used to control the lcd backlight powe匚d. clock circuitthe dallas ds 1302 is used, which is a high performance, low-power and real-time clock chip with ram. the ds 1302 serves in the system with calendar clock and is used to monitor the time. the time data is read and processe
36、d by the at89s51 and then displayed by the lcd. also the time can be adjusted by the keyboardthe ds 1302 crystal oscillator is set at 32768hz, and the recommended compensation capacitance is 6pe the oscillator frequency is lower, so it might be possible not to connect the capacitor, and this would n
37、ot make a big difference to the time precision. the backup power supply can be connected to a 3.6v rechargeable battery.e. keyboard control circuitthe keyboard interface in the system is driven by the hd7279a which has a +5v single power supply and which is connected to the keyboard and display with
38、out using any active-device. according to the basic requirements and functions of the system, only 6 buttons are needed. the system's functions are set by the at89s51 receiving the entered data. in order to save the external resistor, the 1x6 keyboard is used, and the keyboard codes are defined
39、as: 07h, ofh, 17h, 1fh, 27h, 2fh. the order can be read out by reading the code instruction. hd7279a is connected to the at89s51 in serial mode and only 4 ports are need. as shown in fig. 6, dig0dig5 and dp are respectively the column lines and row line ports of the six keys which achieve keyboard m
40、onitoring, decoding and key codes identificationf. alarm circuitin order to simplify the circuit and convenient debugging, a 5v automatic buzzer is used in the alarm circuit 8. and this make the software programming simplified. as shown in fig. 7, it is controlled by the pnp transistor 9012 whose ba
41、se is connected to the pin p2.5 of the at89s51. when the temperature exceeds the upper and lower limit value, the p2.5 output low level which makes the transistor be on and then an alarm is given by the buzze匚g. drive circuita step motor is used as the drive device to control the temperature the fou
42、r-phase and eight-beat pulse distribution mode is used to drive motor and the simple delay program is used to handle the time interval between the pulses to obtain different rotational speed. there are two output states for the step motor. one: when the temperature is over the upper value, the motor
43、 rotates reversely (to low the temperature), while when lower than the lower limit value, the motor rotates normally (to raise the temperature); besides not equals the preset value. two: when the temperature is at somewhere between the two ends and equals the preset value, the motor stops. these ste
44、ps are used to achieve the temperature control. in addition, the motor speed can also be adjusted by relative buttons. as shown in fig. 8, the code data is input through ports alla8 (be p2.3p2.0) of the at89s51 and inverted output by the inverter 74ls04 finally it is amplified by the power amplifier
45、 2803a to power the moto匚iv. software designaccording to the general design requirement and hardware circuit principle of the system, as well as the improvement of the program readability, transferability and the convenient debugging, the software design is modularized. the system flow mainly includ
46、es the following 8 steps: post (power-on self-test), system initiation, temperature detection, alarm handling, temperature control, clock chip ds 1302 operation, lcd and keyboard operation. the main program flow is shown in fig. 9. give a little analysis to the above 8 tasks, it is easy to find out
47、that the last five tasks require the real time operation. but to the temperature detection it can be achieved with timero timing 1 second, that is to say temperature detection occurs per second. the system initiation includes global variable definition, ram initiation, special function register initiation and peripheral equipment initiation. global variable definition mainly finishes the interface definition of external inter
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 建筑工程在学习中的应用试题及答案
- 工业互联网平台量子通信技术2025年在金融行业的应用预研报告
- 文化对管理的心理影响试题及答案
- 2025年工程经济 décision theory 试题及答案
- 行政管理中公文输出的规范化试题及答案
- 部分水库设计实例分析试题及答案
- 影响工程经济决策的因素试题及答案
- 2025年农产品无损检测技术在农产品储藏保鲜中的应用报告
- 2025年投资趋势变化试题及答案
- 行政管理的创新型组织结构研究试题及答案
- 宠物药品研究报告-中国宠物药品市场深度全景调研及投资前景分析报告2024年
- 2023年国考公告及职位表
- 【课程思政教学案例】《传热学》课程
- 大学生职业生涯规划与就业指导第2版(高职)全套教学课件
- 中国儿童阻塞性睡眠呼吸暂停诊断与治疗指南护理课件
- 江西康莱特新森医药原料有限公司年产100 吨注射用薏苡仁油生产项目环境影响报告
- 医学简易呼吸器操作及并发症和处理措施课件
- 肾性高血压患者的护理查房课件
- 医学影像数据库建设与应用研究
- 胎儿宫内窘迫的护理查房课件
- 海南跨境电商行业前景分析报告
评论
0/150
提交评论