收藏 分享(赏)

简易水温控制系统.doc

上传人:精品资料 文档编号:8413283 上传时间:2019-06-25 格式:DOC 页数:23 大小:273.15KB
下载 相关 举报
简易水温控制系统.doc_第1页
第1页 / 共23页
简易水温控制系统.doc_第2页
第2页 / 共23页
简易水温控制系统.doc_第3页
第3页 / 共23页
简易水温控制系统.doc_第4页
第4页 / 共23页
简易水温控制系统.doc_第5页
第5页 / 共23页
点击查看更多>>
资源描述

1、一个简易水温控制系统的设计控制算法设计摘 要在工农业生产和日常生活中,对温度的检测与控制始终有着非常重要的实际意义和广泛的实际应用。为了加深计算机控制理论的理解,故设计一个温度控制系统,该系统主要由温度信号采集与转换模块、主机控制模块、温度控制模块、液晶显示模块四部分组成,控制算法为 PID 算法。系统可实现稳态误差小于 1,最大超调小于 1,并且调节时间较短,恒定效果好。温度控制系统的对象存在滞后,它对阶跃信号的响应会推迟一些时间,对自动控制产生不利的影响,因此对温度准确的测量和有效的控制是此类工业控制系统中的重要指标。温度是一个重要的物理量,也是工业生产过程中的主要工艺参数之一,物体的许多

2、性质和特性都与温度有关,很多重要的过程只有在一定温度范围内才能有效的进行,因此,对温度的精确测量和可靠控制,在工业生产和科学研究中就具有很重要的意义。本文阐述了过程控制系统的概念,介绍了一个基于数字传感器 DS18B20和单片机 STC89C52 的简单温度控制系统,以电热水壶为被控对象,通过实验的方法建立温度控制系统的数学模型,采用了 PID 算法进行系统的设计,达到了比较好的控制目的。该系统可通过液晶显示器 LCD1602 显示数据或字符,通过按键设定参数;通过 DS18B20测温,实现电热杯水温控制;通过 PL2303 下载端口,实现单机和上位机的通讯。实验表明该系统能够实现对温度的控制

3、,具有一定的控制精度。该系统测温电路简单、连接方便,可用于简单温度控制的场合。关键词:单片机;温度传感器;液晶显示器;PID 算法AbstractIn industrial and agricultural production and daily life, the testing and control of temperature has always had very important practical significance and extensive practical application. In order to deepen the understanding of

4、the computer control theory, the design of a temperature control system, the system is mainly composed of temperature signal acquisition and conversion module, host control module, temperature control module, liquid crystal display module four parts, the control algorithm for PID algorithm. System c

5、an realize the steady state error is less than 1 , the maximum overshoot less than 1 , and the adjustment time is shorter, constant effect is good. Lagged temperature control system of the object, its response to the step signal will delay some time, produce adverse effect to the automatic control,

6、so effective for accurate temperature measurement and control is an important indicator in the industrial control system. Temperature is an important physical quantities, it is also one of the main process parameters in industrial production process, many properties of objects and features are relat

7、ed to temperature, a lot of important process can only be effective in a certain temperature range, thus, accurate measurement and reliable control of temperature, in the industrial production and scientific research has the very vital significance. This paper expounds the concept of process control

8、 system, introduced a digital sensor DS18B20 and single chip microcomputer based STC89C52 simple temperature control system, electric kettle for controlled object, and through the experiment the method to establish the mathematical model of temperature control system, using PID algorithm to the desi

9、gn of the system, to achieve the better control. Through DS18B20, the temperature control of the electric heat cup is achieved. Through the PL2303 download port, the communication between the single machine and the above machine is achieved. The experiment shows that the system can control the tempe

10、rature, and has certain control accuracy. The system is simple and easy to connect, which can be used for simple temperature control.Key words: single chip microcomputer;the temperature sensor;Liquid crystal display;PID algorithm目录一设计任务与要求 41.基本要求 .4二方案论证 4三系统设计 51.硬件设计 .52.软件设计 .10(1)算法 10(2)控制系统模型

11、分析 11仿真结果图 12四、实验结果 12五、结论 13六、心得体会 13附录 14参 考 文 献 24给定值一设计任务与要求1.基本要求1L 水由 1kW 的电路加热,要求水温可以在一定范围内由人工设定,并能在环境温度变化时实现自动调整,以保持在设定的温度。2.主要性能指标(1).温度设定范围:10100,最小分辨率为 1。(2).控制精度:温度控制的稳态误差#include void Delay1us(unsigned int y)for(y;y0;y-)_nop_();_nop_();unsigned char Ds18b20Init()unsigned int i;DSPORT=0;

12、Delay1us(600);DSPORT=1;i=0;while(DSPORT)i+;if(i5000)return 0;return 1;void Ds18b20WriteByte(unsigned char dat)unsigned int j;for(j=0;j=1;unsigned char Ds18b20ReadByte()unsigned char byte,bi;unsigned int j;for(j=8;j0;j-)DSPORT=0;Delay1us(1);DSPORT=1;Delay1us(6);bi=DSPORT; byte=(byte1)|(bi#include #in

13、clude void Delay1ms(unsigned int y)for(y;y0;y-)unsigned char i, j;_nop_();_nop_();i = 12;j = 168;dowhile (-j); while (-i);float Temp_Change(int temp) unsigned char datas =0, 0, 0, 0, 0, 0, 0, 0; float tp;if(temp#include void LcdWriteCom(uchar CMD,uchar Attribc)if(Attribc)WaitForEnable();LCD1602_RS=0

14、;LCD1602_RW=0;_nop_();LCD1602_DATAPINS=CMD;_nop_();LCD1602_E=1;_nop_();_nop_();LCD1602_E=0;void LcdWriteData(uchar dataW)WaitForEnable();LCD1602_RS=1;LCD1602_RW=0;_nop_();LCD1602_DATAPINS=dataW;_nop_();LCD1602_E=1;_nop_();_nop_();LCD1602_E=0;void LcdInit() LcdWriteCom(0x32,1);LcdWriteCom(0x38,1);Lcd

15、WriteCom(0x08,1);LcdWriteCom(0x01,1);LcdWriteCom(0x06,1);LcdWriteCom(0x0c,1); Delay1ms(30);DisplayChar(0,0,“Welcome To SUST“);Delay1ms(1);DisplayChar(1,0,“ML-2016.12.27“);Delay1ms(1000);LcdWriteCom(0x01,1);Delay1ms(1);DisplayChar(0,0,“Made In 2A314“);Delay1ms(1);DisplayChar(1,0,“ML-2016.12.27“);Dela

16、y1ms(2000);LcdWriteCom(0x01,1);Delay1ms(300);void WaitForEnable(void)LCD1602_DATAPINS=0xff;LCD1602_RS=0;LCD1602_RW=1;_nop_();LCD1602_E=1;_nop_();_nop_();while(LCD1602_DATAPINSLCD1602_E=0;void Delays(uchar i) while(i-);void DisplayChar(uchar Y,uchar X,uchar *s)YXif(Y) X|=0xC0;else X|=0x80;while(*s!=0

17、)LcdWriteCom(X+,0);LcdWriteData(*s);Delays(1);s+;/void LCD_dis_data5(uchar x,uchar y,uint data5)/ uchar pos,i=0,str6;/ switch(x%2)/ / case 1:pos=0x80+y;break; / case 0:pos=0xc0+y;break; / / LcdWriteCom(pos,0); / str0=data5/10000%10+0x30;/ str1=data5/1000%10+0x30;/ str2=data5/100%10+0x30;/ str3=data5

18、/10%10+0x30;/ str4=data5%10+0x30;/ str5=0;/ while(stri != 0)/ / LcdWriteData(stri+);/ /void LCD_dis_data4(uchar x,uchar y,uint data4)uchar pos,i=0,str5;switch(x%2)case 1:pos=0x80+y;break; case 0:pos=0xc0+y;break; LcdWriteCom(pos,0); str0=data4/1000%10+0x30;str1=data4/100%10+0x30;str2=data4/10%10+0x3

19、0;str3=data4%10+0x30;str4=0;while(stri != 0)LcdWriteData(stri+);/void LCD_dis_data3(uchar x,uchar y,uint data4)/ uchar pos,i=0,str4;/ switch(x%2)/ / case 1:pos=0x80+y;break; / case 0:pos=0xc0+y;break; / / LcdWriteCom(pos,0); / str0=data4/100%10+0x30;/ str1=data4/10%10+0x30;/ str2=data4%10+0x30;/ str

20、3=0;/ while(stri != 0)/ / LcdWriteData(stri+);/ /void Display(uchar x,uchar y,uint datas)/ uchar pos,i=0,str8;/ switch(x%2)/ / case 1:pos=0x80+y;break; / case 0:pos=0xc0+y;break; / / LcdWriteCom(pos,0); / str0=datas/1000%10+0x30;/ str1=datas/100%10+0x30;/ str2=datas/10%10+0x30;/ str3=.;/ str4=datas%

21、10+0x30;/ str5=0;/ while(stri != 0)/ / LcdWriteData(stri+);/ /void DisplayWD(uchar x,uchar y,uint datas)uchar pos,i=0,str9;switch(x%2)case 1:pos=0x80+y;break; case 0:pos=0xc0+y;break; LcdWriteCom(pos,0); str0=datas/10000%10+0x30;str1=datas/1000%10+0x30;str2=datas/100%10+0x30;str3=.;str4=datas/10%10+0x30;str5=datas%10+0x30;str6=0xDF;str7=C;str8=0;while(stri != 0)LcdWriteData(stri+);参 考 文 献【1】 林敏.计算机控制技术及工程应用(第 3 版).国防工业出版社.2014 年 9 月第三版.【2】 张毅刚 王少军 付宁.单片机原理及接口技术(第 2 版).人民邮电出版社.2015年 1 月第一版.【3】 俞金寿 孙自强.过程控制系统(第 2 版).机械工业出版社.2015 年 1 月.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报