Fnc 21 - Sub / Subtraction - Mitsubishi Electric MELSEC FX3U Programming Manual

Melsec fx series programmable logic controllers
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
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
to
.
D
Command
input
FNC 21
SUB
• The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data are subtracted
algebraically.
5 − (−8) = 13
• When a constant (K) is specified in
2. 32-bit operation (DSUB and DSUBP)
The contents of [
subtraction result 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 are subtracted
algebraically.
5500 − (−8540) = 14040
• When a constant (K) is specified in [
the binary format.
286
→ For the floating point subtraction instruction ESUB (FNC121), refer to Section 18.9.
Mnemonic
16-bit Instruction
P
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
3U
are subtracted from
S
2
S
S
1
2
S
+1,
] are subtracted from [
S
S
2
2
D
1
S
S
1
2
S
10 Arithmetic and Logical Operation (+, −, ×, ÷) – FNC 20 to FNC 29
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
Description
Word Devices
Special
System User
Unit
/FX
PLCs.
3UC
in the binary format, and the subtraction result is transferred
S
1
D
S
S
1
2
or
, it is automatically converted into the binary format.
S
1
2
+1,
S
1
+1,
].
D
1
D
S
S
] − [
[
1
+1,
1
+1,
] or [
+1,
S
S
1
1
2
10.2 FNC 21 – SUB / Subtraction
Mnemonic
32-bit Instruction
DSUB
13 steps
DSUBP
16- or 32-bit binary
16- or 32-bit binary
16- or 32-bit binary
Con-
Real
Index
stant
Number
V Z Modify K H
E
D
] in the binary format, and the
S
1
S
S
] → [
D
2
+1,
2
], it is automatically converted into
S
2
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
Data type
Others
Charac-
Pointer
ter String
" "
P
D
+1,
]

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec fx3ucMelsec fx3g

Table of Contents