Download Delta VFD-E-User-Manual

Transcript
CALL NOW 800-985-6929
http://www.automatedpt.com
Appendix D How to Use PLC Function|
API
Mnemonic
21
SUB
Type
OP
Operands
Function
S1, S2, D
Subtraction
P
Bit Devices
X
Y
Word devices
M
Program Steps
K
H
C
D SUB, SUBP: 7 steps
S1
*
*
*
*
*
*
*
*
S2
*
*
*
*
*
*
*
*
*
*
*
*
*
D
KnX KnY KnM T
DSUB, DSUBP: 13 steps
Operands:
S1: Minuend
S2: Subtrahend
D: Remainder
Explanations:
1.
This instruction subtracts S1 and S2 in BIN format and stores the result in D.
2.
The highest bit is symbolic bit 0 (+) and 1 (-), which is suitable for algebraic subtraction.
3.
Flag changes in binary subtraction
In 16-bit instruction:
A.
If the operation result = 0, zero flag M1020 = On.
B.
If the operation result < -32,768, borrow flag M1021 = On.
C. If the operation result > 32,767, carry flag M1022 = On.
Program Example:
In 16-bit BIN subtraction:
When X0 = On, the content in D0 will minus the content in D10 and the remainder will be stored in
D20.
X0
D-52
SUB
D0
D10
D20
Revision Oct. 2009, 07EE, SW--PW V1.14/CTL V2.14
CALL NOW 800-985-6929
http://www.automatedpt.com