7 Applied Instructions
7.3 Arithmetic and Logical Operation
183
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
Related device
1. Relationship between the flag operation and the sign
→ For the flag operations, refer to Section 1.3.4.
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) The FX
0, FX0S or FX0N PLC does not support the instructions of pulse operation type.
To execute pulse operation, make the instruction execution condition pulse type.
3) When using a 32-bit operation instruction (DSUB or DSUBP) and specifying word devices, a 16-bit word
device on the low-order side is specified first, and a word device with the subsequent device number is
automatically set for the high-order 16 bits.
To prevent number overlap, it is recommended to always specify an even number, for example.
4) The same device number can be specified for both the source and the destination.
In this case, note that the addition result changes in every operation cycle if a continuous operation type
instruction (SUB or DSUB) is used.
5) Some restrictions to applicable devices
S1:The FX
3U, FX3UC and FX3G PLCs only are applicable.
S2:The FX
3U and FX3UC PLCs only are applicable.
Device Name Description
M8020 Zero
ON : When the operation result is 0
OFF : When the operation result is not 0
M8021 Borrow
ON : When the operation result is less than -32,768 (in 16-bit operation) or -2,147,483,648 (in 
32-bit operation), the borrow flag operates.
OFF : When the operation result is not less than -32,768 (in 16-bit operation) or 
-2,147,483,648 (in 32-bit operation)
M8022 Carry
ON : When the operation result is more than 32,767 (in 16-bit operation) or 2,147,483,647 (in 
32-bit operation), the carry flag operates.
OFF : When the operation result is not more than 32,767 (in 16-bit operation) or 
2,147,483,647(in 32-bit operation)
Zero flag
Borrow flag
Zero flag
Borrow flag
The most significant
bit of data
becomes "1".
Zero flag
Carry flag
Zero flag
Carry flag
Zero flag
Zero flag
The most significant
bit of data
becomes "0".
–1,     0,     1
–2,    –1,     0,     –32,768
32,767,      0,    1,     2
2,    –1,     0,    –2,147,483,648
–1,     0,     1
2,147,483,647,      0,     1,     2
X001
D0
D0
K25
SUB
EN
s1
s2
ENO
d
(D  0) – 25 
→
 (D  0)