LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ASCII to decimal number

Solved!
Go to solution

Hello all,

 

I have array of ascii numbers which I need to translate into number.

I used type cast, to convert each byte into decimal number, then concatenate into string.

This string contains multiple ''space'' characters, so I cannot translate this string into number.

Please check VI in att.

Please for advise..

 

Thanks a lot.

0 Kudos
Message 1 of 8
(282 Views)
Solution
Accepted by topic author milan87

@milan87 wrote:

Hello all,

 

I have array of ascii numbers which I need to translate into number.

I used type cast, to convert each byte into decimal number, then concatenate into string.

This string contains multiple ''space'' characters, so I cannot translate this string into number.


Hex to Value.png

0 Kudos
Message 2 of 8
(259 Views)

Or:

Hex to Value 2.png

 

It's not clear what the \00 should do, separate numbers or end the one value...

 

The main problem in your solution is that the numbers are I32s. Converting them the characters (U8s) will give you 4 characters.

0 Kudos
Message 3 of 8
(257 Views)

@milan87 wrote:

I have array of ascii numbers which I need to translate into number.


How are you getting this array?  It seems to me that you are doing something just a little off if you are getting an array of I32 values.  This looks like it is a C string, so I am guessing it is coming from a DLL.  You should be able to read a string straight from the DLL and then you just need Fract/Exp String To Number to convert it into a DBL.


GCentral
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
0 Kudos
Message 4 of 8
(208 Views)
Solution
Accepted by topic author milan87

I Think this is what you want:

at.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 8
(190 Views)

Thanks all for quick support.

 

Values are from ftdi chip, which use dll, for sure written in C.

 

 

0 Kudos
Message 6 of 8
(148 Views)

@milan87 wrote:

Thanks all for quick support.

 

Values are from ftdi chip, which use dll, for sure written in C.


If it returns I32s when it should return U8s, something's suboptimal at best, wrong at worst.

0 Kudos
Message 7 of 8
(140 Views)

wiebe@CARYA wrote:

@milan87 wrote:

Thanks all for quick support.

 

Values are from ftdi chip, which use dll, for sure written in C.


If it returns I32s when it should return U8s, something's suboptimal at best, wrong at worst.


I suspect you can do something more like this so that you have the string directly (one less conversion that needs done).


GCentral
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
0 Kudos
Message 8 of 8
(111 Views)