- Modbus功能码
- 标准的modbus协议组成(RTU和ASCII)
- Modbus TCP/IP协议组成
- MBAP头消息解析
- Modbus正常解析流程
- Modbus异常解析流程
- 缩写
- 错误码
- 参考资料
Modbus功能码
- 功能码,Modbus功能码有三种,第一种是公共功能码(Public Function Codes),第二种是 用户自定义功能码(User-Defined Function Codes),第三种是保留功能码(Reserved Function Codes), 每部分的定义如下
- 其中公共功能码如下:
标准的modbus协议组成(RTU和ASCII)
Modbus TCP/IP协议组成
MBAP头消息解析
Modbus正常解析流程
- The header is 7 bytes long:
- Transaction Identifier - It is used for transaction pairing, the MODBUS server copies in the response the transaction identifier of the request.
- Protocol Identifier – It is used for intra-system multiplexing. The MODBUS protocol is identified by the value 0.
- Length - The length field is a byte count of the following fields, including the Unit Identifier and data fields.
- Unit Identifier – This field is used for intra-system routing purpose. It is typically used to communicate to a MODBUS+ or a MODBUS serial line slave through a gateway between an Ethernet TCP-IP network and a MODBUS serial line. This field is set by the MODBUS Client in the request and must be returned with the same value in the response by the server.
- All MODBUS/TCP ADU are sent via TCP to registered port 502.
Remark : the different fields are encoded in Big-endian.
Modbus异常解析流程
缩写
错误码
参考资料
Modbus官方文档:《Modbus_Application_Protocol_V1_1b3》