Mitsubishi Electric MELSEC-Q/L Programming Manual page 229

Hide thumbs Also See for MELSEC-Q/L:
Table of Contents

Advertisement

■D-
• Subtracts 32-bit BIN data designated by (S1) from 32-bit BIN data designated by (S2) and stores the result of the
subtraction at the device designated by (D).
+1
+1
S1
S1
S2
b31
b16 b15
b0
b31
b16 b15
567890 (BIN)
123456 (BIN)
• The values for (S1), (S2) and (D) can be designated at between -2147483648 and 2147483647 (BIN 32 bits).
• Judgment of whether the data is positive or negative is made on the basis of the most significant bit (b31).
• 0  Positive
• 1  Negative
• The following will happen when an underflow or overflow is generated in an operation result: The carry flag (SM700) in this
case does not turn ON.
K 2147483648
K2
(80000000
)
(00000002
)
H
H
K2147483647
K 2
(7FFFFFFF
)
(FFFFFFFE
H
H
Operation error
• There is no operation error in the D+(P) or D-(P) instruction.
Program example
• The following program adds 28-bit data from X10 to X2B to the data at D9 and D10 when X0 goes ON, and outputs the
result of the operation to Y30 to Y4B.
[Ladder Mode]
• The following program subtracts the data from M0 to M23 from the data at D0 and D1 when XB goes ON, and stores the
result at D10 and D11.
[Ladder Mode]
D
D
+1
S2
b0
b31
b16 b15
444434 (BIN)
K2147483646
Since bit 31 value is "0",
(7FFFFFFE
)
result of operation takes a positive value.
H
Since bit 31 value is "1",
K 2147483647
)
(80000001
)
result of operation takes a negative value.
H
b0
[List Mode]
Step
Instruction
[List Mode]
Step
Instruction
6.2 Arithmetic Operation Instructions
Device
Device
6 BASIC INSTRUCTIONS
6
227

Advertisement

Table of Contents
loading

Table of Contents