STRING (hexadecimal format) into WORD
This function converts a STRING in hexadecimal format into a value of the data type WORD.
Thereby the attached string is first converted into a value of the data type STRING[32]. Finally this is converted into a value of the data type WORD via a sub-program of approx. 270 steps that is also used in the functions STRING_TO_INT, STRING_TO_WORD, STRING_TO_DINT and STRING_TO_DWORD.
Input
input data type
Output
Conversion result
If the required data type is supported, we recommend using the overloaded instruction TO_WORD
Permissible format: '[Space][Hexadecimal numbers][Space]' e.g. ' afFE '
Permissible characters:
Space
Sign "+" (plus), "-" (minus)
Hexadecimal numbers in the ranges "0 - 9", "A - F" or "a - f".
The analysis ends with the first non-hexadecimal number.