ZHC1921 developed by Zongheng Intelligent Control is a device that supports modbus rtu to tcp protocol and supports mutual conversion.
The network type of this product is Ethernet. If customers need other network type equipment to support this function, it can be customized!
Product function introduction:
√ 4 relay outputs
√ 6 DI (dry/wet node) inputs
√ 2 channels of PI (pulse) counting
√ 4 analog (current) inputs
√ TCP_Client/ MQTT_Client/ TCP_Server
√ Modbus RTU/TCP
√ Host and slave modes, the host mode supports RS485 cascading of multiple devices
√Cloud forwarding, cloud networking
√Local logic, inter-device logic
√Network registration package, heartbeat package
√Hardware watchdog
√Remote configuration, remote upgrade
√Host computer, web page
√Data triggering and regular reporting
Introduction to MODBUS communication protocol
MODBUS communication protocol is the most widely used bus protocol in industrial fields. The MODBUS communication protocol adopts the master-slave communication mode (ie Master/Slave communication mode). The MODBUS communication protocol has multiple types and supports multiple versions of serial ports (mainly RS-485 bus) and Ethernet. The most commonly used one is MODBUS. There are three types: RTU, MODBUS ASCII and MODBUS TCP. MODBUS RTU and MODBUS ASCII are both communication protocols that support the RS-485 bus. MODBUSRTU uses binary representation and compact data structure, which has high communication efficiency and is widely used. The MODBUS ASCII transmission efficiency is far lower than the MODBUS RTU protocol, and the MODBUS RTU protocol is generally used in industrial sites.
The MODBUS TCP protocol adds an MBAP header to the MODBUS RTU protocol. Since TCP is a service based on reliable connections, there is no CRC check code in the MODBUS TCP protocol. The MBAP header is seven bytes in length, except for the first Except for five or six bytes, the rest are basically unchanged. MODBUS TCP enables the MODBUS_RTU protocol to run on Ethernet. MODBUS TCP communication messages are encapsulated in Ethernet TCP/IP data packets. Unlike the traditional serial port method, MODBUS TCP inserts a standard MODBUS message into the TCP message and no longer carries a data checksum address. When converting protocols between MODBUS TCP and MODBUS RTU, the gateway converts the address code in the RTU protocol. In the TCP protocol, the unit flag data corresponds to the address code in the RTU protocol, as shown in Table 1 and Table 2 below.
The meaning of the instruction in Table 1: Start reading (03) four (00 04) registers from the module 0x18E (01 8E) register address with the address code 01 (TCP protocol unit flag is 00).
The meaning of the instruction in Table 2: Start writing (10) a (00 01) register from the module 0x18E (01 8E) register address with the address code 01 (TCP protocol unit flag is 00). The specific data length is 2 bytes (02 ), the data text content is 00 00 (00 00)
Implementation of MODBUS RTU and TCP conversion
The ASCII and RTU protocols of MODBUS stipulate the structure of messages and data, commands and response methods. Data communication adopts the master-slave communication mode (Master/Slave communication mode). The MODBUS RTU communication protocol uses the MODBUS protocol that needs to verify data. In addition to parity check, the serial protocol uses LRC check in ASCII mode, 16-bit CRC check in RTU mode, and MODBUSTCP communication mode. There is no master station. , slave stations are divided into server (Server) and client (Client). The party that sends the data request is the client, and the party that makes the data response is the server.
The server (Server) and the client (Client) are similar to the functions of MODBUSRTU slave station and master station respectively, but there is no relationship between MODBUS RTU and MODBUSTCP. The server opens port 502 to listen, and the protocol is in the receiving state. The client is the IP port connected to the server. After connecting, it actively sends query messages.
The ABB 800xA system serves as the MODBUS RTU master station and transmits data to the MS-CPU32 (MODBUS RTU to TCP gateway) slave station through the CI853 card. Figure 2 ABB system side structure diagram. Set the RTU communication baud rate, check digit, etc. in MS-CPU32 and set IP, gateway, DNS, server/client, etc. in MODBUS TCP. This remote transmission requires MS-CPU to be set to MODBUS TCP and set to server.
Keywords: Serial to Ethernet converter