当前位置:网站首页>【网络通信三】研华网关Modbus服务设置
【网络通信三】研华网关Modbus服务设置
2022-07-31 16:27:00 【慷仔】
研华网关Modbus服务设置
1、前言
最近在使用研华网关进行Modbus的通信试验,试图跟之前研究的Modbus通信库进行相互通信。
企图互通两者的通信,熟悉Advantech EdgeLink Studio的使用等目的。
关键字如下所示:
- Advantech EdgeLink Studio
- Modbus Tcp
- Socket 阻塞和非阻塞
- IPv4和IPv6区别
使用到的相关软件和工具: - Advanced IP Scanner
- Modbus Poll
- Advantech EdgeLink Studio
2、Advantech EdgeLink Studio使用流程
2.1、总体使用流程
2.2、重要流程截图



3、试验流程
3.1、使用Modbus Poll进行连接



3.2、libmodbus自写程序连接研华网关的流程
# 复制克隆该项目,运行脚本生成modbus_poll工具
# clear all exec
if [ ! -d "./bin" ]; then
mkdir bin
else
cd bin
rm -rf ./*
cd ..
fi
if [ ! -d "./build" ]; then
mkdir build
fi
cd build
# build client
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Release -DClient=ON ..
make
cd release
cp modbus_poll ../../bin
cd ../../
# 使用工具进行modbus通信
if [ -f bin/modbus_poll ]; then
cd bin/
# ./modbus_poll --debug -mtcp -t0x01 -r2 -p502 10.0.1.28
./modbus_poll --debug -mtcp -t0x03 -r1 -p502 10.0.1.59 -c4
cd ../
else
echo "不存在相应的modbus_poll工具"
fi
3.3、自写程序的通信试验结果
Connecting to 10.0.1.59:502
[00][01][00][00][00][06][01][03][00][01][00][04]
Waiting for a confirmation...
<00><01><00><00><00><0B><01><03><08><00><D6><00><33><00><42><00><00>
SUCCESS: read 4 of elements:
Data: 0x00d6 0x0033 0x0042 0x0000
结果说明:
- "./modbus_poll --debug -mtcp -t0x03 -r1 -p502 10.0.1.59 -c4"命令表示从modbus的1地址开始,读取4个寄存器值,同时显示出来。其中研华网关的ip是10.0.1.59,modbus端口号为502。
- 这些结果和在Modbus Poll工具中显示的是一致的,说明通信成功无误。
4、遇到的问题及解决方法
4.1、问题1
- 现象:自写程序modbus_poll无法与研华网关connect成功,显示"Connect time out"的报错;但是Modbus Poll工具却可以进行通信。
- 原因:没有在研华网关的"系统设置/网络和Internet/网络设置"中设置好相应的IPv4属性
- 解决方法:设置好相应的IPv4属性信息,可以是如下所示的设置。

边栏推荐
- Stuck in sill idealTree buildDeps during npm installation, npm installation is slow, npm installation is stuck in one place
- 全新宝马3系上市,安全、舒适一个不落
- MySQL常用语句整理
- LevelSequence源码分析
- Delete the disk in good condition (recovery partition)
- ansible学习笔记02
- Applicable Scenarios of Multi-Master Replication (1) - Multi-IDC
- 复制延迟案例(3)-单调读
- 单细胞测序流程(单细胞rna测序)
- [TypeScript] In-depth study of TypeScript type operations
猜你喜欢

The new BMW 3 Series is on the market, with safety and comfort

【7.29】Code Source - 【Arrangement】【Stone Game II】【Cow and Snacks】【Minimum Number of Spawns】【Sequence】

华为顶级工程师历时9年总结的“趣谈网络协议”PDF文档,太强了

How C programs run 01 - the composition of ordinary executable files

阿里三面:MQ 消息丢失、重复、积压问题,如何解决?

上传图片-微信小程序(那些年的坑记录2022.4)

"Autumn Recruitment Series" MySQL Interview Core 25 Questions (with answers)

智能垃圾桶(八)——红外对管传感器(树莓派pico)

The 2nd China PWA Developer Day

Implementing DDD based on ABP
随机推荐
多主复制的适用场景(2)-需离线操作的客户端和协作编辑
Replication Latency Case (3) - Monotonic Read
入职一个月反思
C语言”三子棋“升级版(模式选择+AI下棋)
C language - function
Website vulnerability repair service provider's analysis of unauthorized vulnerability
研发过程中的文档管理与工具
Mariabackup实现Mariadb 10.3的增量数据备份
ML.NET related resources
第05章 存储引擎【1.MySQL架构篇】【MySQL高级】
复制延迟案例(3)-单调读
动态规划(一)
动态规划之线性dp(下)
Tencent Cloud Deployment----DevOps
Vb how to connect mysql_vb how to connect to the database collection "advice"
2020微信小程序反编译教程(小程序反编译源码能用吗)
牛客 HJ19 简单错误记录
arm按键控制led灯闪烁(嵌入式按键实验报告)
SringMVC中个常见的几个问题
全新宝马3系上市,安全、舒适一个不落