LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hex to ascii

Solved!
Go to solution

Hi All...

 

I am trying to convert a hex string to ascii but it's not working. I get nothing on the ascii output. what am I doing wrong? 

Thanks...

 

 

~ Johnny
0 Kudos
Message 1 of 6
(3,068 Views)

You have set the display of your string control to show the hex equivilant of the input string. Your input string is a word, not a number. Therefore your scan string is returning 0 becaus the input value is actual the word "OVATION" and not an ASCII string representing a hex number.



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 2 of 6
(3,065 Views)

Did you try to right click the indicator and select Normal display?

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 6
(3,064 Views)

Thanks for reply...

 

so I changed the string control to normal display and entered the hex code again. this time I get only OV on the ascii output (indicator) . 

still confused... still new to LabVIEW. 

Thanks

~ Johnny
0 Kudos
Message 4 of 6
(3,048 Views)
Solution
Accepted by topic author Johnny-Come-Lately

Your code makes no sense. If you are scanning it as I32, the most you can keep is four characters. Your input string is also dirty and not all hex (characters 0..F exclusively), because it also contains spaces. All you get is the first four hex characters, translating to your two bytes, then padded with two \00 at the beginning..

 

Instead, you need to:

  1. remove all spaces
  2. scan the entire string two characters at a time, each pair scanned into a number using a FOR loop.

Here's one possible solution (LV2011). There are many ways to do all this.

 

0 Kudos
Message 5 of 6
(3,028 Views)

Thanks altenbac....  much appreciated

 

~ Johnny
0 Kudos
Message 6 of 6
(2,999 Views)