当前位置:网站首页>【网络通信三】研华网关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属性信息,可以是如下所示的设置。
边栏推荐
- Precautions and solutions when SIGABRT error is reported
- 牛客网刷题(四)
- go图书管理系统
- Stuck in sill idealTree buildDeps during npm installation, npm installation is slow, npm installation is stuck in one place
- Implement anti-shake and throttling functions
- 多主复制下处理写冲突(4)-多主复制拓扑
- 牛客网刷题(一)
- BGP综合实验(建立对等体、路由反射器、联邦、路由宣告及聚合)
- "Autumn Recruitment Series" MySQL Interview Core 25 Questions (with answers)
- jeecg master-slave database read-write separation configuration "recommended collection"
猜你喜欢
随机推荐
长得很怪的箱图
Anaconda如何顺利安装CV2
基于Redis(SETNX)实现分布式锁,案例:解决高并发下的订单超卖,秒杀
[pytorch] pytorch automatic derivation, Tensor and Autograd
Flutter set the background color of the statusbar status bar and APP method (AppBar) internal consistent color.
Replication Latency Case (3) - Monotonic Read
mongo enters error
Applicable Scenarios of Multi-Master Replication (1) - Multi-IDC
牛客 HJ18 识别有效的IP地址和掩码并进行分类统计
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none 失败
ML.NET related resources
js的toString方法
华为顶级工程师历时9年总结的“趣谈网络协议”PDF文档,太强了
Vb how to connect mysql_vb how to connect to the database collection "advice"
在资源管理类中提供对原始资源的访问——条款15
After the form is submitted, the page does not jump [easy to understand]
复杂高维医学数据挖掘与疾病风险分类研究
MySQL database operations
单细胞测序流程(单细胞rna测序)
adb shell error error: device unauthorized