06-10-2014 05:51 AM
Hello,
i am using the modbus-protocol to read an analog-value from a module.
The webpanel of the module displays the hex-value and the float-value. The modbus-function only returns the hex-value.
09FD is 0.780
How can i convert the returned hex-value in float?
There is also a modbus-funtion for this:
public static float GetSingle(ushort highOrderValue, ushort lowOrderValue)
But i tried all kinds of using it without luck. (It works, but it does not return the correct value)
Thanks for help
Solved! Go to Solution.
06-10-2014 07:09 AM
Part of the manual of your device should state how to convert the sent value into your decimal value.
Just a pure guess, but I would say that you likely just need to multiply by 0.0003 or something close to that.
06-10-2014 07:28 AM
Modbus devices tend to have use one of two methods to represent real numbers:
06-10-2014 07:45 AM
I only have one register (see attachment).
But my 4 digit hex-value can be also 32bits. I tried all kind of kombinations but non of then created the float-values
06-10-2014 07:53 AM
What device are you using? There has to be something in the manual about how to do the conversion.
06-10-2014 07:58 AM
It is called ET-7017 from icp-das.
06-10-2014 09:19 AM
OnlyOne,
What range is this AI set for? +/-10V ?
06-10-2014 09:24 AM
yes,
in 10V-range i get 09FD = 0.78
in 5V-range i get 13FB = 0.78
in 1V-range i get 63EA = 0.78
06-10-2014 09:37 AM - edited 06-10-2014 09:37 AM
OnlyOne,
Here a are a couple of ways to convert/scale output when range is +/-10V.
06-10-2014 10:14 AM
Perfect. Works.
Thx a lot