-

TO_BYTE

Type Function
Description The overloaded function TO_BYTE converts an input value of various data types into an output value of the data type BYTE (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.
  • If the input data type has a bigger size than the BYTE output, only the bits 0 to 7 of the input value are considered.
  • 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_BYTE function, this only applies to BOOL inputs.
STRING conversion
Error behavior Error behavior
Examples Examples in ST
Additional information EN/ENO behavior