LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert a large number to hex without truncating to 32-bit.

Solved!
Go to solution

 I am trying to convert a very large number to hexadecimal (string). The number gets truncated to 32-bit, which is not what I want. For example, the number 28037546508295 (double) should be 0x198000000007. Labview truncates it and the resulting string is 0x7FFFFFFF, using Number To Hex String.vi. I am stuck. Thanks.

0 Kudos
Message 1 of 9
(3,842 Views)
Solution
Accepted by topic author habsfan

"Number to Hexadecimal String" accepts only I32 data. So you should see a red coercion dot when connecting your floating point number.

You have to use "Format Value" (also in the String >> String/Number Coercion-palette) and use "%x" as format string.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 9
(3,837 Views)

Did you try

 

"To Unsigned Quad Integer"

 

Omar
0 Kudos
Message 3 of 9
(3,835 Views)

 I should clarify a bit. The Format Into String.vi works in Labview 10. I have a need to use Labview 7. I cannot get it to work using Format Into String.vi. Thanks for the help.

0 Kudos
Message 4 of 9
(3,824 Views)

Here is a LV9 Snippet of a method that should be LV7 friendly.

 

LV7HexString.png

Message 5 of 9
(3,801 Views)
You can split your dbl into two 32bit integers using quotient&remainder (divide by 2^32 followed by "toU32"). Now format each with %032x and concatenate the strings. Remove leading zeroes if needed. (Sorry, posting via phone. I can show an example later)
0 Kudos
Message 6 of 9
(3,799 Views)

  An example would be great. Thanks.

0 Kudos
Message 7 of 9
(3,769 Views)

  I don't believe Labview 7 uses the $ format character. Thanks.

0 Kudos
Message 8 of 9
(3,764 Views)

 


@habsfan wrote:

  I don't believe Labview 7 uses the $ format character. Thanks.


 

Mostly a way to pull off a few tricks and avoid crossing wires.  Here is a $-free version, I changed the constant to 2^32, I had the original code for working with 48-bit numbers should have looked more closely.

 

LV7HexString_fixed.png

0 Kudos
Message 9 of 9
(3,758 Views)