Fnc 21 - Sub / Subtraction - Mitsubishi Electric FX3G SERIES Programming Manual

Programmable controllers
Hide thumbs Also See for FX3G SERIES:
Table of Contents

Advertisement

FX
/FX
/FX
Series Programmable Controllers
3G
3U
3UC
Programming Manual - Basic & Applied Instruction Edition
10.2
FNC 21 – SUB / Subtraction
Outline
This instruction executes subtraction using two values to obtain the result (A − B = C).
1. Instruction format
FNC 21
D
P
SUB
2. Set data
Operand type
S
1
S
2
D
3. Applicable devices
Bit Devices
Oper-
and
System User
Type
X Y M T C S D .b KnX KnY KnM KnS T C D R U \G
S
1
S
2
D
: This function is supported only in FX
Explanation of function and operation
1. 16-bit operation (SUB and SUBP)
The contents of
S
Command
input
FNC 21
SUB
• The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data is subtracted
algebraically.
5 − (−8) = 13
• When a constant (K) is specified in
2. 32-bit operation (DSUB and DSUBP)
The contents of [
is transferred to [
Command
input
FNC 21
DSUB
• The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data is subtracted
algebraically.
5500 − (−8540) = 14040
• When a constant (K) is specified in [
format.
→ For the floating point subtraction instruction ESUB (FNC121), refer to Section 18.9.
Mnemonic
16-bit Instruction
7 steps SUB
SUBP
Data for subtraction or word device number storing data
Data for subtraction or word device number storing data
Word device number storing the subtraction result
Digit Specification
/FX
3U
3UC
are subtracted from
S
2
1
S
S
D
1
2
S
or
1
S
+1,
S
] are subtracted from [
2
2
D
+1,
D
].
1
1
S
S
D
1
2
S
+1,
1
10 Arithmetic and Logical Operation (+, −, ×, ÷) – FNC 20 to FNC 29
Operation Condition
32-bit Instruction
Continuous
13 steps
Operation
Pulse (Single)
Operation
Description
Word Devices
Special
System User
Index
Unit
V
Z Modify K H
PLCs.
in binary format, and the subtraction result is transferred to
S
S
D
1
2
S
, it is automatically converted into binary format.
2
S
+1,
S
] in binary format, and the subtraction result
1
1
S
S
S
] − [
[
+1,
1
1
2
S
] or [
S
+1,
S
], it is automatically converted into binary
1
2
2
10.2 FNC 21 – SUB / Subtraction
Mnemonic
Operation Condition
Continuous
DSUB
Operation
Pulse (Single)
DSUBP
Operation
Data type
16- or 32-bit binary
16- or 32-bit binary
16- or 32-bit binary
Others
Con-
Real
Charac-
stant
Number
ter String
E
" "
S
D
D
] → [
+1,
+1,
2
1
2
3
4
5
Pointer
P
6
.
D
7
8
9
]
10
273

Advertisement

Table of Contents
loading

This manual is also suitable for:

Fx3u seriesFx3uc series

Table of Contents