Solution
- Convert an ASCII character into its corresponding ASCII code
Wire the character into the left-hand input of
Type Cast VI. In this case, you must provide an input to the
Type terminal of the
Type Cast VI, because you do not want the default string output. Wire a constant
U8 into the
Type terminal. The output will now be the
U8 ASCII code that corresponds to the input character.
- Convert an integer with an ASCII code into its corresponding ASCII character
Wire the
ASCII code into the left-hand input of the
Type Cast VI, and make sure that its format is U8 (a single
ASCII character or code occupies only a single byte's worth of information). The output of the
Type Cast VI will be the desired
ASCII character. You can incorporate this character into an instrument command string using the
String Concatenate VI.
- Convert an ASCII character into its corresponding hexadecimal ASCII code
- Entering non-displayable characters in a string control
By right clicking on a string control it can be changed to
Normal Display,'\' Codes Display, Password Display, or Hex Display.
Non-displayable characters can be entered in '\' Codes Display by using their corresponding escape codes or a backslash and the hexadecimal equivalent. For example, a tab would be
\t
or
\09
. In hex display each character is represented by its corresponding hexadecimal equivalent.