5
Categories and Use of Basic Application Instructions
DVP-PM Operation Instruction
5-38
API Mnemonic
Operands
Function
21
D
SUB
P
Subtraction
Controllers
20PM
10PM
Bit Devices
Word Devices
Program Steps
Type
OP
X Y M S K H
KnX
KnY
KnM KnS T C D V Z
S
1
* *
*
*
*
*
*
*
*
*
*
S
2
* *
*
*
*
*
*
*
*
*
*
D
*
*
*
*
*
*
*
*
SUB, SUBP: 7 steps
DSUB, DSUBP: 9 steps
Operands:
S
1
: Minuend
S
2
: Subtrahend
D
: Remainder
Explanations:
1. SUB instruction subtracts
S
1
and
S
2
in BIN format and stores the result in
D
2. When SUB is used as 16-bit instruction, Z device cannot be adopted; when SUB is used as 32-bit instruction, V
device cannot be adopted.
3. The MSB is the sign bit. 0 indicates positive and 1 indicates negative. All calculation is algebraically processed
4. Flags:
OX
O100
Zero flag
M1808
M1968
Borrow flag
M1809
M1969
Carry flag
M1810
M1970
Flag changes in binary subtraction
In 16-bit DIN subtraction,
a) If the operational result = 0, zero flag will be ON.
b) If the operational result < -32,768, borrow flag will be ON.
c) If the operational result > 32,767, carry flag will be ON.
In 32-bit BIN subtraction,
a) If the operational result = 0, zero flag will be ON.
b) If the operational result < -2,147,483,648, borrow flag will be ON.
c) If the operational result > 2,147,483,647, carry flag will be ON.
5. The operation of flags for ADD instruction can also be applied to SUB instruction.
Program Example 1:
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
SUB
D0
D10
D20
Program Example 2:
In 32-bit BIN subtraction:
When X1 = ON, the content in (D31, D30) will minus the content in (D41, D40), and the remainder will be stored in
(D51, D50). D30, D40 and D50 are low word; D31, D41 and D51 are high word.
X1
DSUB
D30
D40
D50
Summary of Contents for DVP-10PM
Page 1: ......
Page 45: ...2 Hardware Specifications and Wiring DVP PM Application Manual 2 30 MEMO...
Page 125: ...3 Functions of Devices in DVP PM DVP PM Application Manual 3 80 MEMO...
Page 341: ...8 Application Examples DVP PM Application Manual 8 2 Trajectory 3 Trajectory 4...
Page 427: ...9 Electrical CAM DVP PM Application Manual 9 74...
Page 437: ...10 Encrypting User Program DVP PM Application Manual 10 10 MEMO...
Page 458: ...11 G code Application DVP PM Application Manual 11 21 B O100 main program...
Page 561: ...14 Appendix DVP PM Application Manual 14 4 MEMO...