7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions
187
7
■
Relationship between the flag operation and the sign (positive or negative) of a numeric value
Precautions
■
When specifying the same device in the source and destination
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 ADD instruction is used.
■
Difference between ADD(P) instruction, +(P) instruction, and INC(P) instruction in a program
for adding "+1"
When ADD(P) instruction is used to add 1 to the contents of D0 every time X1 turns from OFF to ON, ADD(P) instruction is
similar to +(P) instruction and INC(P) instruction described later except for the contents shown in the table below
Operation error
There is no operation error.
Device
Name
Description
SM700, SM8022
Carry
When the operation result exceeds the upper limit of the data setting range, the carry flag is turned ON.
SM8020
Zero
When the operation result is 0, the zero flag is turned ON.
SM8021
Borrow
When the operation result is less than the lower limit of the data setting range, the borrow flag is turned ON.
ADD(P) instruction
+(P) instruction, INC(P) instruction
Flag (zero, borrow or carry)
Operates
Does not operate
Operation result
(s)+1=(d)
+32767
0
+1
+2
…
+32767
-32768
-32767
…
Zero Flag
Borrow flag
Zero Flag
Carry flag
Zero Flag
-2, -1, 0, -32768
32767, 0, 1, 2
-1, 0, 1
The most significant
bit of data becomes "1".
The most significant
bit of data becomes "0".
ADD
D0
K25
D0
X1
(D0)+25
→
(D0)
Summary of Contents for MELSEC iQ-F FX5
Page 1: ...MELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks ...
Page 2: ......
Page 17: ...15 CONTENTS ...
Page 24: ...22 MEMO ...
Page 1050: ...1048 26 TIME DATA FUNCTIONS 26 4 Division MEMO ...
Page 1068: ...1066 29 COUNTER FUNCTION BLOCKS 29 4 Counter Function Block Operation error There is no error ...
Page 1107: ...I 1105 MEMO ...
Page 1111: ......