The hottest touch screen based on Modbus Protocol

  • Detail

Touch screen based on Modbus protocol

1 introduction

modbus protocol is a communication protocol applied to various intelligent electronic controllers. It has become a mainstream industrial standard (China national industrial automation standard gb/z19582.x-2004). Through this protocol, controllers can communicate with each other, controllers and other devices, which makes it possible for control devices manufactured by different manufacturers that comply with Modbus protocol to form an industrial network for centralized control

there are two traditional control methods of frequency converter: one is through the operation panel of the frequency converter, and the other is through the control terminal of the frequency converter. The first way is to set the operating frequency, acceleration and deceleration time and other parameters through the operation panel, and then realize the start and stop control of the motor through the keys on the operation panel. The second is to logically combine multiple operating frequencies at the input port of the frequency converter control terminal in advance or input 0 ~ 10V or Ma signals at the analog input terminal to change the given frequency, and then start/stop the motor through the control terminal. The traditional frequency converter parameter monitoring is mainly through the pointer instrument to read the operating parameters

in the above control mode, the information interaction between the control system and the frequency converter is very limited, and the reading of multiple parameters depends on multiple pointer instruments, which makes the system bulky, the line connection complex, and the analog input signal vulnerable to interference and short transmission distance. This paper introduces a real-time monitoring system of frequency converter based on fieldbus technology, which not only solves the problems of traditional monitoring methods, but also meets the requirements of networking

2 Modbus protocol

2.1 protocol principle

modbus protocol is a master-slave protocol. At the same time, only one master station and up to 247 slave stations can be connected to the bus. Modbus communication is always initiated by the master station. When the slave station does not receive the request from the master station, it will not send data. The master station can only start one MODBUS transaction at the same time, and the slave stations cannot communicate with each other. The master station sends MODBUS requests to the slave station in two modes: unicast mode and broadcast mode. Unicast mode means that the master station addresses a single slave station. After the slave station receives and processes the request, it returns a reply to the master station. In the broadcast mode, the master station can send requests to all slave stations, and the slave station does not reply to the request broadcast by the master station. The broadcast request must be a write command, and all devices must receive the broadcast of the write command. Address 0 is reserved to identify broadcast traffic

the standard Modbus protocol uses RS-232C compatible serial interface, which defines the pin, cable, signal bit, transmission baud rate and parity of the connection port. Modbus system can also use different physical interfaces, such as RS-485 and RS-232

2.2 transmission mode and MODBUS message frame

in the standard MODBUS network, MODBUS message data is divided into two transmission modes: ASCII and RTU. In the two transmission modes, the sending device converts the Modbus message into a data frame with a starting point and an ending point, and the receiving device starts working at the starting point of the message, and can set the communication error as the return result

ascii message frame, using ASCII mode, the message starts with a colon (:) character (ASCII code 3ah) and ends with a carriage return line feed character (ASCII code 0dh, 0ah). The transmission characters that other codes can use are hexadecimal 0 9,a... f。 A typical ASCII message frame is shown below

rtu message frame, using RTU mode, the message transmission should start with a pause interval of at least 3.5 characters. The first code transmitted is the device address. It can be used and will work with selected partners to convert this technology into commercial products in the next few months. The transmission character is hexadecimal 0 9,a... f。 A typical ASCII message frame is shown below

3 system design

3.1 hardware connection

according to the requirements of real-time control of frequency converter action and real-time monitoring of frequency converter operating parameters through communication, the system adopts the combination of man-machine interface +plc+ frequency converter. The man-machine interface adopts Delta dop-a series touch screen, the core control part is Schneider Electric twin PLC (16 points and above), and the actuator is Emerson EV2000 general-purpose inverter

in terms of equipment connection, two communication interfaces are required for Twido PLC. It has one RS-485 interface (COM1) and can be extended by another RS-485 interface (com2). Twido PLC uses COM1 port to communicate with dop-a, dop-a as MODBUS master station and Twido PLC as slave station to realize the real-time monitoring of the operating parameters of the frequency converter; Com2 port is used to communicate with EV2000. Twido PLC is used as MODBUS master station and EV2000 is used as slave station to realize real-time control of inverter action, as shown in Figure 1

dop-a series touch screen is equipped with 1 USB port (for programming) and 2 serial ports (COM1, com2). COM1 is RS-232 and com2 is rs-232/485. As the man-machine interface of the system, it monitors the running state of the system and reads the operating parameters of the frequency converter collected by PLC and displays them on the monitoring interface. The HMI PLC port wiring is shown in Figure 2

Figure 2 HMI PLC port wiring diagram

ev2000 comes with RS-485 interface, which is used to realize the communication connection with PLC. RS-485 has long communication distance, simple wiring and strong anti-interference ability. All the control of the frequency converter is completed through RS-485 communication link, which achieves the purpose of economic efficiency

and the speed control is not accurate. 3.2 serial communication parameter settings of frequency converter, PLC and touch screen

plc are connected with frequency converter and touch screen through two interfaces respectively. The whole system adopts Modbus RTU transmission mode. Key points of EV2000 inverter communication parameter setting:

(1) all communication parameters should be consistent with the two PLC com2 port

(2) the frequency converter should have its own unique address

(3) the communication jumper switch cn14 of the frequency converter is set in the RS-485 direction

(4) the frequency converter delay response is set to (ff.03) Ms

dop-a touch screen communication parameter settings should be consistent with the twin PLC COM1 port. The specific parameters need to be set through the programming software screen editor, which will take effect after being downloaded to the touch screen. After 2000, both dop-a and Twido PLC support Modbus protocol, so it can be connected through MODBUS. In the communication program of PLC, an assignment statement (for example:%mw2999:=0) should be written to open up memory space for the system control area and system status area of the dop-a touch screen, otherwise communication will not be possible. The internal bit%m0 in Twido PLC corresponds to B1 in dop-a, and the internal word%mw0 corresponds to w40001

two PLC COM1 port and com2 port can be configured with the same baud rate, data bits, verification method and other parameters, but they should be configured with different and unique addresses

3.3 development of monitoring interface

the monitoring screen of the whole system is divided into monitoring interface, operation interface and fault code query interface. The monitoring interface is shown in Figure 3, which completes the monitoring of the operating state and operating parameters of the frequency converter

Figure 3 monitoring interface

the operation interface is shown in Figure 4. It mainly completes the setting of frequency converter start, stop, acceleration and deceleration operation, fault reset and operation frequency, and connects the fault code query interface for operators to query

Figure 4 operation interface

fault code query interface mainly provides the index of common fault codes of frequency converter

4 PLC communication program development

4.1 selection of Modbus function code

two PLC and EV2000 support Modbus protocol, but there are differences in specific details. Therefore, take the function code supported by both sides to write the program. Modbus function code supported by EV2000

modbus function code supported by twin PLC

4.2 comm communication macro and graphite step-by-step programming method

comm communication macro instruction of twin PLC uses a macro instruction to represent a group of list language instructions to realize complex functions. PLC controls the frequency converter through communication, which requires a large number of functional program blocks. It is written in the form of general Modbus communication word table, and the program is lengthy and difficult to read. Using comm communication macro instruction, there is no need to write a word list for communication exchange during programming, and one macro instruction can be used (for example, c_wrnw 02). Modbus communication word table of function code 0x10 (Rewriting multiple internal words) [3]:

for example, start 5 \frequency converter to rotate forward, and the speed is set to 30.00hz (internally expressed as 3000): Modbus communication word table of function code 0x10 is compared with comm macro instructions

in order to facilitate the debugging of the program, the graphite stepping programming language of Twido PLC is used in programming. This language is a language that divides control into multiple "steps" and the conversion conditions between "steps". Each "step" is regarded as the working state of the control system. For the whole system, the working state is divided into steady state and transient state. Steady state is the state that the system can exist stably, transient state is the transition state when the system changes from one steady state to another, and transient state can be a blank state. The operation of the frequency converter is a steady state. In this state, the system reads the operating parameters and scans whether there is an input signal that converts the system to other steady states. The startup of the frequency converter is a transient state, which is the transition state of the frequency converter from standby to operation. Therefore, in GB 4806.1 (2) 016 general safety requirements, the transient (functional program block) is written in one "step" separately during programming, and the work to be completed under steady state is written in another "step". The use of perfect stepping language simplifies the logical design of the system, facilitates the debugging of the program, and lays the foundation for the expansion of the system function. Once necessary, new functions can be developed in a modular way, as shown in Figure 6

Figure 6 converter working state conversion diagram (the box is steady state, and the ellipse is transient)

4.3 PLC and converter Modbus communication program

EV2000 converter operation control word (internal address: 0x3200) and operation status words 1 and 2 (internal address: 0x3300,0x331f) The specific meaning of EV2000 is shown in Table 1: Table 1 the specific meaning of EV2000 control words and status words 1 and 2

the following is part of the communication program between twin PLC and EV2000:

Program initialization

-*- 2 variable frequency operation state, stop state, fault state

ld%m10 read various parameters in real time


and %m0

r %m0


and [%mw241=0]

[c_rdnw 0 2]


-*- 3 variable frequency starting and variable frequency speed regulation


[%mw46: =161c7]


[%mw46: =161c0]

ld 1

[%mw47: =%mw7]

ld [%mw47>0]

and [%mw47

Copyright © 2011 JIN SHI