7 Applied Instructions
7.3 Arithmetic and Logical Operation
179
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(ADD, ADDP)
The data specified by   and   are added in the binary format, and the addition result is transferred to
the device specified by  .
• The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data is added 
algebraically.
5+(-8)=-3
• When a constant (K) is specified in   or  , it is automatically converted into the binary format.
2. 32-bit operation(DADD, DADDP)
The data specified by   and   are added in the binary format, and the addition result is transferred to
the device specified by  .
• The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data is added 
algebraically.
5,500+(-8,540)=-3,040
• When a constant (K) is specified in   or  , it is automatically converted into the binary format.
Related device
1. Relationship between the flag operation and the sign
→ For the flag operations, refer to Section 1.3.4.
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)
Command input
Addition data 1
Device for
addition result
ADD
EN
s1
s2
ENO
d
Addition data 2
    +      →
ds1 s2
Command input
DADD
EN
s1
s2
ENO
d
Label3
*1
Label2
*2
*1 This defines the data to be added or the device that stores the data.
*2 This defines the device that stores the results of addition.
Label1
*1
s1 s2 s2
[   +1,        ] + [        +1,        ] → [    +1,    ]
s1 d d
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