Application of communication between programmable controller and industrial computer

Publisher:dong125612Latest update time:2009-07-30 Keywords:PLC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

Programmable controller (PLC) has been widely used in the field of industrial control due to its compact structure, high reliability, simple programming, powerful instructions, strong flexibility, and adaptability to relatively harsh environments. The touch screen plus PLC method is now commonly used to monitor equipment, but the touch screen has a narrow viewing angle and is not suitable for harsh environments. In addition, the data storage capacity is limited and it is not easy to achieve large-scale network interconnection. Therefore, we use the method of PLC and computer communication to achieve real-time monitoring, which overcomes the shortcomings of the touch screen.

2 Application of s7-200 cpu free port communication method

There are many world-renowned brands of PLCs, such as Siemens, Omron, Panasonic, Mitsubishi, etc. I will only take the CPU22× series of Siemens S7-200 small programmable controller as an example to introduce the function of PLC communicating with computers in computer networks.

The S7-200 CPU supports a variety of communication functions. Depending on the S7-200 CPU used, its network can support one or more of the following protocols:

Point-to-point interface (PPI)

Multi-point interface (mpi)

profibus

User defined protocol (free port)

Freeport communication is an operation mode in which the communication port of the S7-200 CPU can be controlled by the user program. Using freeport mode, user-defined communication protocols can be implemented to connect a variety of intelligent devices. The user program controls the operation of the communication port by using receive interrupts, send interrupts, send instructions, and receive instructions. In freeport communication mode, the communication protocol is completely controlled by the user program. Freeport mode is enabled through smb30 (port 0) and is only enabled when the CPU is in run mode. When the CPU is in stop mode, freeport communication stops and the communication port is converted to normal PPI protocol operation.

In recent years, with the improvement of my country's railway transportation environment, the speed of trains has become higher and higher, which is bound to put forward higher requirements for railway vehicles, which is reflected in the requirements for train comfort, operation reliability and safety. Therefore, the degree of automation of equipment on vehicles is getting higher and higher. The increase in the degree of automation has driven the application of network technology in train control and monitoring. The schematic diagram of vehicle network control and monitoring is shown in Figure 1.

The whole train is equipped with a vehicle-level computer, and each car is equipped with a car computer. The vehicle-level computer and each car computer form the main network of the vehicle, and the car computer and each device in the car form a subnet. Due to its own advantages, PLC is used as a control core in many devices on the vehicle, such as the control of train automatic doors and train air conditioners, so that it can be used as a node in the entire train network system.


3 Communication Protocol

Siemens S7-200 series PLC can use user-defined communication protocol (free port) mode to realize computer-PLC and PLC-PLC communication. In the example described by the author, although the vehicle computer system and other equipment on the vehicle are products of multiple equipment suppliers, as long as the communication protocol is well formulated, the requirements for mutual communication can be met. The S7-200 series PLC can easily communicate with the vehicle computer because its free port communication is an operation mode that controls the CPU serial communication port through the user program.

The computer (master station) queries the PLC (slave station) every 100ms. The master station sends a slave station action control command to the slave station. After receiving the command, the slave station sends a response frame to the master station. The slave station receives a frame of data sent by the master station, calculates its check code FCS, and compares it with the FCS in the received frame of data to check whether there is any data error. If there is any data error, the slave station sends information to the master station and requests retransmission.
l Character structure: Each character consists of 11 bits, and the parity bit uses odd check mode.

Start bit Data Parity bit Stop bit

1 bit 8 bits d7…d0 1 bit 1 bit

l Transmission data frame format

byte(0)…byte(n) fcs

byte(0)…byte(n) for a string;

fcs is the XOR check code, which is the XOR value of all data bytes and address bytes sent.

l Master station command frame structure

Slave address Slave address complement Control byte Command byte fcs

l Slave station response frame structure

Slave address Slave address complement Control byte Response byte fcs

4 Communication port initialization

The PLC internal special memory bits SMB30 and SMB130 configure communication ports 0 and 1 respectively, selecting the baud rate, parity check, and number of data bits for freeport communication. The control byte description of the freeport is shown in Table 1.

For example: the communication protocol stipulates that the parity check is odd, the data of each character is 8 bits, the baud rate is 19200, the free port protocol is used, and the communication port 0 is used, then smb30 is assigned to 0c5h in the PLC initialization program.

Example: //Serial port initialization┋
network
7
ld sm0.0
movb 16#c5, smb30 //Baud rate is 19200 odd parity //1 start bit 1 stop bit 8 data bits
eni //Enable interrupts
movb 2, smb34
movb 20, smb35
atch int_0, 8

5 PLC real-time data processing

Since the communication protocol of the S7-200 series PLC is completely controlled by the ladder diagram program or STL editor in free port mode, the program can use receive interrupts, send interrupts, send instructions and receive instructions to control communication operations. The CPU continuously scans the user program and executes user tasks. During the program execution process of the PLC, based on stability, speed and flexibility, the CPU performs actual input and output operations through the input and output image registers in each scan cycle, that is, reading the actual input point value to the image register and writing the image register value to the actual output point. Since data reading and writing operations cannot be performed smoothly in the interrupt, it is possible to use programming to utilize the characteristics of the PLC cyclic scanning execution program to achieve data exchange between the data storage area and the input and output image register area during the program scan.

In this example, after the PLC is powered on and initialized, it enters the receive character interrupt. When the host computer sends a query command, the PLC determines whether the address and address complement of the command are correct. If correct, it determines whether the host computer sends a command to the PLC or queries the PLC status. If the command is executed, the PLC enters the main program to execute the relevant command. If the PLC status is queried, the information defined by the protocol is sent to the host computer. After receiving the information, the host computer sends a response frame to the PLC.


Example: interrupt0 //start receiving
network 1
ldn sm3.0
ab= smb2, vb0
movw +0, ac0
movd &vb600, vd638
movb smb2, *vd638
xorw smw1, ac0
movb ac0, vb300
atch int_1, 8
atch int_6, 11
creti
network 2
ld sm0.0
dtch 8
atch int_6, 10
interrupt1 //receive address complement
network 1
ldn sm3.0
an sm1.0
movb smb2, *vd638
xorw smw1, ac0
network 2
ld sm0.0
atch int_6, 10
interrupt2 //judge after receiving command

network 3 //send information
ldw= ac2, +0
ab= vb301, vb604
ab= vb603, 16#00
atch int_4, 10
dtch 11
creti
network 4
ld sm0.0
wdr

network 7
ld sm0.0
s m31.0, 1
dtch 11
atch int_5, 10
interrupt3 //receive response bytenetwork
1
ldn sm3.0
an sm1.0
movb smb2, *vd638
incd vd638
xorw smw1, ac0
decw ac2
network 2
ldw= ac2, 16#0000
movw ac0, vw300
network 3
ld sm0.0
dtch 8
atch int_6, 10
interrupt4 //send information
code┋
network 6
ld sm0.0
movw ac0, vw105
xmt vb100, 0
atch int_6, 9

interrupt5 //Send response flag

network 9
ld sm0.0
movw ac0, vw105
xmt vb100, 0
r m31.0, 1
atch int_6, 9

interrupt6 //Transfer to accept interrupt
network 1
ld sm0.0
dtch 9
dtch 10
dtch 11
atch int_0, 8

6 Computer real-time data processing

The computer program is provided by the vehicle-level network supplier and is usually written in VB or VC according to the communication protocol established by both parties. It will not be described in detail here.

7 Conclusion

From the above description, we can see that the key to the vehicle-level real-time monitoring system composed of vehicle computers and PLCs (or other intelligent programmable devices) is to solve the problem of real-time communication between computers and PLCs, and real-time monitoring of the status of on-board equipment by PLCs. The vehicle real-time monitoring system formed in this way only adds a communication program to the original equipment controller software, so it does not increase the cost of the equipment supplier. Therefore, the development cost of this monitoring system is low, and it has good real-time performance, simple operation, and strong versatility. Then, by using the computer's easy networking function, real-time monitoring of the entire train is realized, which greatly improves the reliability and safety of the train during travel. Therefore, this network system has been widely used in passenger trains, especially high-speed trains.

Keywords:PLC Reference address:Application of communication between programmable controller and industrial computer

Previous article:Design and implementation of a three-degree-of-freedom manipulator control system based on PLC
Next article:Design of power supply control system for server room based on PLC

Recommended ReadingLatest update time:2024-11-16 17:33

What modules does PLC consist of? What are the five stages of PLC working process?
What modules does PLC consist of? PLC is mainly composed of the following modules: CPU module: CPU is the core module of PLC. Its main functions are to process input signals, execute program instructions, control output signals, and provide monitoring and diagnostic functions. CPU module generally includes
[Embedded]
How to use the X and Y axes to create a straight line trajectory in PLC?
How do you use the X and Y axes to create a straight line in a PLC? The two axes need to be coordinated so that their speeds are linearly proportional. How should the position and speed be calculated in the cloud? So today we will study how the S7-200 SMART CPU uses two stepper motors to drive the lead sc
[Embedded]
How to use the X and Y axes to create a straight line trajectory in PLC?
Ethernet communication example between Mitsubishi serial PLC and MatrikonOPC
MatrikonOPC connects to Mitsubishi FX series PLC (FX1N, FX1S, FX2N, FX3U, FX3G) via Ethernet. Xingda Easy Control CHNet-FX communication module provides Ethernet communication interface for PLC. The configuration method is as follows: 1) Connect CHNet-FX to Mitsubishi FX series PLC (FX1N, FX1S,
[Embedded]
Ethernet communication example between Mitsubishi serial PLC and MatrikonOPC
Siemens 200/300 PLC connects CHNet-S7200/300 and MatrikonOPC ModbusTCP communication
Siemens 200/300 PLC connects CHNet-S7200/300 and MatrikonOPC ModbusTCP communication MatrikonOPC connects to Siemens S7300 series PLC via Ethernet. The CHNet-S7300 communication module provides an Ethernet communication interface for PLC. Device Hardware Siemens S7300PLC (CPU314
[Embedded]
Siemens 200/300 PLC connects CHNet-S7200/300 and MatrikonOPC ModbusTCP communication
What is PLC? Functions and selection of PLC
What is PLC? PLC (Programmable Logic Controller), programmable logic controller. A programmable logic controller is a digital computing electronic system designed specifically for use in industrial environments. It uses a programmable memory to store instructions for performing logical operations, sequential co
[Embedded]
Design of numerical control of heat sealing machine based on PLC
Abstract: Aiming at the current demand for heat-sealed bag making, combined with the numerical control design of PLC, the numerical control design of heat sealer based on the internal auxiliary relay state identification method is analyzed, and a set of data acquisition procedures with microprocessor as the center is g
[Industrial Control]
Design of numerical control of heat sealing machine based on PLC
Simple decomposition of PLC's analog signal conversion process
Analog signals are the most basic input form of process signals (pressure, temperature, flow, etc.) in automated process control systems. The process signals in the system are converted into unified voltage and current signals through transmitters, and these signals are transmitted to the controller (PLC) in real ti
[Embedded]
Simple decomposition of PLC's analog signal conversion process
7 methods of PLC automatic sequence programming
The function of PLC automatic sequence is to control the equipment to work according to a pre-designed process flow. There are several methods for writing the process of PLC automatic program. The following is a detailed explanation. PART01 The first method of setting and resetting the auxiliary relay
[Embedded]
7 methods of PLC automatic sequence programming
Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号