LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Hexadecimal to IEEE float

HI

I am trying to convert a HEXADECIMAL CAN message (inputted via Valuecan USB connector)into IEEE Float format.

In the VI I can read the Hex message example: 40 89 58 1E. This equates to ~4.29 volts

If I read this using the NI CAN card the set up is:

Byte Order: Motorola
Data Type: IEEE Float
Start bite: 24
End Bits: 32.

Any ideas.

Best regards

Allan Johnstone
0 Kudos
Message 1 of 4
(4,434 Views)
Hello Allan,

just use the type cast function. Have a look at the attached example.
The string control is set to hex-view, the type is set to SGL as you supply 4-byte representation. (A DBL would need 8 bytes.)

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(4,427 Views)
Hi LabVIEW Community,
 
I will use this thread, even my problem is the inverse of the one from Allan.
 
I have to establish an communication to a ABB controller via MODBUS. I managed to get values from the controller and convert them to SGL values. But now I have to set values in the controller, which means, that I have to convert SGL to 4Byte IEEE format.
 
Any hints?
 
Thank you very much in advance.
 
 
0 Kudos
Message 3 of 4
(4,246 Views)
Hi Beri,

SGL are IEEE 4 byte format... You probably need to convert to an U32 or and array of 4 U8.

Also use typecast, wire your SGL to data input, wire the needed type to the type input and you should get your result as needed!
Best regards,
GerdW


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