DATA_TO_HEXSTR2

The function converts binary data into a hexadecimal string. This function can be used to convert simple data types and structure variables. If the maximum possible length of the output is exceeded, a dot character is added to the result string ('.') and the conversion is aborted. The remaining data bytes are not converted.

FUNCTION DATA_TO_HEXSTR2 : UDINT

VAR_INPUT

VAR_INPUT
    pSrcData    : POINTER TO BYTE;  // pointer to data buffer 
    nSrcSize    : UDINT;            // size of data buffer in bytes (= number of bytes to be converted)
    pDstHexStr  : POINTER TO STRING;// pointer to destination buffer
    nDstSize    : UDINT;            // size of destination buffer in bytes
    bLoCase     : BOOL;             // default: use "ABCDEF", if TRUE use "abcdef" characters
END_VAR

pSrcData: Start address (pointer) for the binary data to be converted. The address can be determined with the ADR operator.

nSrcSize: Max. size (in bytes) of the binary data to be converted. The size can be determined with the SIZEOF operator.

pDstHexStr: Start address (pointer) to the destination buffer into which the converted hexadecimal string is 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.

bLoCase: This parameter determines whether upper or lower case letters are to be used in the conversion. TRUE = lower case letters, FALSE = upper case letters.

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