LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ASCII string to number

I have been searching through articles on this problem and its clear as mud.  My specific problem is that I have an "HEX" reading from an A2D converter on one of our products, when I read it back it is displayed as ascii values so I convert it to HEX by right clicking the indicators on screen.  This is great for some of the readings, but other readings I need to convert into a decimal number to do some calculations on.  When I try to use the "convert HEX string to number" function it does nt work, because the value although displayed as HEX is still an ascii character.  I tried to write to a local variable as HEX and then read from it, but it is still an ascii character when I read it.  I can t find any ascii conversion anywhere in labview, does anyone have any ideas?
 
 
Thanks,
 
 
 
Andrew L 
Message 1 of 5
(5,931 Views)
'String to byte array'  is your friend, it will convert your string into an array of U8's where every element is one character!

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 5
(5,921 Views)
Andrew,

Convert the string to a byte array (in the numeric conversions palette). If your numbers are larger than one byte (12 or 16-bit converter) then use the join numbers functions from the data manipulation palette.

Lynn
Message 3 of 5
(5,921 Views)
Thank you both, it worked like a charm.   I had tried to use the string to byte array but I did nt join the numbers.
 
 
 
Andrew
0 Kudos
Message 4 of 5
(5,910 Views)
You can do 16 bit numbers in one step, look at the code here.

But then typecast to an array of U16's.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 5
(5,879 Views)