LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

User Input to Hex String

Solved!
Go to solution

Hi,

 

This is a basic question without a doubt but it is giving me an inordinate amount of trouble. I want to capture a user input floating point double via a Numeric Control (Azimuth & Elevation), take that double and pass it to the Number to Hexidecimal String Function specifying a width of 16. These strings are then concatenated together, along with a hexidecimal command string (0005 0000) and sent on their merry way as a UDP packet. If I just use string constants displayed as hexidecimal everything works great. When I attempt to use the code below, if I input 0.0, I would expect a hexidecimal string of 16 zeros. Instread I get a recurring pattern of 30, (i.e., 3030 3030 ...) the ASCII for 0 in hexidecimal.

Any assitance would be greatly appreciated.

 

Thanks,

Bill

decimal to hex string.png

0 Kudos
Message 1 of 4
(2,790 Views)

Hi optiplex,

 

- ToHexadecimalString only takes integer numbers, it rounds DBL values...

- What kind of string do you expect for a DBL value of 4.15625 (as an example)?

- TypeCast to string would be an option too...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,787 Views)
Solution
Accepted by optiplex

Simply typecast the numbers to a string. You want the actual binary values in a string fomat, not the ASCII values.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 4
(2,786 Views)

Thanks! Works greatSmiley Happy

0 Kudos
Message 4 of 4
(2,775 Views)