Appendix D How to Use PLC Function
VFD-E Series
D-46 Revision August 2006, 01EE, SW--PW V1.03/CTL V2.03
API Mnemonic Operands Function
21 SUB P S
1
, S
2
, D Subtraction
Bit Devices Word devices Program Steps
Type
OP
X Y M K H KnX KnY KnM T C D
S
1
* * * * * * * *
S
2
* * * * * * * *
D * * * * *
SUB, SUBP: 7 steps
DSUB, DSUBP: 13 steps
Operands:
S
1
: Minuend S
2
: Subtrahend D: Subtraction result
Explanations:
1. S
1
S
2
D. Performs the subtraction of BIN data S
1
and the BIN data S
2
, and stores the
subtraction result into the device D.
2. The most significant bits are the symbolic bit 0 and 1. 0 indicates positive and 1 indicates
negative. All calculations are algebraically processed.
3. Flag changes of binary subtraction
16-bit command:
A. If the operation result is “0”, then the Zero flag, M1020 is set to ON.
B. If the operation result exceeds –32,768, the borrow flag, M1021 is set to ON.
C. If the operation result exceeds 32,767, the carry flag, M1022 is set to ON.
Program Example:
16-bit command:
When X0 is ON, the data contained within the subtrahend D10 is subtracted from the data contained
within the minuend D0 and the result of this calculation is stored in the result device D20.
X0
SUB D0 D10 D20
API Mnemonic Operands Function
22 MUL P S
1
, S
2
, D Multiplication
Bit Devices Word devices Program Steps
Type
OP
X Y M K H KnX KnY KnM T C D
S
1
* * * * * * * *
S
2
* * * * * * * *
D * * * * *
MUL, DMULP: 7 steps