Qt Modbus
Modbus 是一种请求/响应协议,其网络中包含一个 Modbus 客户端,并可能包含多个 Modbus 服务器。服务器只能控制自身的内部状态,而客户端可以读取和写入这些状态中的数据。
每个 Modbus 服务器都有四个表,用于存储数据。
| 名称 | 单个字段中的数据范围 | 客户端权限 |
|---|---|---|
| 离散输入 | 0-1 | 读取 |
| 线圈 | 0-1 | 读/写 |
| 输入寄存器 | 0-65535 (0xffff) | 读取 |
| 保持寄存器 | 0-65535 (0xffff) | 读/写 |
Modbus API 提供了一些用于访问 Modbus 设备的通用 API:
- QModbusDevice 提供了一个用于客户端和服务器常见功能的 API。
- QModbusClient 提供用于直接访问 Modbus 客户端的 API。
- QModbusServer 提供用于直接访问 Modbus 服务器的 API。
- QModbusDataUnit 表示一个数据值。
- QModbusReply 由 `QModbusClient ` 创建,作为读写操作的句柄。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.