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.
Return value
Name | Type | Description |
---|---|---|
DATA_TO_HEXSTR2 | UDINT | Converts binary data into a hexadecimal string. |
Inputs
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
Name | Type | Description |
---|---|---|
pSrcData | POINTER TO BYTE | Start address (pointer) to the binary data to be converted. The address can be determined with the ADR operator. |
nSrcSize | UDINT | Max. size (in bytes) of the binary data to be converted. The size can be determined with the SIZEOF operator. |
pDstHexStr | POINTER TO STRING | 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 | UDINT | Maximum available size (in bytes) of the destination buffer. The size can be determined with the SIZEOF operator. |
bLoCase | BOOL | This parameter specifies whether to use upper or lower case for 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 |