Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

采集AB CIP一组数据,调用API进行解析时,布尔类型数据解析异常 #35

Open
sjdGitHub opened this issue Dec 15, 2022 · 1 comment

Comments

@sjdGitHub
Copy link

以下图中程序使用java程序编写,操作如下:
先在plc中准备有一组数据,地址分别有"B[0].A","B[0].B", "B[0].C","B[0].D","B[0].E", "ZZ.B",以B打头的都是布尔类型,ZZ.B是plc中的int类型数值为66,"B[0].A","B[0].B"这两个布尔量为true,其他为false;如下图编写程序批量进行读取,会发现布尔类型读到的全为true,但是感觉返回的byte数据中的数据也并没有什么问题,第二张图中我把false的布尔量点位放到了第一个位置,这里相当于调换了一下位置,发现解析出来的布尔量又全部变成了false。
L~ }$SV 9`U_2WYH }JE0Z1
点位调换顺序:
_M$ZHMHDWZEVK5(7F404SWC

@dathlin
Copy link
Owner

dathlin commented Dec 29, 2022

在这里的 TransBool 的API 方法里,index 的偏移单位是 bit
所以,你这里需要写 0, 8, 16, 24, 32 而不是 0, 1, 2, 3, 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants