F_ToASC

F_ToASC 1:

This function converts STRING to ASCII Code. Only the first sign of the STRING will be converted. An empty STRING delivers a zero.

FUNCTION F_ToASC : BYTE

VAR_INPUT
    str : STRING;
END_VAR

str: STRING to be converted

Example for a call in FBD:

PROGRAM P_TEST
VAR
    sCharacter : STRING(1) := '1';
    cAsciiCode : BYTE := 0;
END_VAR

F_ToASC 2:

Requirements

Development environment

Target system type

PLC libraries to include (Category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_System (System)