Download Print this page

Mitsubishi Electric MELSEC iQ-F FX5 Programming Manual page 206

Instructions, standard functions/function blocks
Hide thumbs Also See for MELSEC iQ-F FX5:

Advertisement

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
b31
b16 b15
b0
···
···
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
Precautions
■When the DSUB instruction is used
When specifying word devices, a device is specified for the lower-order 16-bits first, and then a word device with the next
device number is set for the higher-order 16 bits. To prevent number overlap, it is recommended to always specify an even
number.
■When specifying the same device in the source and destination
The same device number can be specified for both the source and the destination. In this case, note that the subtraction result
changes in every operation cycle if a continuous operation type SUB instruction is used.
X1
DSUB
■Difference between DSUB(P) instruction, D-(P) instruction, and DDEC(P) instruction in a
program for subtracting "-1"
When DSUB(P) instruction is used to subtract 1 from the contents of D0 every time X1 turns from OFF to ON, SUB(P)
instruction is similar to D-(P) instruction and DDEC(P) instruction described later except for the contents shown in the table
below:
Flag (zero, borrow or carry)
Operation
(s)-1=(d)
result
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
204
7.2 Arithmetic Operation Instructions
(s2)
(s2)+1
b31
b16 b15
b0
b31
···
···
-
123456 (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.
-1, 0, 1
Zero Flag
D0
K25
D0
(D0)-25 → (D0)
DSUB(P) instruction
Operates
-2147483648  0  -1  -2 ...
(d)
(d)+1
b16 b15
b0
···
···
444434 (BIN)
The most significant
bit of data becomes "0".
Zero Flag
2147483647, 0, 1, 2
Carry flag
D-(P) instruction, DDEC(P) instruction
Does not operate
-2147483648  +2147483647  +2147483646 ...

Hide quick links:

Advertisement

loading