LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert modbus holding register into float

Solved!
Go to solution

Hi,
I have been trying to convert data from a modbus register but still could not do it. I have tried the cast function it did not work.

Does someone has experience with these conversion?

 

Thanks

0 Kudos
Message 1 of 5
(416 Views)

Hi,

Have you tried reading 4 registers ?

As DBL is 64 bits long, it require 4 uint16.

0 Kudos
Message 2 of 5
(412 Views)

I have just tried the 4 registers and it did not work.
In the attached picture, the value in green is the real value in the device. The value in " *(type *) & " is what comes from the type cast.

0 Kudos
Message 3 of 5
(402 Views)
Solution
Accepted by henk1000

Hi Henk,

 

most (all?) Modbus implementations I worked with so far use the IEEE-SGL format for "floats", so you should convert 2 U16 values into a SGL value in LabVIEW…

 

Edit:

Thanks for posting actual values:

Do you expect a value of 60 for the Modbus register reading?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(400 Views)

Hi GerdW,

 

Thank you very much for taking your time to help me. It works.

0 Kudos
Message 5 of 5
(359 Views)