目录
摘 要 ......................................................................................................... 1 Abstract ....................................................................................................... 2 1 绪 论 ..................................................................................................... 1 1.1 课题意义........................................................................................ 1 1.2 系统开发的相关研究动态 ........................................................... 2 1.2.1 虚拟仪器软件LabVIEW编程技术 ...................................... 2 1.2.2 STC89C51单片机与PC机串口通讯技术 ......................... 7 2 设计方案的论证..................................................................................... 8 2.1 整体方案的论证 ........................................................................... 8 2.2单片机与PC机通信方案的论证 ............................................... 10 3 系统硬件电路的设计 .......................................................................... 11 3.1 单片机控制电路 ......................................................................... 11 3.1.1 STC89C51功能特性的描述 .............................................. 11 3.1.2 电路的分析说明 ................................................................ 12 3.2 单片机与PC机串行通信的设计 .............................................. 13 3.2.1 RS-232接口的介绍 ............................................................ 14 3.2.2 MAX232芯片介绍 ............................................................. 15 3.3 DS18b20温度采集模块的设计.............................................. 16 3.31 DS18b20传感器简介...........................................................16 4 软件程序的设计................................................................................... 18 4.1 单片机与PC机串口通信程序的设计 ...................................... 19
I
4.11波特率的选择.......................................................................20 4.12 通信协议的使用.................................................................21 4.13 温度信号的处理.................................................................22 4.2 PC机LabVIEW程序设计 ....................................................... 24 4.2.1 LabVIEW串口通信程序的设计 ..................................... 25 4.2.2 LabVIEW波形显示程序的设计 ..................................... 29 4.2.3 LabVIEW数据储存程序设计 ......................................... 31 结 论 ....................................................................................................... 34 参考文献 ................................................................................................... 36 附录 部分程序清单 .............................................................................. 37 致 谢 ....................................................................................................... 46
II
基于LabVIEW的恒温水域智能控制系统的界面设计
摘 要
在实验室中的一些精密仪器,对环境的要求是比较苛刻的,例如粘度仪等。而精密仪器对环境的要求大部分则是体现在对温度的严格要求。因此,对精密仪器环境温度进行恒温控制十分必要。现有的一些温度控制设备,如 HA168 型的温度控制棒,结构比较简单,当测量温度低于设定温度时进行加热,其结果是仪器水域内温度不均,控温效果不理想,控制界面也不美观和人性化。目前,国外也开发出了一些基于单片式计算机的温度控制设备,但是价格比较高,且目前其操作系统均为英文,普及性不强。而为了让恒温控制界面好看美观,为了更好的满足用户操作,实现更友好的人机界面,通常可以采用PC与单片机之间的串行通信,通过单片机采集数据,然后用异步串行通讯方式传给PC机。所以本设计着重用虚拟仪器软件Labview编程实现。LabVIEW是一种程序开发环境,由美国国家仪器(NI)公司研制开发的,类似于C和BASIC开发环境,但是LabVIEW与其他计算机语言的显著区别是:其他计算机语言都是采用基于文本的语言产生代码,而LabVIEW使用的是图形化编辑语言G编写程序,产生的程序是框图的形式。LabVIEW软件具有面向对象的设计方法,友好的用户界面等优点,本设计重点在于实现在LabVIEW软件环境下来实现PC机与STC89S51单片机之间串口通讯。
关键词:恒温控制;串口通信;LabVIEW界面设计。
1
Abstract
In the laboratory some of the precision instruments, environmental requirements are more demanding, such as viscosity instrument. The requirements of precision instruments on the environment is reflected in most of the strict temperature requirements. Therefore, precision instruments, the ambient temperature is necessary for temperature control. Some of the existing temperature control equipment, such as the HA168-type temperature control rod, the structure is relatively simple, when the measured temperature is below the set temperature for heating, the result is uneven temperatures within the waters of equipment, temperature control is not satisfactory, the control interface Not beautiful and humane. At present, some foreign countries have also developed computer-based monolithic temperature control equipment, but the price is relatively high, and its operating systems are currently in English, popularity is not strong. The temperature control interface to make good-looking appearance, in order to better meet the user to achieve a more friendly interface, usually used between the PC and the microcontroller serial communication, data collection through the microcontroller, and then use asynchronous serial communications Passed to PC. Therefore, this design focuses on using virtual instrument software Labview programming. LabVIEW is a program development environment, from National Instruments (NI) Development of the company, similar to C and BASIC development environment, LabVIEW with other computer languages, but a significant difference: the other computer languages are generated based on the language of the text Code, while LabVIEW is a graphical editor using the G programming language, the resulting program is a block diagram form. LabVIEW software with object-oriented design methods, user-friendly interface, etc., the design focus is to achieve implementation in the LabVIEW software environment down the PC, serial communication between MCU and STC89S51.
Keywords: temperature control; serial communication; LabVIEW interface design.
2
1 绪 论
1.1 课题意义
现代信息技术的三大基础是信息采集控制(即温度控制器技术)、信息传输(通信技术)和信息处理(计算机技术)。温度的控制无论是在工业生产过程中,还是在日常生活中都起着非常重要的作用,工业生产生活中,温度的测量及控制对保证产品质量、提高生产效率、节约能源、生产安全、促进国民经济的发展起到非常重要的作用。随着我国电子温度控制市场的迅猛发展,与之相关的核心生产技术应用和研发将会成为业内企业关注的焦点。同时了解国内外电子温度控制器生产核心技术的研发动向、工艺设备、技术应用及其趋势对于企业提升产品技术规格,提高市场竞争力至关重要。然而随着生活质量的提高,随着社会的发展,人们对温度的控制要求越来越高,特别是在精密的实验仪器上。
在实验室中的一些精密仪器,对环境的要求是比较苛刻的,例如粘度仪等。而精密仪器对环境的要求大部分则是体现在对温度的严格要求。因此,对精密仪器环境温度进行恒温控制十分必要。现有的一些温度控制设备,如 HA168 型的温度控制棒,结构比较简单,当测量温度低于设定温度时进行加热,其结果是仪器水域内温度不均,控温效果不理想,控制界面也不美观和人性化。目前,国外也开发出了一些基于单片式计算机的温度控制设备,但是价格比较高,且目前其操作系统均为英文,普及性不强。而为了让恒温控制界面好看美观,
3