laitimes

Serial server - storage gateway and configurable gateway introduction and how to use

author:Yibaite Internet of Things application

As mentioned above, compared with simple protocol conversion, the multi-host gateway mode has a separate data processing for the scenario of sending data to multiple hosts at the same time. 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 order, and the serial port device will return the data to the host after receiving the data, and which host will specify which host to send the data to which host, so that the abnormal phenomenon of communication can be avoided and the reliability of communication can be improved.

However, the read on the host side will still be limited by the communication rate of the serial port (because the network rate is much higher than the serial port rate), so when multiple hosts read at the same time, although it will not cause data conflicts, when multiple hosts read quickly at the same time, it will still wait until the serial port is queued for processing.

The previous article shows the way:

"Serial Server - Introduction and Use of Multi-Host Gateway"

Serial Server - Introduction and Use of Simple Protocol Conversion

Storage-oriented gateways

In this section, we will first introduce a high-speed solution for multiple hosts to read the same register or coil data—a storage gateway. Storage-oriented gateways are particularly suitable for reading fixed register contents and for multi-host high-speed data refresh scenarios.

In principle, the storage gateway is to open a separate data staging area inside the serial port server to store the content read by the previous host, such as during the instruction storage time, the rest of the hosts read the data again, in order to reduce the delay, the serial port server will directly take out the data in the storage interval and reply to the second querying host. In addition, after the host queries the data at any time, if the serial port server does not read the rest of the host content (the serial port bus is idle), it will automatically poll the historical query instructions according to the reading order. A maximum of 50 historical query commands can be stored.

The advantage is that when the host reads any instruction, the serial port server will query the historical polling instruction at regular intervals according to the polling interval, and update the data to ensure that the instruction content of subsequent queries is up-to-date. When the historical access instruction is not read by the host for a long time, and the storage time exceeds the instruction storage time, the instruction will be automatically cleared to avoid wasting storage resources.

Serial server - storage gateway and configurable gateway introduction and how to use

The storage gateway is used in the same way as the multi-host gateway, and only the Modbus Pool and Modbus Slave are used here for display, and the PLC/HMI is connected to the link with reference.

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

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

Serial server - storage gateway and configurable gateway introduction and how to use
Serial server - storage gateway and configurable gateway introduction and how to use

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)

Serial server - storage gateway and configurable gateway introduction and how to use

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 - storage gateway and configurable gateway introduction and how to use

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 - storage gateway and configurable gateway introduction and how to use

Configurable gateways

The advantage of the storage gateway is that the instruction to be queried can be pre-configured to the serial port server, and after the serial port server is powered on, it will be actively read in accordance with the instruction order, and the data return content will be stored in the internal space after completion, as long as the host reads the instruction within the instruction storage time, the serial port server will immediately return the data.

When configured, you only need to configure the instruction to be queried, no need to enter the ModBus CRC verification, the device will automatically verify, enter the instruction in the input box, click Add, then the device will verify whether the current input is a standard instruction, if it does not meet the format, it will not be added, as shown in the following figure:

Serial server - storage gateway and configurable gateway introduction and how to use

After the device is restarted, it will start to query the data according to the polling interval, if the instruction timeout time expires and the correct data is not returned, the instruction will be automatically skipped, and the next instruction will be queried. A maximum of 50 commands can be configured, and if you need to add redundant commands, you need to delete the previous configuration instructions.

If no host reads the data, the serial port server will also query the historical polling instructions at regular intervals and update the data to ensure that the instructions for subsequent queries are up to date.

Serial server - storage gateway and configurable gateway introduction and how to use

In this department, Modbus Pool and Modbus Slave are used to display the query command effect, and PLC/HMI refers to this for link connection.

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

Serial server - storage gateway and configurable gateway introduction and how to use

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)

Serial server - storage gateway and configurable gateway introduction and how to use

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 - storage gateway and configurable gateway introduction and how to use

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 - storage gateway and configurable gateway introduction and how to use

Serial Server_Data Transmission Radio_4G DTU_ Remote Control Switch_LoRa/ZigBee/WiFi/Bluetooth Module-Chengdu Yibaite Electronic Technology Co., Ltd

Read on