CHAR (ASCII code to string character)

The CHAR instruction returns a one-character string for an ASCII code. ASCII code -> character.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
CHAR
CHAR
CHAR parameters
Parameter
Parameter Type
Data Type
Description
EN
Input
BOOL
Instruction enable.
  • TRUE: Provide a single character string.
  • FALSE: No operation.
Applies to ladder diagram programs.
Code
Input
DINT
ASCII code in set to [0 .. 255].
CHAR
Output
STRING
One-character string. The character has the ASCII code given in input code.
ENO
Output
BOOL
Enable output.
Applies to ladder diagram programs.

CHAR examples

CHAR function block diagram example
CHAR function block diagram example
CHAR ladder diagram example
CHAR ladder diagram example
CHAR structured text example
CHAR structured text example
(* ST Equivalence: *) Display := CHAR ( value + 48 ); (* value is in set [0..9] *) (* 48 is the ascii code of '0' *) (* result is one character string from '0' to '9' *)
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal