LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

BIG ASCII string to HEX string

Solved!
Go to solution

Hello guys,

 

I know that is already a lot of posts regarding this issue, but I couldn't find exactly what I need and also couldn't manage to solve it myself...

 

I need to convert a string with ASCII characters to a string containing HEX representation of these characters.

 

What I did was: 

1.PNG

Apparently it works very well, but only for a limited numbers of characters, defined by data representation of the 0 constant (U64). It allows me to convert only 8 ASCII characters, as you can see on the image below:

2.PNG

 

So, it converted from 0 to 7, but not the remaining characters (8 and 9).

 

Any ideas??

 

Thanks in advance!

 

 

0 Kudos
Message 1 of 4
(3,159 Views)
Solution
Accepted by topic author henriquegpo

What is the data type of the constant wired into the typecast.  My guess is it is a U64.  So it will only typecast the first 8 bytes of your string to a number, then you are doing hex on those 8 numbers.

 

Use the function String to Byte Array.  Or you could also typecast where an array of U8 integers is wired into the typecast function.

0 Kudos
Message 2 of 4
(3,150 Views)
Solution
Accepted by topic author henriquegpo

BIG ASCII string to HEX string.png

Omar
0 Kudos
Message 3 of 4
(3,146 Views)

Raven and Omar,

 

Both solutions worked!

 

Thank you a guys, I have a lot to learn in labview programming.

 

Best regards!

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