540
FX3G/FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
19 Data Operation 2 – FNC140 to FNC149
19.6 FNC147 – SWAP / Byte Swap
19.6 FNC147 – SWAP / Byte Swap
Outline
This instruction swaps the high-order 8 bits and low-order 8 bits of a word device.
1. Instruction format
2. Set data
3. Applicable devices
Explanation of function and operation
1. 16-bit operation (SWAP and SWAPP)
High-order 8 bits and low-order 8 bits are swapped for each other.
2. 32-bit operation (DSWAP and DSWAPP)
High-order 8 bits and low-order 8 bits are swapped for each other in each word device.
Caution
• When the continuous operation type instruction is used, swapping is executed in each operation cycle.
This instruction works in the same way as the extension function of the XCH (FNC 17) instruction.
Operand type Description Data type
Word device whose high-order 8 bits and low-order 8 bits are swapped for each other 16- or 32-bit binary
Oper-
and
Type
Bit Devices Word Devices Others
System User Digit Specification System User
Special
Unit
Index
Con-
stant
Real
Number
Charac-
ter String
Pointer
XYMTCSD.b KnX KnY KnM KnS T C D R U\G VZModifyKH E ""P
3333333 3 333
DSWAP
DSWAPP
Mnemonic Operation Condition
P
FNC 147
SWAP
D
16-bit Instruction
3 steps
SWAP
SWAPP
Mnemonic Operation Condition
Continuous
Operation
Pulse (Single)
Operation
32-bit Instruction
5 steps
Continuous
Operation
Pulse (Single)
Operation
S
1
S
S
1
S
High-order 8 bits Low-order 8 bits
S
Command
input
FNC147
SWAPP
S
High-order 8 bits Low-order 8 bits
,
High-order 8 bits Low-order 8 bits
+1
S
S
Command
input
FNC147
DSWAPP
S