Extract registers using Modbus RTU protocol

我怕爱的太早我们不能终老 提交于 2021-01-29 11:30:45

问题


I am new to using the Modbus protocol. I have a media converter device (USR-W610), I am testing the connection with the Modbus Poll and Modscan programsto verify that I am getting logs. I have these settings on the device.

Using TCP protocol and port 502

According to these configurations, I configure the following fields in Modscan

I configure the Device Id = 240 and select "03. HOLDING REGISTER" to read the data, but nevertheless I get the following messages "uninitialized" and later "Received Invalid Response TO MODBUS Query" Can someone help me? Any ideas?

Similarly using "Modbus Poll" I get the following messages:


回答1:


I am working on the assumption that you have a Modbus RTU device connected to the USR IOT unit via RS232 or RS485 (you did not mention the device in your question). From your screenshot the USR-W610 is running in Transparent mod (the "Data Transfer mode"); from the manual:

In this work mode, W610 can make a bidirectional connection between serial side and network side. This connection is transparent transmission. Data from serial device can be received in network, and network data can also be sent to serial device.

So in this mode anything you send through the network port will be sent to the serial port and vice versa (no changes are made). This means that you would need to use Modbus RTU rather than Modbus TCP (the two protocols differ; for example RTU packets include CRC error-checking whereas Modbus TCP packets do not) and also set the baud rate etc somehow (probably via AT commands). Doing this is possible (generally using a virtual serial port but some utilities support this mode and you can write your own code).

However there is a simpler option; if you change the mode to "ModbusTCP<=>ModbusRTU mode" I believe this will solve your issue; from the manual:

W610 supports Modbus TCP<=>Modbus RTU mode(doesn’t support Modbus ASCII). User just needs to configure W610 work mode to Modbus TCP<=>Modbus RTU mode and change related parameters (port, remote IP and some other parameters) to correct settings when user wants to use this mode.

So in this mode the W610 acts as a Modbus TCP Server. It accepts commands, sends these on to the device using Modbus RTP and then translates the responses back to Modbus TCP.



来源:https://stackoverflow.com/questions/64390999/extract-registers-using-modbus-rtu-protocol

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!