Add (Fnc 20) - Mitsubishi FX1S Series Programming Manual

Melsec-f
Hide thumbs Also See for FX1S Series:
Table of Contents

Advertisement

FX Series Programmable Controlers
5.3.1

ADD (FNC 20)

Mnemonic
ADD
FNC 20
(
Addition)
16 BIT OPERATION
X0
Points to note:
a) All calculations are algebraically processed, i.e. 5 + (-8)= -3.
b) The same device may be used as a source (S
the case then the ADD instruction would actually operate continuously. This means on
every scan the instruction would add the result of the last scan to the second source device.
To prevent this from happening the pulse modifier should be used or an interlock should be
programmed.
c) If the result of a calculation is "0" then a special auxiliary flag, M8020 is set ON.
d) If the result of an operation exceeds 32,767 (16 bit limit) or 2,147,483,647 (32 bit limit) the
carry flag, M8022 is set ON. If the result of an operation exceeds -32,768 or -2,147,483,648
the borrow flag, M8021 is set ON. When a result exceeds either of the number limits, the
appropriate flag is set ON (M8021 or M8022) and a portion of the carry/borrow is stored in
the destination device. The mathematical sign of this stored data is reflective of the number
limit which has been exceeded, i.e. when -32,768 is exceeded negative numbers are stored
in the destination device but if 32,767 was exceeded positive numbers would be stored at
D.
e) If the destination location is smaller than the obtained result, then only the portion of the
result which directly maps to the destination area will be written, i.e if 25 (decimal) was the
result, and it was to be stored at K1Y4 then only Y4 and Y7 would be active. In binary terms
this is equivalent to a decimal value of 9 a long way short of the real result of 25!
Function
The value of the
K, H, KnX, KnY, KnM, KnS,
two source
T, C, D, V, Z
devices is added
When using M8023 to add floating point data,
and the result
only double word (32 bit) data registers (D) or
stored in the desti-
constants (K/H) may be used. See page 4-46
nation device
for more details regarding floating point format.
32 BIT OPERATION
[ S1 ]
[ S2 ]
[ D ]
ADD
D 10 D 12
D 14
Operands
S1
S2
PULSE-P
Operation: (Applicable to all units)
The data contained within the source devices
(S
,S
) is combined and the total is stored at the
1
2
specified destination device (D).
or S
) and as the destination (D). If this is
1
2
Applied Instructions 5
FX
FX
FX
1S
1N
Program steps
D
KnY, KnM, KnS,
ADD, ADDP:
T, C, D, V, Z
7 steps
DADD,
DADDP:
13 steps
5-30
FX
2N
2NC

Advertisement

Table of Contents
loading

This manual is also suitable for:

Fx1n seriesFx2nc seriesFx2n series

Table of Contents