简体   繁体   中英

Communicating via Modbus RTU over TCP/IP Protocol

I'm trying to establish a connection with a device on my.network and have 2 Modbus Protocol related questions:

  1. Is the protocol used by this controller "Modbus RTU over TCP" or "Modbus TCP"?

Here is the device manufacturer's description describing the connection:

"To read and write data, port 10001 is used as a TCP/IP tunnel. This means the MODBus protocol is tunneled in RAW binaries through the XPort device. Only the MODBus telegram is sent to the controller."

  1. Depending on the protocol, how should the client request to read/write be formulated?

Assuming it's Modbus TCP I have written a simple code in Python to read a register by sending a Modbus request formated as shown bellow, I received no meaningful data.

MODBUS TCP/IP

Modbus RTU and Modbus TCP are two different protocols, the difference is not only the added CRC bytes.

The byte sequence is different, Modbus TCP include a transaction identifier, which allows sending several requests before receiving each response, if the connected slaves allow it.

Modbus RTU over TCP is not a standard protocol, I have never seen a device that uses such protocol.

If you want to connect to a Modbus RTU slave from a Modus TCP master you need a gateway converter between both protocols, there are many different ones on the market.

Your description of the protocol suggests that there is a distinct xPort TCP to serial converter in the communication path. This is further reinforced by the nonstandard port 10001 (MODBUS is usually TCP 502) common to converters of this type. In this case, the underlying MODBUS device will only be aware of the serial layer.

The communication should be MODBUS RTU across the TCP socket. The converter will then strip out the RTU message from the stream for the device.

Note the PDU formats are different between the two encapsulations. Silence is a typical response as the messages are never successfully parsed and so discarded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM