19 Applied Instructions (Data Operation 2)
19.6 SWAP / Byte Swap
510
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
19.6 SWAP / Byte Swap
Outline
This instruction swaps higher 8 bits and lower 8 bits of word data.
1. Format and operation, execution form
2. Set data
3. Applicable devices
S: Refer to "Cautions".
Function and operation explanation
1. 16-bit operation (SWAP, SWAPP, DSWAP, DSWAPP)
This instruction swaps lower 8 bits and higher 8 bits.
FX3U(C) FX3G(C) FX3S FX2N(C) FX1N(C) FX1S FXU/FX2C FX0N FX0(S)
Instruction
name
Operation
Execution
form
Expression in each language
Structured ladder/FBD ST
SWAP 16 bits Continuous SWAP(EN,s);
SWAPP 16 bits Pulse SWAPP(EN,s);
DSWAP 32 bits Continuous DSWAP(EN,s);
DSWAPP 32 bits Pulse DSWAPP(EN,s);
Variable Description
Data type
16-bit
operation
32-bit
operation
Input
variable
EN Execution condition Bit
Device for swapping higher and lower bytes. ANY16 ANY32
Output
variable
ENO Execution state Bit
Operand
type
Bit Devices Word Devices Others
System user Digit designation Special unit Index Index
Cons
tant
Real
Number
Character
String
Pointer
XYMTCS
D
.b
KnX KnY KnM KnS T C D R
U\G
VZModifierKH E
""
P
zzzzzz
S1 S1
zz z
SWAP
EN ENO
s
SWAPP
EN ENO
s
DSWAP
EN ENO
s
DSWAPP
EN ENO
s
Higher 8 bits Lower 8 bits
SWAPP
EN ENO
Command
input
Device for swapping higher
and lower bytes.
s