摘 要 在工业生产中,电流、电压、温度、压力、流量、流速和开关量都是常用的主要被控参数。其中,温度控制也越来越重要。在工业生产的很多领域中,人们都需要对各类加热炉、热处理炉、反应炉和锅炉中的温度进行检测和控制。采用单片机对温度进行控制不仅具有控制方便、简单和灵活性大等优点,而且可以大幅度提高被控温度的技术指标,从而能够大大的提高产品的质量和数量。因此,单片机对温度的控制问题是一个工业生产中经常会遇到的控制问题。 单片机是一种集CPU、RAM、ROM、I/O接口和中断系统等部分于一体的器件,只需要外加电源和晶振就可实现对数字信息的处理和控制。因此,单片机广泛用于现代工业控制中。 本论文侧重介绍“单片机温度控制系统”的软件设计及相关内容。论文的主要内容包括:采样、滤波、键盘、LED显示和报警系统,加热控制系统,单片机MCS-51的开发以及系统应用软件开发等。作为控制系统中的一个典型实验设计,单片机温度控制系统综合运用了微机原理、自动控制原理、模拟电子技术、数字控制技术、键盘显示技术等诸多方面的知识,是对所学知识的一次综合测试。 关键词:MCS-51;8051;温度控制;PID ABSTRACT With scientific constant progress, in industrial production, electric current, voltage, temperature, pressure are mainly commonly used. especially in the heat treatment industry, the accurate test and controlling of temperature is very important. In a lot of fields, for example: In metallurgical industry, chemical production, power engineering, machine manufactures, food processing, family and industry heat etc. people need to heating furnace, heat-treatment furnace and all kinds of response stove and boiler temperature measure and control, through software design, to reach the intelligent control finally and realize the interactive function. Adopt Single-Chip Microcomputer is it control convenient, simple, flexibility advantage such as being heavy to have not merely to control to go on to temperature to come, and can raise by technical indicator not to accuse of temperature by a large margin, thus can big improvement quality and the quantity of products. So the control problem to the temperature of Single-Chip Microcomputer is the control problem constantly be able to encounter in the industry manufacture. This thesis introduces the design and debugging of “the temperature control system by microcomputer”. As a typical experimental design in control system, it uses much control knowledge and comprehensively tests student’s ability in control system. The content of this thesis mainly includes: introduces, filtering ware, keyboard, man-computer dialogue supported by LED indication, heat control method, the development of micro-computer MCS-51 and systemic applied software. Key words:MCS-51, 8051, temperature control, PID 目 录 第一章 绪论…………………………………………………………1 1.1 概述……………………………………………………………………1 1.2 课题分析………………………………………………………………1 1.3 设计思路………………………………………………………………2 第二章 MCS-51单片机的基本知识…………………………………4 2.1 MCS-51单片机的结构…………………………………………………4 2.2 8051存储器配置………………………………………………………5 2.3 定时器及其应用………………………………………………………8 2.4 本章小结………………………………………………………………9 第三章 采样与滤波………………………………………………...10 3.1 采样……………………………………………………………………10 3.1.1 ADC0809的主要功能……………………………………………10 3.1.2 逐次逼近式转换原理……………………………………………11 3.2 数字滤波………………………………………………………………11 3.2.1 硬件滤波器………………………………………………………11 3.2.2 数字滤波器………………………………………………………12 3.3 可控硅…………………………………………………………………14 3.3.1 可控硅的结构…………………………………………………14 3.3.2 可控硅的基本特性………………………………………………14 3.4 本章小结………………………………………………………………15 第四章 控制系统的算法…………………………………………………16 4.1 PID控制的离散化……………………………………………………16 4.2 PID位置式算法………………………………………………………17 4.3 PID的增量式算法……………………………………………………18 4.4 PID算法的改进………………………………………………………18 4.4.1 积分分离PID控制算法………………………………………19 4.4.2 不完全微分PID算法…………………………………………20 4.4.3 微分先行PID算法……………………………………………21 4.4.4 带死区的PID控制……………………………………………22 4.5 PID控制器的参数整定………………………………………………22 4.6 Smith 预估器的补偿原理……………………………………………26 4.7 数字Smith预估系统…………………………………………………28 4.8 本章小结………………………………………………………………30 第五章 系统程序设计……………………………………………...31 5.1 主程序…………………………………………………………………31 5.2 键盘扫描及显示程序…………………………………………………32 5.3 T0中断服务程序………………………………………………………33 5.4 子程序………………………………………………………………34 5.4.1 采样子程序SAMP………………………………………………34 5.4.2 数字滤波子程序FILTER………………………………………36 5.4.3 PID计算子程序………………………………………………36 5.5 本章小结……………………………………………………………39 结 论……………………………………………………………40 参考文献……………………………………………………………41 致 谢……………………………………………………………42 第一章 绪论 1.1 概述 随着现代工业的逐步发展,在工业生产中,温度、压力、流量和液位是四种最常见的过程变量。其中,温度是一个非常重要的过程变量。例如:在冶金工业、化工工业、电力工业、机械加工和食品加工等许多领域,都需要对各种加热炉、热处理炉、反应炉和锅炉的温度进行控制。然而,用常规的控制方法,潜力是有限的,难以满足较高的性能要求。采用单片机来对它们进行控制不仅具有控制方便、简单和灵活性大的优点,而且可以大幅度提高被测温度的技术指标,从而能够大大提高产品的质量和数量。因此,单片机对温度的控制问题是一个工业生产中经常会遇到的控制问题。 1.2 课题分析 |