mirror of
https://github.com/ThingsGateway/ThingsGateway.git
synced 2026-10-24 17:30:25 +08:00
103 lines
3.5 KiB
Plaintext
103 lines
3.5 KiB
Plaintext
---
|
||
id: pluginmodbus
|
||
title: Modbus采集插件
|
||
---
|
||
|
||
## 一、设备扩展属性
|
||
|
||
### 1、ModbusTcp/Rtu/Udp/RtuOverTcp/RtuOverUdp
|
||
<img src={require('../static/img/docs/pluginmodbus-1.png').default} width="300" />
|
||
<img src={require('../static/img/docs/pluginmodbus-2.png').default} width="300" />
|
||
<img src={require('../static/img/docs/pluginmodbus-3.png').default} width="300" />
|
||
<img src={require('../static/img/docs/pluginmodbus-4.png').default} width="300" />
|
||
<img src={require('../static/img/docs/pluginmodbus-5.png').default} width="300" />
|
||
|
||
| 属性 | 说明 | 默认值/备注|
|
||
| ---------------| --------------------------| ---|
|
||
| IP | 连接IP | 127.0.0.1|
|
||
| 端口 | 连接端口 | 502|
|
||
| 默认站号 | 默认的mudbus站号id | 1|
|
||
| 读写超时时间 | 读取等待中的超时时间(ms) | 3000|
|
||
| 连接超时时间 | 建立socket通讯的超时时间(ms) | 3000|
|
||
| 帧前时间 | 在发送请求前的延时时间(s) | 0|
|
||
| 组包缓存超时 | 包返回间隔的超时时间(s) | 1 |
|
||
| 默认解析顺序 | 4个字节以上的数据解析,可设置为ABCD/BADC/CDBA/DCBA,默认ABCD |ABCD:Big-Endian<br></br>BADC:Big-Endian Byte Swap<br></br>CDAB:Little-Endian Byte Swap<br></br>DCBA:Little-Endian |
|
||
| 最大打包长度 | 打包长度,最大限值是125 | 100 |
|
||
| 连接id检测 | 是否检查modbus的事务标识符和协议标识符为一致 | Flase |
|
||
| 共享链路 | 设为true后,同目标IP端口的设备将共用一个TcpClient | Flase |
|
||
| COM口 | COM口 | COM1|
|
||
| 波特率 | | 9600|
|
||
| 数据位 | | 8|
|
||
| 校验位 | | None|
|
||
| 停止位 | | One|
|
||
| crc检测 | 是否检查Crc16 | True|
|
||
|
||
|
||
## 二、变量配置
|
||
|
||
:::tip `说明`
|
||
|
||
通用格式
|
||
|
||
4字节转换格式
|
||
|
||
DATA=ABCD;
|
||
|
||
举例:
|
||
|
||
DATA=ABCD; ,代表大端格式,其中
|
||
|
||
ABCD=>Big-Endian;
|
||
|
||
BADC=>Big-Endian Byte Swap;
|
||
|
||
CDAB=>Little-Endian Byte Swap;
|
||
|
||
DCBA=>Little-Endian
|
||
|
||
字符串长度:
|
||
|
||
LEN=1;
|
||
|
||
BCD格式:
|
||
|
||
BCD=C8421;,其中有C8421;C5421;C2421;C3;Gray
|
||
|
||
字符格式:
|
||
|
||
TEXT=UTF8;,其中有UTF8;ASCII;Default;Unicode
|
||
|
||
:::
|
||
|
||
### 变量地址说明
|
||
|
||
- 1、基本地址
|
||
|
||
| 地址 | 功能码 | 说明 |
|
||
| ---------------| --------------|--------------------------|
|
||
| 4xxxxx | 03 | 读取03功能码 |
|
||
| 3xxxxx | 04 | 读取04功能码 |
|
||
| 1xxxxx | 02 | 读取02功能码 |
|
||
| 0xxxxx | 01 | 读取01功能码 |
|
||
|
||
- 2、站号(可选)
|
||
|
||
当需要指定站号地址时可使用,举例:
|
||
|
||
| 地址 | 说明 |
|
||
| ---------------| --------------------------|
|
||
| s=2;10001 | 读取02功能码 ,设备地址为2 |
|
||
| s=11;40001 | 读取03功能码 ,设备地址为11 |
|
||
|
||
- 3、写入功能码(可选)
|
||
|
||
当需要指定16/15功能码时可使用,举例:
|
||
|
||
| 地址 | 说明 |
|
||
| ---------------| --------------------------|
|
||
| w=15;10001 | 读取02功能码 ,写入15功能码 |
|
||
| w=16;40001 | 读取03功能码 ,写入16功能码 |
|
||
|
||
### 变量特殊方法说明
|
||
|
||
无特殊方法 |