7 Applied Instructions
7.2 Move and Compare
169
FXCPU Structured Programming Manual
(Basic & Applied Instruction)
1
Outline
2
Instruction List
3
Configuration of
Instruction
4
How to Read
Explanation of
Instructions
5
Basic Instruction
6
Step Ladder
Instructions
7
Applied
Instructions
8
Interrupt Function
and Pulse Catch
Function
A
Relationships
between devices
and addresses
Function and operation explanation
1. 16-bit operation(XCH, XCHP)
Data is exchanged between the device specified by and the device specified by .
2. 32-bit operation(DXCH, DXCHP)
Data is exchanged between the device specified by and the device specified by .
Extension function
When the instruction is executed while M8160 is ON, high-order 8 bits (byte) and low-order 8 bits (byte) of a
word device are exchanged each other.
(The FX
U PLC of V2.30 or earlier does not support the extension function.)
This is the same operation as SWAP instruction, so use SWAP instruction for newly programming.
In the case of 32-bit operation, high-order 8 bits (byte) and low-order 8 bits (byte) of a word device are
changed.
Cautions
1) When handling 32-bit data in a structured program, a 16-bit device cannot be specified directly as in the
case of a simple project. Use a label to handle 32-bit data.
A 32-bit counter can be specified directly as it is a 32-bit long device.
Use a global label to specify a device.
2) Some restrictions to applicable devices
S1:The FX
3U and FX3UC PLCs only are applicable.
Error
An operation error occurs in the following case. The error flag M8067 turns ON, and the error code is stored in
D8067.
• When M8160 is ON, and the device numbers specified by and are different.
XCH
EN ENO
d1
d2
Command
input
Data exchanged 1
Data exchanged 2
d1 d2
Before execution After execution
K10
K36
K36
K10
Exchange
d1
d2
d1
d2
K10000
K1433600
K1433600
K10000
DXCH
EN ENO
d1
d2
Label1
*1
Label2
*1
*1 This defines the device that stores the data to be exchanged.
+1,
+1,
d1 d2
d1
d2
+1,
d1 d1
+1,
d2 d2
+1,
d1 d1
+1,
d2 d2
Command
input
Before execution After execution
Exchange
M8000
SWAP
High-order
8 bits
Low-order
8 bits
D 11
High-order
8 bits
Low-order
8 bits
D 10
X000
DXCH
EN ENO
d1
d2
Var_DXCH1
*1
Var_DXCH2
*2
M8160
*1 Var_DXCH1 is a global label and is defined as D10.
*2 Var_DXCH2 is a global label and is defined as D10.
M8160