HEXSTR_TO_DATA2

The function converts a hexadecimal string into binary data and returns the number of successfully converted data bytes as result. Only spaces may be used as separators in the hexadecimal string to be converted. Lower and upper case letters are permitted as hex characters. In the event of an error or an illegal character the conversion is aborted and a zero length is returned as result.

FUNCTION HEXSTR_TO_DATA2 : UDINT

VAR_INPUT

VAR_INPUT
    pSrcHexStr  : POINTER TO STRING;  // hex string to convert (Example: "AF 34 55 EC")
    pDstData    : POINTER TO BYTE;    // pointer to destination buffer
    nDstSize    : UDINT;              // size of destination buffer in bytes
END_VAR

pSrcHexStr: Start address (pointer) to the hexadecimal string to be converted (e.g.: 'AB CD 01 23' ). The address can be determined with the ADR operator.

pDstData: Start address (pointer) to the destination buffer into which the converted data bytes are to be written. The address can be determined with the ADR operator.

nDstSize: Max. available size (in bytes) of the destination buffer. The size can be determined with the SIZEOF operator.

Requirements

Development environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.4024.0

PC or CX (x86, x64, ARM)

Tc2_Utilities (System) >= 3.5.1.0