![Mitsubishi Electric MELSEC FX3G Скачать руководство пользователя страница 287](http://html.mh-extra.com/html/mitsubishi-electric/melsec-fx3g/melsec-fx3g_programming-manual_239083287.webp)
285
FX
3G
/FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
10 Arithmetic and Logical Operation (
+
,
−
,
×
,
÷
) – FNC 20 to FNC 29
10.1 FNC 20 – ADD / Addition
1
Int
roduct
ion
2
O
ver
view
3
In
str
uc
tion
Li
st
4
D
evices
in D
etail
5
Spec
ified t
he
D
evice &
C
onst
ant
6
Bef
ore
Pr
ogr
am
m
ing
7
B
asic
In
st
ru
ct
io
n
8
FN
C
00-FN
C
09
P
rogr
am
F
low
9
FN
C
10
-FN
C
19
Mo
ve
&
Co
mp
are
10
FNC2
0-F
NC2
9
Ar
ith.
&
Logic
O
per
ation
Program example
1. Difference between ADD instruction and INC instruction caused by a program for adding
"+1"
When ADD[P] is executed, "1" is added to the contents of D0 every time X001 turns ON from OFF.
ADD[P] instruction is similar to INCP instruction described later except the contents shown in the table below:
ADD, ADDP, DADD or
DADDP instruction
INC, INCP, DINC, DINCP instruction
Flag (zero, borrow or carry)
Operates
Does not operate
O
p
erat
ion result
16-bit
operation
+(+1)=
+32767
→
0
→
+1
→
+2
→
+32767
→−
32768
→−
32767
+(
−
1)=
←−
2
←−
1
←
0
←−
32768
⎯
32-bit
operation
+(+1)=
+2,147,483,647
→
0
→
+1
→
+2
→
+2,147,483,647
→−
2,147,483,648
→−
2,147,483,647
+(
−
1)=
←−
2
←−
1
←
0
←−
2,147,483,648
⎯
S
D
S
D
S
D
S
D
FNC 20
ADDP
D 0
K 1
D 0
X001
(D 0) + 1
→
(D 0)
FNC 24
INCP
D 0
X001
(D 0) + 1
→
(D 0)
S
1
S
2
D