广州大彩串口屏论坛_大彩开发者交流论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1699|回复: 1

请问下03H读出来为啥有问题呢

[复制链接]

25

主题

119

帖子

761

积分

高级会员

Rank: 4

积分
761
QQ
发表于 2024-7-23 18:12:17 | 显示全部楼层 |阅读模式
MobusRTU模块一共32个通道
通过 abc = mb_read_reg_03(1,0,32)读出数据输出为:
01 03 40 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D9 29
继电器只开了1和3
print(#abc)输出31
encode后print是
{"1":0,"2":1,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"0":1}
虽然可以从abc[0]访问,但是#abc结果是31,大大们这个是咋肥事呢
欢迎加入大彩爱好者QQ群:14769485
回复

使用道具 举报

0

主题

389

帖子

1124

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1124
发表于 2024-7-24 17:39:59 | 显示全部楼层
看数据两个寄存器都是100数据,应该输出不了31,你可以拿例程测试一下mb函数:
https://www.gz-dc.com/UPLOADS/FI ... US%20-%20LUAAPI.ZIP
回复

使用道具 举报

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

本版积分规则

QQ|Archiver|手机版|小黑屋|广州大彩串口屏论坛_大彩开发者交流论坛

GMT+8, 2024-11-23 16:25 , Processed in 0.045685 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表