自动排液监测系统
原站著录信息
摘要
自动排液监测系统 摘 要 本系统是利用单片机和 PC机通过串口通信实现气液分离器自动排液的监测系统。在系统设计中,将单片机作为下位机,将PC机作为上位机,通过串行口RS-232实现串行通信。单片机采用AT89S51芯片,由单片机组成的下位机检测系统的工作,即时将气液分离器中的水位状态反馈给上位 PC机。上位机通过串行口RS-232得到系统的工作情况后,通过用户界面在PC机中反映出来,同时上位机根据设定的参数指帮写硕士论文示下位机做出相应的反应,控制电磁阀动作。在生产现场,检测杆内安装了传感器,通过对传感器的检测来判…
自动排液监测系统
摘 要
本系统是利用单片机和 PC机通过串口通信实现气液分离器自动排液的监测系统。在系统设计中,将单片机作为下位机,将PC机作为上位机,通过串行口RS-232实现串行通信。单片机采用AT89S51芯片,由单片机组成的下位机检测系统的工作,即时将气液分离器中的水位状态反馈给上位 PC机。上位机通过串行口RS-232得到系统的工作情况后,通过用户界面在PC机中反映出来,同时上位机根据设定的参数指帮写硕士论文示下位机做出相应的反应,控制电磁阀动作。在生产现场,检测杆内安装了传感器,通过对传感器的检测来判断液面位置,从而下位机即可控制电磁阀通断。系统中上位微机 (PC机)承担监测显示控制任务,程序由Visual Basic6.0编写,利用Visual Basic6.0中的通信控件MScomm实现通信。上位机和下位机均采用查询方式发送控制字符和数据、中断方式接收控制字符和数据。
系统设计结构紧凑、运行性能稳定可靠,广泛应用于天然气井场、集气站液分离器,内含H2S及CL根的气田水的自动控制排放。采用本系统,可以大大提高现场信号的实时监测,保证气液分离器顶部不翻塔、不跑液、底部不串气。对实验操作人员来说人机界面良好,简单易懂。对确保输气质量,净化环境,消除安全隐患,改善工人劳动条件均具有显著作用,进一步减少了有毒物质对人体的伤害。
关键词:自动排液;单片机控制;串口通信;PC机实时监
Abstract
This system is the monitor system which makes use of single slice machine and PC machine to pass a string of correspondence realization spirit liquid separation machine to line up a liquid automatically. 1n the system design, we regard the monolithic integrated circuit as the lower position machine, PC machine as the position machine, and realize the serial communication through serial port RS-232. The single slice machine adopts the AT89C51 chips, constituting to from the single slice machine of next machine examination system of work, instant separate spirit liquid the water level appearance feedback in the machine to place of honor PC machine.On the position machine obtains the system after serial mouth RS-232 the working condition, reflected through the user contact surface in PC machine,on simultaneously the position machine basis establishes the parameter instructed the lower position machine makes the corresponding response, controls the solenoid valve movement. Be producing the spot, examined to install to spread a feeling machine inside pole, pass to judge water level to place to the examination which spreads a feeling machine, the thus next machine can immediately control electromagnetism valve to break. The place of honor tiny machine (PC machine) undertakes the control mission of the monitor manifestation in the system, procedure from Visual Basic6.0 write, make use of Visual Basic6.0 medium of the correspondence control a MSComm realization correspondence. Place of honor machine and next machine all adopt a search method to send out control character list and data and break off a way to receive the control character list and data.
This system structure compact, the performance characteristic stable is reliable, mostly applies to the natural gas well yard, the gatheringof gas station was mad the fluid separator, contains H2S and the CL rootnatural gas field water automatic control discharges. Uses this system,greatly enhanced the scene signal real-time monitor, guaranteed was madthe fluid separator crown does not turn the tower, does not run the fluid, the base not hernia. To tests the operator to say the man-machine contactsurface good, simple is easy to understand. To guarantees loses is mad the quality, the purification environment, eliminates the security hiddendanger, improves the worker work condition to have the remarkable function, further reduced the virulent confrontation human body injury.
Keywords: Automatic liquid;Single-chip Control;Serial Communication;PC-real-time monitoring
目 录
引言 1
1 自动排液系统的原理及简介 1
1.1 LYLCA-Ⅲ节电型自动排液系统简介 1
1.2 LYLCA-Ⅲ节电型自动排液系统改进的背景和意义 2
1.3 单片机和PC机串行通信的国内外研究现状 3
1.4 本论文的选题和研究内容 5
2 系统总体设计 5
2.1 系统总体设计方案 5
2.2 关键技术与算法 6
2.2.1RS-232通信 6
2.2.2串行通信控件(MSComm) 9
2.2.3单片机硬件设计方案 12
2.2.4PC端VB程序设计方案 19
3 系统实现 20
3.1 单片机工作原理和实现过程 21
3.2 PC端程序设计 23
3.2.1登陆系统 23
3.2.2PC端排液监测主系统 27
3.2.3主系统初始化 29
3.2.4排液量设置 30
3.2.5系统设置 31
3.2.6数据管理 33
3.2.7系统测试 37
3.2.8系统帮助 38
3.2.9退出系统 39
4 系统总结 39
谢 辞 41
参考文献 42
附 录 43
附录1 单片机程序设计清单 43
附录2 硬件仿真图 49
附录3 硬件电路图 50
引言
本论文主要研究自动排液系统的监测部分,自动排液系统由磁性液位计、液位检测控制仪、气动排液阀等主要部件组成。其主要工作原理:液位计筒体内磁浮子与分离器内液位始终保持同一高度,标尺上直接显示其液位高度,有上下限液位开关,上下限液位报警开关,当分离器内液位升至排液高度时,控制机构使排液阀打开进行自动排液;若发生故障,液位超限时,控制仪发出声光报警,提示及时处理和排除故障。
由单片机构成的数据采集系统和PC机通过串行口构成的多微机系统己经广泛应用于工业控制、环境监测等领域。我们提出了利用单片机和 PC机通过串口通信实现气液分离器自动排液的监测系统。单片机通过RS-232接口,实现数据传输,原有的 LYLCA-III, LYLCA-III( IV)节电型自动排液系统硬件部分不需要做改动,关键是做单片机和PC机软件部分的设计。单片机采用AT89S51高性能8位单片机,采用MCS51系列的汇编语言编程。监测终端通过PC机来控制,利用微软MScomm控件实现通信。由于Visual Basic具有面向对象的设计方法,友好的用户界面,简单方便的串行通讯和实用性强等优点,无需借用其他语言就可以开发出优秀的控制系统通讯软件,所以PC机的编程语言采用VB语言来实现。
1 自动排液系统的原理及简介
1.1 LYLCA-Ⅲ节电型自动排液系统简介
参考文献
[1] Http://www. rgmeter.com/docc/cpxl3.htm
[2] [美]Jan Axelson.串行端口大全(精英科技译) [M].北京:中国电力出版社,2001:30~70.
[3] 李朝青.PC机与单片机&DSP数据通信技术选编(1) [M].北京:北京航空航天大学出版社,2003
[4] 李朝青.PC机与单片机&DSP数据通信技术选编(2) [M].北京:北京航空航天大学出版社,2003
[5] 李朝青.PC机与单片机&DSP数据通信技术选编(3) [M].北京:北京航空航天大学出版社,2004
[6] 范逸之. Visual Basic与RS-232串行通信控制[M].北京:中国青年出版社,2001:110~163.
[7] 《电脑编程技巧与维护》杂志社.Visual Basic编程典型实例解析[M].北京:北京蓝空印刷厂,2007:58~96.
[8] 黄明,梁旭.Visual Basic6.0信息系统设计与开发实例(第二版)[M].北京:机械工业出版社,2005:111~154.
[9] 赵煜筠. 从零开始—Visual Basic中文版基础培训教程[M].北京:人民邮电出版社,2002
[10] 李长林,张丽华,王红编. Visual Basic数据库应用系统开发从基础到实践[M].北京:电子工业出版社,2004:80~160.
[11] 张玉强,白少民.串口通信编程分析及其 VB编程实例.延安大学学报(自然科学版) [J],2003,3:31-33
[12] 林巧玲,兰浩,谢国栋.用 VB实现 PC机与MCS-51单片机的主从式通信.电工技术学报[J],1999,14(6):22-24
[13] [美]Darwin Boyle.Visual Basic 4 Developer's Guide[M].北京:机械工业出版社,1997:156~159.
[14] 王栋.Visual Basic6.0程序设计实用教程[M].北京:清华大学出版社,2003 :55~104.
[15] 窦振中.PIC系列单片机原理和程序设讯北京[M].北京:北京航空航天大学出版社,2000 :75~89.
[16] MICROCHIP CO. PIC16/17 MICROCO-NfROLLER DATA BOOK.1995/1996
[17] 周航慈,周立功.PHILIPS 51LPC单片机原理及应用设计[M].北京:北京航空航天大学出版社,2002:66~184.
[18] 袁涛,孙腾湛. PL / M-96程序设计语言及其应用[M].北京:清华大学出版社,1992:23~89.
[19] [美]Stefano Maruzzi.The Microsoft Windows 95 Developer's Guide[M].北京:机械工业出版社,1997:158~203.
[20] 章立民.Visual Basic2003-2005开发秘诀与范例大全
