LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert ascii character to decimal integer

Solved!
Go to solution
Am sending a string of characters by USART protocol and I wanted to convert the ascii of the characters into decimal intger .. the decimal string to number block didnot work ..Also I failed to use the type cast block in this conversion .. So Can anyone help I need an fast answer asap !
0 Kudos
Message 1 of 17
(12,225 Views)
Solution
Accepted by topic author shrouk'13

there must be an easier way than this....

Example_VI.png

try this, rt clk constant to represent U8...

Example_VI.png

Message 2 of 17
(12,217 Views)

@shrouk'13 wrote:
So Can anyone help I need an fast answer asap !

Your question is way too ambiguous. Show us a typical string and what result you expect from it.

0 Kudos
Message 3 of 17
(12,202 Views)
Am sending a characters in a string .. and I wanted to convert a character like 'A' to its ascii code to be int ( to be converted to 65 ) !
0 Kudos
Message 4 of 17
(12,190 Views)

So typecast to U8 is the answer. I was confused since you said typecast did not work.

0 Kudos
Message 5 of 17
(12,186 Views)
But when i tried it .. it displayed an int from 8 numbers !
0 Kudos
Message 6 of 17
(12,179 Views)

@shrouk'13 wrote:
 .. it displayed an int from 8 numbers !

I have no idea what that means....

 

If you have eight characters, you can use "string to byte array" to make it into an array of eight numbers.

If you see eight numbers in the U8 indicator, adjust the display format.

...

0 Kudos
Message 7 of 17
(12,163 Views)
I made an constant 'A' to the input of the type cast but the output was 8 numbers too.
How is that ?
0 Kudos
Message 8 of 17
(12,157 Views)

@shrouk'13 wrote:
I made an constant 'A' to the input of the type cast but the output was 8 numbers too.
How is that ?

post your code...

0 Kudos
Message 9 of 17
(12,152 Views)

@shrouk'13 wrote:
I made an constant 'A' to the input of the type cast but the output was 8 numbers too.
How is that ?

What did you wire to the "type input"?

What are "eight numbers"? A number with eight digits? A numeric array with 8 elements? A string with 8 numeric characters?

0 Kudos
Message 10 of 17
(12,148 Views)