laitimes

Serial server - introduction and use of multi-host gateway

author:Yibaite Internet of Things application

As mentioned in the previous section, the ModBus protocol is the most widely used protocol in industrial applications. In a ModBus protocol system, the host is generally a PLC, HMI, configuration software, etc., but in a slightly complex system, there are usually multiple hosts at the same time. Since the communication cable is generally RS485, the half-duplex feature leads to a large data delay when multiple hosts collect data at the same time. (Because only one master or slave can send data at the same time, otherwise it will cause data conflicts and form garbled characters)

Therefore, the host generally uses the network port to communicate, which can ensure the timeliness of the data. As mentioned earlier, the serial port server can convert the network port data into serial port data for communication, so that while ensuring full-duplex communication, the data can be connected to the Internet, which greatly improves the communication distance.

Although the network cable can achieve full duplex (sending and receiving at the same time), but for low-latency application scenarios, such one-to-one communication advantages are not very obvious, today I will talk to you about a special function - multi-host gateway mode.

The Modbus multi-host gateway supports multiple Modbus TCP hosts to operate RTU devices at the same time, and uses TCP/IP protocol communication to break the limitation that only one host can exist on the RTU data bus at the same time.

The simple protocol conversion mode is only suitable for scenarios where a single master is used to communicate with slaves, because the serial server only converts the data, and the data of the serial port is broadcast to all masters. If multiple hosts send data at the same time, the serial server will send the data directly, which will cause communication timeout or data abnormality.

Directions above: "Serial Server - Introduction and Use of Simple Protocol Conversion"

Compared with simple protocol conversion, the multi-host gateway mode does separate data processing for the scenario of sending data at the same time to multiple hosts. For example, when host 1, 2, and 3 send data for a short time, the serial port server will intercept the requested data on the network side, and the data will send instructions to the serial port device in sequence, and the serial port device will return the data to the host after receiving the data, and which host will request the data and will specify which host to send the data, so that the abnormal phenomenon of communication will be avoided and the reliability of communication will be improved.

Serial server - introduction and use of multi-host gateway

The following mainly introduces the application method of multi-host gateway, due to the different characteristics of the host-side operation, this place only uses Modbus Pool and Modbus Slave as a display, and PLC/HMI and so on refer to this for link connection.

How to configure parameters has been explained in previous articles and will not be covered separately in this section.

Use the EBYTE network configuration tool to view the parameters of the current serial port server, the IP needs to be modified to the same network segment as the computer, set the serial port server to TCP server mode, and record the current local IP and local port.

Serial server - introduction and use of multi-host gateway

Open the ModBus slave software to simulate the slave, use the serial port in connection mode, and select the serial slogan and connection parameters of the serial port server (baud rate, data bit, check bit, stop bit, here the default 115200, 8N1 is used)

Serial server - introduction and use of multi-host gateway

The data return content is selected as slave ID 1, function code is selected as 03, register address is selected as 0, and quantity is 10 (this parameter is also read later).

Open the ModBus Pool software, set the connection mode to ModBus TCP/IP, set the destination IP address to the serial server, and set the destination port to the local port of the serial server (192.168.0.113/8887).

Serial server - introduction and use of multi-host gateway

The read parameter is also selected as slave ID 1, function code as 03, register address as 0, and quantity as 10. You can connect up to 6 hosts by referring to this parameter, as shown in the following figure.

Serial server - introduction and use of multi-host gateway

Read on