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

转float类型 #14

Open
136093330 opened this issue Apr 3, 2019 · 2 comments
Open

转float类型 #14

136093330 opened this issue Apr 3, 2019 · 2 comments

Comments

@136093330
Copy link

你好,我调用的api是readInputRegisters,因为一个寄存器占用两个字节,而我要读的是浮点数,占两个寄存器,我读出来四个字节,我要怎么转换成float类型呢?因为看你的demo是short[]类型。求告知,谢谢

@alsojin0806
Copy link

这个我c# 处理过,先把转换成十六进制,在转换成float

@wohelu666
Copy link

@alsojin0806 好像modbus slave 不能设置成float类型的数据呢?你是怎么读到float带小数的数据的,modbus slave软件设置成小数没用,只能设置成整数。

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

3 participants