Skip to content

device-modbus: Trying to read Float32 value from a 2 register combination #42

Answered by FelixTing
willborghei asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @willborghei

The number of registers read by the device-modbus service depends on valueType.
https://github.com/edgexfoundry/device-modbus-go/blob/bb2f4bd64c3941eb86d6cd8a035d25878e21dc53/internal/driver/deviceclient.go#L105-L115
For example, if valueType is float32, 2 registers will be read.

And the device-modbus service transforms the raw data according to valueType and rawType.
https://github.com/edgexfoundry/device-modbus-go/blob/bb2f4bd64c3941eb86d6cd8a035d25878e21dc53/internal/driver/deviceclient.go#L136-L149

Note that the device-modbus driver uses valueType as rawType by default. https://github.com/edgexfoundry/device-modbus-go/blob/main/internal/driver/deviceclient.go#L58

Speci…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@willborghei
Comment options

Answer selected by willborghei
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants