9: MOVE INSTRUCTIONS
OPENNET CONTROLLER USER’S MANUAL 9-13
XCHG (Exchange)
Valid Operands
For the valid operand number range, see page 6-2.
▲ Internal relays M0 through M2557 can be designated as D1 or D2. Special internal relays cannot be designated as D1 or
D2.
When T (timer) or C (counter) is used as D1 or D2, the current value is read and written in as a preset value which can be
0 through 65535.
Valid Data Types
When a bit operand such as Q (output), M (internal relay), or R (shift register) is designated as the destination, 16 points
(word data type) or 32 points (double-word data type) are used.
When a word operand such as T (timer), C (counter), D (data register), or L (link register) is designated as the destination,
1 point (word data type) or 2 points (double-word data type) are used.
Examples: XCHG
Operand Function I Q M R T C D L Constant Repeat
D1 (Destination 1) First operand number to exchange — X ▲ XXXXX ——
D2 (Destination 2) First operand number to exchange — X ▲ XXXXX ——
W (word) I (integer) D (double word) L (long)
X — X —
D1 ↔ D2
When input is on, the 16- or 32-bit data in operands designated by D1 and D2
are exchanged with each other.
XCHG(*) D1
*****
D2
*****
D21 ↔ D25
When input I0 is turned on, data of data registers D21 and D25
designated by operands D1 and D2 are exchanged with each other.
I0
XCHG(W) D2
D25
D1
D21
SOTU
D22
100
D21
D23
Before Exchange After Exchange
D24
200
D25
D22
200
D21
D23
D24
100
D25
200
D32
100
D31
D33
Before Exchange After Exchange
D34
500
D35
D31·D32 ↔ D35·D36
When input I1 is turned on, data of data registers D31·D32 and
D35·D36 designated by operands D1 and D2 are exchanged with
each other.
I1
XCHG(D) D2
D35
D1
D31
SOTU
600
D36
600
D32
500
D31
D33
D34
100
D35
200
D36
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com