当前位置:文档之家› PLC与工控机的串口通信设计

PLC与工控机的串口通信设计

PLC与工控机的串口通信设计摘要随着计算机技术,自动控制技术及网络技术的迅速发展,在工业领域中对控制系统的要求逐渐增高。

在众多的工业控制系统中,分布式控制系统应用最为广泛。

在分布式控制系统中,PLC作为现场控制设备,被用于数据采集与控制。

而PLC 又由工业控制计算机进行编程从而实现两者的数据交换。

PLC与工控机的结合,提供了一种可靠、经济和开发周期短的分布式控制系统构建方案。

本文主要以PLC作为硬件基础,结合工控机编程软件实现两者间的串口通信。

串口通信的实现是工业控制系统的关键,它作为一种灵活、方便、可靠的数据传输方式,在工业现场得到了越来越多的应用。

本文中使用的是三菱PLC与工控机进行通信。

通过了解PLC的基本结构、工作原理、功能及特点、内部运作方式和扫描周期,以及三菱PLC的工作模式与网络通信结构,确定PLC与工控机的连接通过标准RS-232通信电缆实现。

PLC与工控机利用标准RS-232通信电缆连接后,首先要设置上下位机的通信格式,具体为数据长度、奇偶校验、停止位、波特率、标题、终结符、控制线、和校验、协议等内容的设置;继而还要设置通信控制协议格式。

最后由工控机软件进行编程,编程软件由VC++6.0实现,在软件平台内采用通信空间MSComm空间进行工控机与PLC的通信。

将PLC与工控机连接后进行了通信验证,可以证明该程序可以实现PLC与工控机的串口通信。

关键词:PLC、工控机、串口通信、VC++6.0AbstractWith the rapid development of the computer technology, the automaticcontrol technology and the network communication, the demand presented by the industry and mining enterprise to the control system is higher and higher. In the multitudinous industrial control system, the distributed control system’s application is most widespread. In the distributed control system, they usually select PLCas the control device, using in the data acquisition and control. By the industrial control computer, PLC can be programmed to realize the data exchange. The combination of PLC and industrial controlling provides a reliable, economic and short development cycle to build distributed control system. Based on the hardware of the PLC ,the pape combined with software to realize the serial communication between industrial control programming.The implementation of serial communication is the key to the industrial control system, as a flexible, convenient and reliable way of data transmission, is becoming more and more popular in the industrial field of application. The paper use a mitsubishi PLC and industrial computer to realize the communicate. Through understanding the basic structure, working principle, functions and characteristics, internal operation and scan cycle of PLC. And the operation mode of the Mitsubishi PLC and network communication structure, determine the PLC and industrial PC connected via a standard RS - 232 communication cables.PLC and industrial PC using a standard RS-232 communication cable connection, the first to set up the upper and lower position machine communication format, specific to the data length, baud rate, parity, stop bits, and title, terminator, the line of control, and calibration, agreement, etc. Set of content; then set the communication control protocol format. Finally conducted by the industrial computer software programming, the programming software by VC++ 6.0 to realize, in the software platform USES the communication space MSComm space carries on the industrial PC and PLCcommunications. After connect the PLC and industrial control communication verification, to prove the program can realize serial communication of PLC and industrial control.Key word: PLC,industrial control computer, serial port communication, VC++6.0目录第1章绪论1.1 课题研究背景及意义 (25)1.2 国内外发展现状 (26)1.2.1 PCI国内外发展现状 (26)1.2.2 工控机的国内外发展现状 (27)1.3串口通信介绍 (29)1.4本课题主要研究的内容 (30)第2章可编程控制器与工控机的概述2.1PLC的工作原理及功能特点 (32)2.1.1 PLC的基本结构 (32)2.1.2 PLC的主要功能及特点 (33)2.1.3 PLC的工作原理 ............................ 错误!未定义书签。

2.1.4 PLC内部运作方式 .......................... 错误!未定义书签。

2.1.5 PLC扫描周期 .............................. 错误!未定义书签。

2.2三菱PLC介绍 (33)2.2.1 三菱PLC的工作模式........................ 错误!未定义书签。

2.2.2 三菱PLC的网络层次结构.................... 错误!未定义书签。

2.3工控机的介绍 (34)第3章 PLC的串口通信3.1串口通信原理 (42)3.1.1 串口通信 (42)3.1.2 串口通信接口标准 (43)3.2FX系列PLC的串口通信协议 (45)3.2.1 通信协议数据帧格式 (46)3.2.2 通信端口的设置与通信协议的命令字 (47)3.2.3 报文格式 (48)3.3PLC编程 (49)第4章工控机与PLC串口通信程序设计4.1上位机软件介绍 (50)4.2软件功能设计 (50)4.2串口通信验证 (59)第5章总结与展望参考文献致谢第1章绪论1.1课题研究背景及意义随着现代工业向大型化、集成化方向的发展,在复杂的工业过程控制中,使用多微机系统有效地实现多任务分配与管理[1]。

这种多微机系统就是由PC机、PLC 或是单片机组成,在各微机间可以实现远或是近距离的通信[2,3]。

同时计算机软件、硬件及多媒体技术的飞速发展大大增强了系统与人机间联系的灵活性。

现在使用较多的是分布式控制系统,又称为离散系统,这种系统在结构上的分散,即将计算机分布到车间或装置一级,不仅使系统危险离散,消散了全局性的故障节点,增强了系统的可靠性,而且可以方便灵活地实现各种新型控制规律。

目前很多分布式控制系统中常选PLC作为现场级的控制设备,用于数据采集和控制,PCI及其网络架构是构成CIMS系统的基础,被称为现代工业自动化的三大支柱(PLC,数控技术,工业机器人)之一,由于其使用简单、功能强大、可靠性高,目前已广泛应用于现代工业的各个领域[3];而在操作管理级上采用工业控制计算机(ICP),并利用工控组态软件对工业流程及控制参数的监控界面进行编程,从而实现生产状况监控和设备管理等功能,这就要求IPC具有数据采集、数据处理以及控制信号的产生与传输的能力。

因此在PCI与工控机之间进行数据的通信。

PCI与工控机的结合,提供了一种可靠、经济和开发周期短的分布式控制系统构建方案。

可编程序控制器(PLC)是近年来发展极为迅速,应用广泛,以微处理器为核心[4],集微型计算机技术、自动化技术、通信技术于一体的通用工业控制装置。

其中三菱工控产品在工控领域应用市场中有较高的占有率。

在集成过程控制中,关键是解决系统中各种设备的通信问题。

目前市场上的工控产品众多,普遍存在能否兼容的问题。

有些工控产品,开发商处于对市场垄断的目的,一些产品资料不对外公开,必须购买其产品与服务,这就给控制系统的自主集成造成了很大的障碍;而市面上叫成熟的工艺组态软件虽然内部集成了设备的驱动程序,但是价格昂贵,适性也不完美,这就需要开发人员根据实际进行改进。

相关主题