原来modbus 传感器都是有对应的指令码的,不同功能的指令码也不一样,比如测温度和湿度的指令码也是不一样的;

硬件连接如下图

(温湿度传感器,板载SHT20)



RS232 RS485 TO ETH TCP-Modbus 测试_网络



编辑切换为居中

添加图片注释,不超过 140 字(可选)

将 RS232 RS485 TO ETH 配置为Modus TCP 模式:

RS232 RS485 TO ETH TCP-Modbus 测试_TCP_02


编辑切换为居中

添加图片注释,不超过 140 字(可选)

在串口助手发送对应的RTU Modbus功能码,返回对应的TCP Modbus 功能码

RTU Modbus

00 03 00 00 00 01 85 DB

00 03 00 01 00 01 D4 1B

00 03 00 00 00 02 85 DB

TCP Modbus

01 07 00 00 00 06 00 03 00 00 00 01

01 07 00 00 00 06 00 03 00 01 00 01

01 07 00 00 00 06 00 03 00 00

如图所示:



RS232 RS485 TO ETH TCP-Modbus 测试_TCP_03



编辑切换为居中

添加图片注释,不超过 140 字(可选)

根据传感器的指导书,将返回的数据转换为对应的温湿度数据,测试成功

RS232 RS485 TO ETH TCP-Modbus 测试_网络_04


编辑切换为居中

添加图片注释,不超过 140 字(可选)

RS232 RS485 TO ETH TCP-Modbus 测试_网络_05


编辑切换为居中

添加图片注释,不超过 140 字(可选)

  1. Open the software and set RS232/485 TO ETH to TCP Server or TCP Client mode
  2. Select Modbus TCP for Modbus TCP
  3. Click Set Save parameters


RS232 RS485 TO ETH TCP-Modbus 测试_Server_06



编辑切换为居中

添加图片注释,不超过 140 字(可选)

  1. Run Modbus Poll and Modbus Slave to query and verify the conversion from Modbus TCP to Modbus RTU
  2. Set the Modbus software as shown in the figure


RS232 RS485 TO ETH TCP-Modbus 测试_网络_07



编辑切换为居中

添加图片注释,不超过 140 字(可选)

  1. After the setting is complete, click OK to update the data of Modbus Slave, and the data of Modbus is also updated


RS232 RS485 TO ETH TCP-Modbus 测试_网络_08



编辑切换为居中

添加图片注释,不超过 140 字(可选)

Refer to the user manual of RS232 RS485 TO ETH to configure it to Modbus mode

Configure RS232 RS485 TO ETH to TCP Modbus mode



RS232 RS485 TO ETH TCP-Modbus 测试_TCP_09



编辑切换为居中

添加图片注释,不超过 140 字(可选)

Take ​​RTU Relay​​ Take an example to illustrate the practical application

Connect RS232 RS485 and ​​Modbus RTU Relay​​ via RS485

RS232 RS485 TO ETH TCP-Modbus 测试_TCP_10


编辑切换为居中

添加图片注释,不超过 140 字(可选)

For detailed control instructions, please see the modbus tutorial:

​Modbus RTU Relay - Waveshare Wiki​