使用Modbus RTU协议提取寄存器 [英] Extract registers using Modbus RTU protocol

查看:558
本文介绍了使用Modbus RTU协议提取寄存器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

使用TCP协议和端口502

Using TCP protocol and port 502

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

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

我将设备ID配置为240,然后选择"03".保持寄存器"读取数据,但仍然收到以下消息未初始化"以及随后的接收到的对MODBUS查询的无效响应".有人能帮我吗?有什么想法吗?

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?

类似地,使用"Modbus Poll"我收到以下消息:

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

推荐答案

我正在假设您有一个通过RS232或RS485连接到USR IOT单元的Modbus RTU设备(您未在问题中提及该设备) ).从您的屏幕截图中,USR-W610正在透明模式下运行(数据传输模式");从手册:

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:

在此工作模式下,W610可以在串行侧和网络侧之间建立双向连接.此连接是透明传输.来自串行设备的数据可以在网络中接收,也可以将网络数据发送到串行设备.

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.

因此,在此模式下,您通过网络端口发送的所有内容都会发送到串行端口,反之亦然(不做任何更改).这意味着您需要使用 Modbus RTU 而不是虚拟串行端口,但某些实用程序支持此模式,您可以编写自己的代码.

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).

但是有一个更简单的选择;如果您将模式更改为"ModbusTCP = ModbusRTU模式",我相信这会解决您的问题;从手册中:

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支持Modbus TCP Modbus RTU模式(不支持Modbus ASCII).用户只需要将W610工作模式配置为Modbus TCP = Modbus RTU模式,并在需要使用此模式时更改相关参数(端口,远程IP和其他一些参数)以更正设置.

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.

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

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.

这篇关于使用Modbus RTU协议提取寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆