Conversion instructions
144
Part II IEC Instructions
STRING_TO_DWORD
_STEPSAVER
STRING (Hexadecimal Format right-justified) to DOUBLE WORD
Input Defined as Results in
'FE' STRING[2] 16#FE
'EFFE' STRING[4] 16#EFFE
'CDEFFE' STRING[6] 16#CDEFFE
'ABCDEFFE' STRING[8] 16#ABCDEFFE
'00ABCDEFFE' STRING[10] 16#ABCDEFFE
The basic instruction F72_A2HEX (see page 624) is used. The PLC delivers an operation error
especially when a character appears that is not a hexadecimal number “0 - 9" or "A - F”.
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
Data type Comment
STRING Input variable
DWORD Output variable
Acceptable Format for STRING[8]:
'Hex1Hex2Hex3Hex4Hex5Hex6Hex7Hex8' e.g. perhaps '001AAFFE'
Acceptable characters:
Hex1 to Hex8 Hexadecimal numbers in the range "0 - 9“ or "A - F“ (not "a - f").
PLC types
Availability of STRING_TO_DWORD_STEPSAVER (see page 1331)
Description
This function converts the string with the maximum possible number of characters that are right
aligned in hexadecimal format to a value of the data type DWORD.
Explanation
Example
Data types