Mitsubishi Electronics FX3G User Manual

Page of 964
542
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
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
X Y M T C S D .b KnX KnY KnM KnS T C D R U \G
V Z Modify K H
E
" "
P
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
Command
input
FNC147
SWAPP
High-order 8 bits Low-order 8 bits
,
High-order 8 bits Low-order 8 bits
+1
Command
input
FNC147
DSWAPP