Documentation

BYTES_TO_STRING

Function name

BYTES_TO_STRING

ST call

PROGRAM BYTES_TO_STRING_DEMO
VAR
L:DINT:=4;
BYTE1 ARRAY[0..3] OF BYTE :=[65,64,65,55];
OUTPUT_STRING: STRING;
BYTES: BYTE_PTR;
END_VAR
BYTES:=ADR(BYTE[0]);
OUTPUT_STRING:=BYTES_TO_STRING(BYTES:=BYTES, L:=L);
END_PROGRAM

Description

Function converts an array of numbers representing ASCII characters to an ASCII string.

Inputs

Input Type Description
BYTES BYTE_PTR Pointer to the first byte where the ASCII-coded characters are stored.
L DINT Number of bytes to be read - string length.

Outputs

Output Type Description
=> STRING Output string of ASCII characters.

Application example