Table of Contents

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

InputType Description
BYTESBYTE_PTRPointer to the first byte where the ASCII-coded characters are stored.
L DINT Number of bytes to be read - string length.

Outputs

OutputType Description
STRINGOutput string of ASCII characters.

Application example