Chapter 5 Instruction Specifications
5-95
Item number Application instructions-23 Name Swap
Ladder format Condition code
Processing time (µs)
Remark
R7F4 R7F3 R7F2 R7F1 R7F0
Average Maximum
SWAP (d) DER ERR SD V C
zzzzz
Instruction format Number of steps
25
Condition Steps
SWAP (d) 2
Bit Word Double word
Usable I/O
XY
R,
M
TD, SS,
CU, CT WX WY
WR,
WM TC DX DY
DR,
DM
Constant
Other
d I/O to be exchanged {{
Function
• Swaps the upper 8 bits and lower 8 bits contained in d.
0001110101101101
0110110100011101
(Before execution) d
(After execution) d
Notes
• Use edge trigger as the startup condition for this instruction.
Program example
X00000 DIF0
SWAP (WR0010 )
LD X00000
AND DIF0
[
SWAP (WR0010)
]
Program description
• The upper and lower bits of WR0010 are swapped at the leading edge of X00000, and are stored in WR0010.
WR0010 H1234 Before execution
WR0010 H3412 After execution
Note: Since a scan is executed when there is no leading edge DIF0, the upper and lower bits of WR0010 are swapped every
time a scan is executed.
SWAP (d)