198
7 BASIC INSTRUCTIONS
7.2 Arithmetic Operation Instructions
Processing details
• These instructions add the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device
specified by (s2), and store the addition result in the device specified by (d).
■
Relationship between the flag operation and the sign (positive or negative) of a numeric value
Precautions
■
When DADD instruction is used
When specifying word devices, a device for the lower-order 16-bits is specified first, and then a word device with the next
device number is set for the higher-order 16 bits. To prevent number overlap, it is recommended to always specify an even
number.
■
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 DADD(P) instruction, D+(P) instruction, and DINC(P) instruction in a
program for adding "+1"
When DADD(P) instruction is used to add 1 to the contents of D0 every time X1 turns from OFF to ON, DADD(P) instruction is
similar to D+(P) instruction and DINC(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.
DADD(P) instruction
D+(P) instruction, DINC(P) instruction
Flag (zero, borrow or carry)
Operates
Does not operate
Operation
result
(s)+1=(d)
+2147483647
0
+1
+2
…
+2147483647
-2147483648
-2147483647
…
b0
567890 (BIN)
(s1)
123456 (BIN)
691346 (BIN)
+
···
···
(s1)+1
(s2)
(s2)+1
(d)
(d)+1
b31
b16 b15
b0
···
···
b31
b16 b15
b0
···
···
b31
b16 b15
Zero Flag
-2, -1, 0, -2147483648
Borrow flag
Zero Flag
2147483647, 0, 1, 2
Carry flag
Zero Flag
-1, 0, 1
The most significant
bit of data becomes "1".
The most significant
bit of data becomes "0".
DADD
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: ......