6 BASIC INSTRUCTIONS
6.7 Data Transfer Instructions
521
6
Exchanging the upper and lower bytes of 16-bit binary data
SWAP(P)
These instructions exchange upper and lower 8-bit data in the specified device.
■Execution condition
■Description, range, data type
■Applicable devices
• The device specified by (d) exchanges its upper and lower 8-bit data.
There is no operation error.
Ladder ST
ENO:=SWAP(EN,d);
ENO:=SWAPP(EN,d);
FBD/LD
Instruction Execution condition
SWAP
SWAPP
Operand Description Range Data type Data type (label)
(d) Start device for storing the data whose upper and lower 8-
bit data is exchanged
16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB,
FX, FY
J\ T, ST, C, D, W,
SD, SW, FD, R,
ZR, RD
U\G, J\,
U3E\(H)G
Z LT, LST,
LC
LZ K, H E $
(d)
RnCPU
RnENCPU
RnSFCPU RnSFCPURnPCPURnPCPU
(Standard) (Safety)
(Redundant)
(Process)
(d)
(d)
b15 b4b7b8b11b12 b0b3
b15 b4b7b8b11b12 b0b3
0101010110101010
0001010111101010