Mitsubishi MELSEC iQ-F FX5 series Programming Manual page 177

Melsec iq-f fx5 series
Hide thumbs Also See for MELSEC iQ-F FX5 series:
Table of Contents

Advertisement

DSUB(P)(_U)
These instructions subtract the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device
specified by (s2), and store the result in the device specified by (d).
Ladder diagram
(s1)
(s2)
(d)
Setting data
■Descriptions, ranges, and data types
Operand
Description
(s1)
DSUB(P)
Subtrahend data or the head device where the
data to be subtracted from another is stored
DSUB(P)_U
(s2)
DSUB(P)
Subtrahend data or the head device where the
data to be subtracted from another is stored
DSUB(P)_U
(d)
DSUB(P)
Head device for storing the operation result
DSUB(P)_U
■Applicable devices
Operand
Bit
X, Y, M, L,
U\G T, ST,
SM, F, B, SB
(s1)
(s2)
(d)
Processing details
• These instructions subtract the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device
specified by (s2), and store the subtraction result in the device specified by (d).
(s1)
(s1)+1
(s2)+1
···
···
···
b31
b16 b15
b31
b0
123456 (BIN)
567890 (BIN)
-
■Relationship between the flag operation and the sign (positive or negative) of a numeric value
Device
Name
SM700, SM8022
Carry
SM8020
Zero
SM8021
Borrow
The most significant
bit of data becomes "1".
Zero Flag
-2, -1, 0, -2147483648
Borrow flag
Word
T, ST, C, D,
C, LC
W, SD, SW, R
(s2)
(d)+1
···
···
b16 b15
b31
b16 b15
b0
444434 (BIN)
Description
When the operation result exceeds the upper limit of the data setting range, the carry flag is turned ON.
When the operation result is 0, the zero flag is turned ON.
When the operation result is less than the lower limit of the data setting range, the borrow flag is turned ON.
The most significant
bit of data becomes "0".
-1, 0, 1
Zero Flag
Structured text
ENO:=DSUB(EN,s1,s2,d);
ENO:=DSUBP(EN,s1,s2,d);
Range
-2147483648 to +2147483647
0 to 4294967295
-2147483648 to +2147483647
0 to 4294967295
Double word Indirect
U\G
Z
LC
LZ
(d)
···
b0
Zero Flag
2147483647, 0, 1, 2
Carry flag
ENO:=DSUB_U(EN,s1,s2,d);
ENO:=DSUBP_U(EN,s1,s2,d);
Data type
Data type (label)
32-bit signed binary
ANY32_S
32-bit unsigned binary
ANY32_U
32-bit signed binary
ANY32_S
32-bit unsigned binary
ANY32_U
32-bit signed binary
ANY32_S
32-bit unsigned binary
ANY32_U
Constant
specification
K, H
E
$
6 BASIC INSTRUCTIONS
6.2 Arithmetic Operation Instructions
6
Others
175

Advertisement

Table of Contents
loading

Table of Contents