Conversion from Hexadecimal to Single Precision Float in LabVIEW

Updated Sep 5, 2024

Environment

Software

  • LabVIEW

I want to convert from hexadecimal to single precision float. How do I accomplish this in LabVIEW?

The steps listed below detail how to accomplish this using the Type Cast Function and Hexadecimal String To Number Function in LabVIEW:
  1. Place the Hexadecimal String To Number Function on the Block Diagram
  2. Right-click on the String input terminal of the Hexadecimal String To Number Function and select select Create»Constant. Use this string constant to input the hexadecimal string you want to convert. Note: The image below shows string 3F7851EC as the input here. However, this is just used as an example and can be replaced with the specific string you want to convert.
  3. Place the Type Cast Function on the Block Diagram
  4. Wire the number output terminal of the Hexadecimal String To Number Function to the x input terminal of the Type Cast Function. 
  5. Place a DBL Numeric Constant on the Block Diagram and leave as 0. Right-click on the 0 DBL Numeric Constant and select Representation»SGL.
  6. Wire SGL Numeric Constant to the type input terminal of the Type Cast Function.
  7. Right-click on the *(type*)&x output terminal of the Type Cast Function and select Create»Indicator. This indicator will show the single precision representation of the input hex string on the Front Panel.
  8. An example of the end result using these steps is shown below: