535
FX3G/FX3U/FX3GC/FX3UC Series
Programming Manual - Basic & Applied Instruction Edition
19 Data Operation 2 – FNC140 to FNC149
19.6 FNC147 – SWAP / Byte Swap
11
FNC30-FNC39
Rotation and
Shift
12
FNC40-FNC49
Data Operation
13
FNC50-FNC59
High-Speed
Processing
14
FMC60-FNC69
Handy
Instruction
15
FNC70-FNC79
External FX I/O
Device
16
FNC80-FNC89
External FX
Device
17
FNC100-FNC109
Data
Transfer 2
18
FNC110-FNC139
Floating Point
19
FNC140-FNC149
Data
Operation 2
20
FNC150-FNC159
Positioning
Control
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