LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting a hexadecimal string to ASCII-characters.

I have long hexadecimal strings that I wish to convert to their corresponding ascii-characters. I know there are a series of functions for doing things like this - hex to number, number to string etc.

 

At the moment, however, I am stuck at entering the hexadecimal string. I connect it to "hexadecimal string to number". What I get out is the decimal value of the two last digits of the hexadecimal number. No other wires are connected to the function. This means data is lost. How do I get around this? Is this particular function at all suitable for what I am trying to do?

0 Kudos
Message 1 of 14
(8,249 Views)

I just did a quick test with a constant string connected to the function and a indicator (the minimal function). Atleast with 6 characters it worked fine, so to me it sounds like a string-problem. Do you have spaces or anything in the string so you need to clean it first?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 14
(8,241 Views)

Tzench wrote:

I have long hexadecimal strings that I wish to convert to their corresponding ascii-characters.

 

Is this particular function at all suitable for what I am trying to do?


Please post a sample of what input you gave and what output is coming and what exact output you want.

This will help us for better understanding and make things more clear.

 

Mathan

0 Kudos
Message 3 of 14
(8,232 Views)

Hi Tzench,

 

"hexadecimal string" isn't very accurate and conversion questions have been discussed many times before...

 

See example on conversion of two different "hexadecimal" strings. There are other conversion methods, but those are most easiest to understand Smiley Wink

Message Edited by GerdW on 12-08-2008 11:27 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 14
(8,229 Views)
GerdW has a good solution to your problem. If your string is formatted with unwanted non numerical characters you can use this method to clean it up. Please note I have used a shift register. Using a shift register may double your memory needs. If you have a very large strings (like 20 mbyte) it could be a problem.  


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 5 of 14
(8,203 Views)
Nice post, I found this post with google.
Message Edited by ST5 on 08-26-2009 07:16 AM
0 Kudos
Message 6 of 14
(7,639 Views)

I've found this thread very helpful

 

I had a concateneted hexadecimal string in normal display (didn't found a way to concatenate hex strings into a hex string display correctly, only to a normal display)

I needed to calculate a LRC Checksum:

Example: 010310000002

LRC=2complement(01+03+10+00+00+02)=EA

 

Tried a lot of methods but only could get there with this:

LRC.png

 

 

I'm sharing because it could help someone else.

If someone know a more elegant way to do it please share.

0 Kudos
Message 7 of 14
(6,125 Views)

Dear all, I've got a problem to interpret following HEX string 'A001 1000 0400 0301 04'. Actually I know, that 'A' is a flag of the strat bite, the bites 'A001 1000' are a description of a value '0400 0301 04', witch means DEC 4.0314. I've tried all of the solution above, accept standard NI technique without success.

I'd appreciate your help or suggestions!

0 Kudos
Message 8 of 14
(6,019 Views)

It would have been better if you started your own thread rather than jumping onto someone else's from 3 1/2 years ago.

 

I can sort of see how you get the 0314 part out of that string.  But where does December come from?  And what what exactly does December 4.0314 mean?

0 Kudos
Message 9 of 14
(6,006 Views)

Thank you for replay,

 

December was in my soul, before I found the following solution Smiley Very Happy:

var1c_block_diagram.png

var1c_block_diagram.png

I'm not sure, if my parser is optimal.

 

Raves Fan: "t would have been better if you started your own thread rather than jumping onto someone else's from 3 1/2 years ago."

 

Yes I will. After I'll get my vi in useful and presentable form. Are you agree?

0 Kudos
Message 10 of 14
(5,998 Views)