ModBus协议-功能码-0x03



03 (0x03) Read Holding Registers
This function code is used to read the contents of a contiguous block of holding registers in a remote device. The Request PDU specifies the starting register address and the number of registers. In the PDU Registers are addressed starting at zero. Therefore registers numbered 1-16 are addressed as 0-15.
The register data in the response message are packed as two bytes per register, with the binary contents right justified within each byte. For each register, the first byte contains the high order bits and the second contains the low order bits.



The contents of register 108 are shown as the two byte values of 02 2B hex, or 555 decimal. The contents of registers 109–110 are 00 00 and 00 64 hex, or 0 and 100 decimal,respectively.



0x6B = 107
[108,110]

108 02 2B
109 00 00
110 00 64


Tx:01 03 00 6B 00 03
Rx:01 03 06 02 2B 00 00 00 64

发送分析

01 从站

03 功能码

00 6B 起始地址

00 03 读取个数

返回分析

01 从站 

03 功能码

06 读取的字节个数

02 2B 寄存器数值

00 00  寄存器数值

00 64 寄存器数值


异常返回分析

01 83 02

01 从站

83 命令吗 80+03

02 错误号 参看第0节 ModBus Exception codes

注意:当判断返回功能码83的时候同样需要做CRC校验,如果校验通过,则证明是从站返回来的错误提示码,如果不通过则可能是返回命令的时候受到了干扰,很有可能是将03干扰成了83.












  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值