-

TO_DWORD

Type Function
Description The overloaded function TO_DWORD converts an input value of various data types into an output value of the data type DWORD (see description of the input for the supported data types).
Parameters Input

IN

Output

OUT
Conversion rules
  • The conversion is done by copying the input value bitwise to the output value, i.e., a binary transfer from the input data type to the output data type is performed.

    The bit order/bit meaning of REAL values complies with the IEC 60559 standard. Here, the basic single width floating format is defined. This bit order is copied unchanged to the output DWORD.

  • REAL input value:: The REAL to DWORD conversion complies with the latest standardization by the IEC 61131-3, 3rd edition. The floating point value is stored according to the IEEE 754 standard.
  • Input size > output size: If the input data type has a bigger size than the DWORD output, only the bits 0 to 31 of the input value are considered.
  • Input size < output size: If the input data type is smaller than the DWORD output, the "unused" bits of the DWORD are set to FALSE (e.g. bits 8 to 31 for BYTE_TO_DWORD or SINT_TO_DWORD).
  • If the range and precision of the input data type can be mapped to the range and precision of the output type, an implicit type conversion can be performed instead of using this function.
    For the TO_DWORD function, this applies to BOOL, BYTE and WORD inputs.
STRING conversion
Error behavior Error behavior
Examples Examples in ST
Additional information EN/ENO behavior