当前位置:网站首页>【网络通信三】研华网关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属性信息,可以是如下所示的设置。
边栏推荐
- LeetCode_733_图像渲染
- 2.索引及调优篇【mysql高级】
- 在资源管理类中提供对原始资源的访问——条款15
- Flutter 获取状态栏statusbar的高度
- The new BMW 3 Series is on the market, with safety and comfort
- MySQL常用语句整理
- Vb how to connect mysql_vb how to connect to the database collection "advice"
- 复杂高维医学数据挖掘与疾病风险分类研究
- 字符指针赋值[通俗易懂]
- i.MX6ULL driver development | 33 - NXP original network device driver reading (LAN8720 PHY)
猜你喜欢
The new BMW 3 Series is on the market, with safety and comfort
mysql black window ~ build database and build table
tooltips使用教程(鼠标悬停时显示提示)
C language - function
基于C语言的编译器设计与实现
C程序是如何跑起来的01 —— 普通可执行文件的构成
The 2nd China PWA Developer Day
2022年必读的12本机器学习书籍推荐
i.MX6ULL驱动开发 | 33 - NXP原厂网络设备驱动浅读(LAN8720 PHY)
[Meetup Preview] OpenMLDB+OneFlow: Link feature engineering to model training to accelerate machine learning model development
随机推荐
华为顶级工程师历时9年总结的“趣谈网络协议”PDF文档,太强了
update data table update
智能垃圾桶(九)——震动传感器(树莓派pico实现)
GP 6总体架构学习笔记
type of timer
GP 6 overall architecture study notes
第二届中国PWA开发者日
How C programs run 01 - the composition of ordinary executable files
Implementing DDD based on ABP
多主复制的适用场景(1)-多IDC
在资源管理类中提供对原始资源的访问——条款15
Applicable scenario of multi-master replication (2) - client and collaborative editing that require offline operation
字符指针赋值[通俗易懂]
After the form is submitted, the page does not jump [easy to understand]
【pytorch】pytorch 自动求导、 Tensor 与 Autograd
网站漏洞修复服务商关于越权漏洞分析
After Grafana is installed, the web opens and reports an error
How does automated testing create business value?
C语言”三子棋“升级版(模式选择+AI下棋)
单细胞测序流程(单细胞rna测序)