251
FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
10 Arithmetic and Logical Operation (
+
,
−
,
×
,
÷
) – FNC 20 to FNC 29
10.2 FNC 21 – SUB / Subtraction
1
In
troduct
io
n
2
Ov
e
rv
ie
w
3
In
st
ru
ct
ion
Li
st
4
D
evi
ce
s
in
De
ta
il
5
Speci
fied t
h
e
D
evi
ce &
C
onst
a
nt
6
Bef
o
re
Pr
ogr
a
m
m
ing
7
Bas
ic
In
st
ru
cti
o
n
8
FNC0
0
-FNC0
9
P
ro
g
ra
m F
lo
w
9
FNC1
0
-FNC1
9
M
ov
e
&
C
om
par
e
10
FNC
20-
FNC
2
9
Ar
ith.
&
Logi
c
O
per
at
io
n
Program example
1. Difference between SUB instruction and DEC instruction caused by a program for
subtracting "1"
"1" is subtracted from the contents of D0 every time X001 turns ON from OFF.
SUB[P] instruction is similar to DECP instruction described later except the contents shown in the table
below:
[D] SUB instruction
[D] DEC instruction
Flag (zero, borrow or carry)
Operates
Does not operate
O
perat
ion r
e
sult
16-bit
operation
−
(+1)=
←−
2
←−
1
←
0
←−
32768
⎯
−
(
−
1)=
+32767
→
0
→
+1
→
+2
→
+32767
→−
32768
→−
32767
32-bit
operation
−
(+1)=
←−
2
←−
1
←
0
←−
2,147,483,648
⎯
−
(
−
1)=
+2,147,483,647
→
0
→
+1
→
+2
→
+2,147,483,647
→−
2,147,483,648
→−
2,147,483,7
S
D
S
D
S
D
S
D
FNC 21
SUBP
D 0
K 1
D 0
X001
(D 0)
−
1
→
(D 0)
FNC 25
DECP
D 0
X001
(D 0)
−
1
→
(D 0)
S
1
S
2
D
Содержание FX3U Series
Страница 1: ...PROGRAMMING MANUAL Basic Applied Instructions Edition FX3U FX3UC SERIES PROGRAMMABLE CONTROLLERS ...
Страница 2: ......
Страница 889: ......