返回列表 发布新帖

如何发送 Modbus RTU 命令来读取离散输出

267 0
发表于 2024-7-10 18:16:53 | 查看全部 阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
<h3 style="margin-top:24px;margin-right:0;margin-bottom:0;margin-left:0;padding:0 0 0 0 ;line-height:30px"><strong><span style="font-family: 宋体;color: rgb(34, 34, 34);letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)"><span style="font-family:宋体">命令 0x01</span></span></strong></h3><p style="margin-top:24px;margin-right:0;margin-bottom:23px;margin-left:0;padding:0 0 0 0 ;line-height:30px"><span style="font-family: Arial;letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)"><span style="font-family:宋体">该命令用于读取</span> DO <span style="font-family:宋体">数字输出的值。</span></span></p><p style="margin-top:24px;margin-right:0;margin-bottom:23px;margin-left:0;padding:0 0 0 0 ;line-height:30px"><span style="font-family: Arial;letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)">PDU <span style="font-family:宋体">请求指定第一个 </span><span style="font-family:Arial">DO </span><span style="font-family:宋体">寄存器的起始地址和后续所需 </span><span style="font-family:Arial">DO </span><span style="font-family:宋体">值的数量。在 </span><span style="font-family:Arial">PDU </span><span style="font-family:宋体">中,</span><span style="font-family:Arial">DO </span><span style="font-family:宋体">值从零开始寻址。</span></span></p><p style="margin-top:24px;margin-right:0;margin-bottom:23px;margin-left:0;padding:0 0 0 0 ;line-height:30px"><span style="font-family: Arial;letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)"><span style="font-family:宋体">响应中的</span> DO <span style="font-family:宋体">值以一个字节为单位,并对应于位的值。</span></span></p><p style="margin-top:24px;margin-right:0;margin-bottom:23px;margin-left:0;padding:0 0 0 0 ;line-height:30px"><span style="font-family: Arial;letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)"><span style="font-family:宋体">位值定义为</span> 1 = ON <span style="font-family:宋体">和 </span><span style="font-family:Arial">0 = OFF</span><span style="font-family:宋体">。</span></span></p><p style="margin-top:24px;margin-right:0;margin-bottom:23px;margin-left:0;padding:0 0 0 0 ;line-height:30px"><span style="font-family: Arial;letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)"><span style="font-family:宋体">第一个数据字节的低位包含请求中指定地址的</span> DO <span style="font-family:宋体">值。</span><span style="font-family:Arial">DO </span><span style="font-family:宋体">的其余值跟随递增值到字节的最高值。那些。从右到左。</span></span></p><p style="margin-top:24px;margin-right:0;margin-bottom:23px;margin-left:0;padding:0 0 0 0 ;line-height:30px"><span style="font-family: Arial;letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)"><span style="font-family:宋体">如果请求的</span> DO <span style="font-family:宋体">值少于 </span><span style="font-family:Arial">8 </span><span style="font-family:宋体">个,则响应中的剩余位将用零填充(从低字节到高字节的方向)。字节数 字节数</span></span><strong><span style="font-family: Arial;letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)"><span style="font-family:宋体">进一步</span></span></strong><span style="font-family: Arial;letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)"><span style="font-family:宋体">表示响应中数据的完整字节数。</span></span></p><p style="margin-top:24px;margin-right:0;margin-bottom:23px;margin-left:0;padding:0 0 0 0 ;line-height:30px"><span style="font-family: Arial;letter-spacing: 0;font-size: 18px;background: rgb(255, 255, 255)"><span style="font-family:宋体">从</span> 20 <span style="font-family:宋体">到 </span><span style="font-family:Arial">56 </span><span style="font-family:宋体">查询设备的 </span><span style="font-family:Arial">SlaveID </span><span style="font-family:宋体">地址 </span><span style="font-family:Arial">17 </span><span style="font-family:宋体">的示例。第一个寄存器的地址将是 </span><span style="font-family:Arial">0013 hex = 19</span><span style="font-family:宋体">,因为该帐户是从 </span><span style="font-family:Arial">0 </span><span style="font-family:宋体">地址维护的(</span><span style="font-family:Arial">0014 hex = 20</span><span style="font-family:宋体">,</span><span style="font-family:Arial">-1 </span><span style="font-family:宋体">零偏移 </span><span style="font-family:Arial">= </span><span style="font-family:宋体">我们得到</span><span style="font-family:Arial">0013 </span><span style="font-family:宋体">十六进制 </span><span style="font-family:Arial">= 19)</span><span style="font-family:宋体">。</span></span></p><p><br/></p>

回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright © 2001-2024 英威腾技术论坛 版权所有 All Rights Reserved. 粤ICP备07504406号
关灯 在本版发帖
扫一扫添加微信客服
返回顶部
快速回复 返回顶部 返回列表