# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Efficient way to convery numeric HEX value to ASCII

Hi,

Hope you are doing good,

I am trying to convert a decimal value- first to boolean array- break that array into smaller sub-arrays and then convert those sub-arrays into a a HEX value (numeric) (using a case structure I created to convert numeric values to HEX String) and then convert this Hex value into ASCII code.

I managed to get the desired output but I do not think it is the most efficient way to do it. I would appreciate if anyone has any recommendations. (VI attached)

Instructions I followed:

Screenshot for a quick glance: (VI attached)

Message 1 of 6
(186 Views)

## Re: Efficient way to convery numeric HEX value to ASCII

What is the desired output for the current diagram constant?

I don't see where you create a numeric. You only create a string.

(I think what you need to do could fit on a postage stamp. No need for green or pink. Also learn the difference between datatype and cosmetic formatting)

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 2 of 6
(149 Views)
Solution
Accepted by topic author Xonmyth743

## Re: Efficient way to convery numeric HEX value to ASCII

I'm not even sure you are getting the right results.  You are flipping the arrays when I don't think you need to.  And I don't think you are supposed to convert into ASCII Hex and then back into an actual value.

Based on the chart you gave, I would do this:

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 6
(147 Views)

## Re: Efficient way to convery numeric HEX value to ASCII

@crossrulz wrote:

I'm not even sure you are getting the right results.  You are flipping the arrays when I don't think you need to.  And I don't think you are supposed to convert into ASCII Hex and then back into an actual value.

Based on the chart you gave, I would do this:

Hi crossrulz,

Thank you for looking into this. I was getting desired result for certain values not all of them. The constant I had in the block diagram were from an actual reading from the device and all the Alpha numeric (A1) values got converted as expected the numeric only (01) values were not.

But your implementation of course works with all types of input values and as expected. Thank you, I learned too many thing form this implementation.

Message 4 of 6
(121 Views)

## Re: Efficient way to convery numeric HEX value to ASCII

@altenbach wrote:

What is the desired output for the current diagram constant?

I don't see where you create a numeric. You only create a string.

(I think what you need to do could fit on a postage stamp. No need for green or pink. Also learn the difference between datatype and cosmetic formatting)

Desired output was a string value. Yes, input should have been U16. I learned that while playing with the arrays.

I know my VI would have been painful for you to look at but I am trying to learn. So thank you for your input.

Message 5 of 6
(117 Views)

## Re: Efficient way to convery numeric HEX value to ASCII

Seriously thank you!! I learned that everything that I was doing could use split and/or join number functions and no more array conversions on the diagram and is all cleaned up. I did not know I could do this:

I could not take the before screenshot but that's actually healthy for viewers.

Message 6 of 6
(104 Views)