ASCII
The ASCII instruction returns the ASCII code for characters in strings.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
ASCII

Parameter | Parameter Type | Data Type | Description |
---|---|---|---|
EN | Input | BOOL | Instruction enable.
Applies to ladder diagram programs. |
IN | Input | STRING | Any non-empty string. |
Pos | Input | DINT | Position of the selected character in set [1.. len] (len is the length of the IN string). |
ASCII | Output | DINT | ASCII code of the selected character (in set [0 .. 255]) yields 0 is Pos is out of the string. |
ENO | Output | BOOL | Enable output. Applies to ladder diagram programs. |
ASCII examples
ASCII function block diagram example

ASCII ladder diagram example

ASCII structured text example

(* ST Equivalence: *) FirstChr := ASCII (message, 1); (* FirstChr is the ASCII code of the first character of the string *)
Results

Provide Feedback