使用 Modbus RTU 协议提取寄存器

Extract registers using Modbus RTU protocol

我是 Modbus 协议的新手。我有一个媒体转换器设备 (USR-W610),我正在测试与 Modbus Poll 和 Modscan 程序的连接以验证我正在获取日志。我的设备上有这些设置。

使用 TCP 协议和端口 502

根据这些配置,我在Modscan中配置如下字段

我配置设备 ID = 240 和 select“03.HOLDING REGISTER”来读取数据,但是我仍然收到以下消息“未初始化”和后来的“收到对 MODBUS 查询的无效响应”可以谁来帮帮我?有什么想法吗?

同样使用“Modbus 轮询”我收到以下消息:

我假设您有一个 Modbus RTU 设备通过 RS232 或 RS485 连接到 USR IOT 单元(您没有在问题中提及该设备)。从您的屏幕截图来看,USR-W610 在透明 mod 中是 运行(“数据传输 mode”);来自 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.

所以在这个mode中你通过网络端口发送的任何东西都会被发送到串行端口,反之亦然(没有改变)。这意味着您需要使用 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,但一些实用程序支持此 mode,您可以编写自己的代码)。

不过还有一个更简单的选择;如果您将 mode 更改为“ModbusTCP<=>ModbusRTU mode”,我相信这会解决您的问题;来自手册:

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.

因此在此 mode 中,W610 充当 Modbus TCP 服务器。它接受命令,使用 Modbus RTP 将这些命令发送到设备,然后将响应转换回 Modbus TCP。