Chapter 6 Applied Instructions
6-125
API
Instruction code Operand Function
0306 D XCH P
S
1
, S
2
Exchanging the data
Device
X Y M S T C HC D L SM SR E PR K 16#
“$” DF
Pulse instruction 16-bit instruction (5 steps)
32-bit instruction (5 steps)
Symbol:
S
1
:
Data which will be
exchanged
Word/Double word
S
2
:
Data which will be
exchanged
Word/Double word
Explanation:
1. The data in the device specified by S
1
is exchanged with the data in the device specified by S
2
.
2. Only the 32-bit instructions can use the 32-bit counter.
Example 1:
When X0.0 is switched from OFF to ON, the data in D20 is exchanged with the data in D40.
D40
D20
1
20
40
Before the instruction
is executed:
After the instruction
is executed:
40
120
D20
D40
Example 2:
When X0.0 is switched from OFF to ON, the data in D100 is exchanged with the data in D200.
9
20
Before the instruction
is executed:
After the instruction
is executed:
8
40
D100
D101
8
40
9
20
D200
D201
D100
D101
D200
D201