LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to display a string of ASCII decimal numbers in a string indicator?

Is it possible to display a string of ASCII decimal numbers in a string indicator?

 

(I am under the impression that these would need to be converted to ASCII first...)

 

I have the attached VI that displays hexadecimal numers in string indicators but

I want these to be shown as decimal numbers.

 

disp_code.png

 

 I have changed the Ch1-1 2 indicator to normal but it then dispays binary.

 

Any tips on any functions available to display the decimal equivalents of these values in a string indicator?

 

thanks

 

0 Kudos
Message 1 of 3
(2,952 Views)

It is not clear exactly what you want displayed. What do you expect the contents of ch1-16 2 to be? Do you want "0 1 2 3 ... 15" or "30 31 32 33 ..." or somethng else?

 

Typecasting can sometimes produce unexpected results if you are not familiar with the details of how the data are repesented in memory.

 

Lynn

0 Kudos
Message 2 of 3
(2,936 Views)

What do you think you are doing when you typecast an array of U8 to a string?  I assume you know that Ascii (the character code behind strings) is just an 8-bit byte (a U8), so that this typecast is going to create "Ascii 0", "Ascii 1", ... "Ascii 32767".  Well, if you displayed your results (particular ch 49-64) in "normal" mode, you'd see the Ascii characters (with spaces between them).  For instance, ch49-64 shows " 0 1 2 3 4 5 6 7 8 9 : ; < = > ?".  

 

The "normal" way to view a String is as a String.  Because some String characters are non-printing (like ch1-16), LabVIEW also lets you view them in Hex (e.g. 0000 0001 ... 000F).  You probably know that 0008 is a tab, 000A is a Line Feed, and 000D is Carriage Return, right?  You can't ordinarily "see" these characters unless you invoke LabVIEW's Hex Display of the character string.

 

If, on the other hand, you want to see the Decimal Display of the character, that's easy -- turn it back to a number (there are various ways to do that) and wire it to a numeric Indicator, which, by default, displays in decimal.  But if you already know (because of how you wrote the code) that the value is the index (Array[i] = i), then you know (by construction) that ch1-16 contain the decimal bytes 0 .. 15 (decimal) or 0 .. 000F (Hex).

 

Bob Schor

 

0 Kudos
Message 3 of 3
(2,915 Views)