Chapter 8 Logic Instructions
8-29
FB/FC
FC
Swap is used for swapping the high byte and low byte of a 16-bit value.
Parameters
Meaning
Description Valid range
In
Input Data to swap 0~65535 for word data type
Out
Output
Output Result 0~65535 for word data type
Boolean
Bit string Integer
Real
number
Time, date
String
STRING
In
● ●
Out
● ●
Note:
The symbol ● indicates that the parameter is allowed to connect to the variable or constant of the data
type.
Function Explanation
The Swap instruction exchanges the high byte and low byte of the value of In and the result is output to
Out.
Programming Example
The variable table and program
Variable name Data type Current value
Swap_EN BOOL TRUE
Swap_In
UINT 32768
1
Swap
EN ENO
In Out
Swap_EN
Swap_In Out1