BYTES_TO_STRING

BYTES_TO_STRING

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

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

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.
OutputType Description
STRINGOutput string of ASCII characters.

  • © Energocentrum Plus, s.r.o. 2017 - 2021