Addition - Mitsubishi Electric FX2N Beginners Manual

Hide thumbs Also See for FX2N:
Table of Contents

Advertisement

Math Instructions
5.4.1

Addition

The ADD instruction calculates the sum of two 16-bit or 32-bit values and writes the result to
another device.
Ladder Diagram
0
³ First source device or constant
· Second source device or constant
» Device in which the result of the addition is stored
The example above adds the contents of D0 and D1 and writes the result to D2.
Examples
Add 1,000 to the contents of data register D100:
ADD K1000 D100 D102
The signs of the values are taken into account by the ADD instruction:
ADD D10 D11 D12
You can also add 32-bit values by prefixing a "D" to the ADD instruction (DADD):
DADD D0 D2 D4
If you want you can also write the result to one of the source devices. However, if you do this
remember that the result will then change in every program cycle if the ADD instruction is exe-
cuted cyclically!
ADD D0 K25 D0
The ADD instruction can also be executed in pulse-triggered mode. Then it is only executed
when the signal state of the input condition changes from "0" to "1". To use this mode just add a
"P" suffix to the ADD instructions (ADDP, DADDP).
In the following example the constant value 27 is only added to the contents of D47 once, in the
program cycle in which the signal state of relay M47 changes from "0" to "1":
Ladder Diagram
M47
0
5 – 22
ADD D0 D1 D2
1000
D 10
D 1
D 0
65238
D 0
ADDP D47 K27 D51
More Advanced Programming
Instruction List
0 ADD
D 100
+
53
D 11
5
+
-8
D 3
D 2
+
27643
+
25
18
Instruction List
0 LD
1 ADDP
D0
D1
D2
D 102
1053
D 12
-3
D 5
D 4
92881
D 0
43
M47
D47
K27
D51
MITSUBISHI ELECTRIC

Advertisement

Table of Contents
loading

Table of Contents