annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Converting ascii to hex

How do you go about converting an ascii string to a string of corresponding hex values. ex. "C"-->"43" or "KC" --> "434B"
0 Kudos
Messaggio 1 di 4
11.155Visualizzazioni
I have attached a small LV 6i vi that seems to do the trick. Basically, it converts the string into byte array, then converts the byte array into an array of hexadecimal strings, then concatenates the elements of the hexadecimal string array into a single string.

Good Luck

Frank Carey
Messaggio 2 di 4
11.155Visualizzazioni
Find attached VI, it includes 2 different approaches. I wasn't sure about normal/reverse order in your final string, thus I coded both.

Good Luck!
0 Kudos
Messaggio 3 di 4
11.155Visualizzazioni
If you only want to display the hexadecimal content of a string, write it in an indicator and select the hexadecimal display with the right button menu.

If you need to convert the string, tt can be done using 3 LabVIEW functions, no loop:

ASCII String->String to Byte Array->Number to Hexadecimal String(length 2)->Concatenate Strings->Hexadecimal String.


LabVIEW, C'est LabVIEW

Messaggio 4 di 4
11.155Visualizzazioni