5
Categories and Use of Basic Application Instructions
DVP-PM Operation Instruction
5-46
API Mnemonic Operands
Function
29
D NEG P
2’s Complement (Negation)
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
D
*
*
*
*
*
*
*
*
NEG, NEGP: 7 steps
DNEG, DNEGP: 9 steps
Operands:
D
: Device to store the operation result of 2’s Compliment
Explanations:
1. NEG instruction conducts operation of 2’s complement and can be used for converting a negative BIN value into
an absolute value
2. When NEG is used as 16-bit instruction, Z device cannot be adopted; when NEG is used as 32-bit instruction, V
device cannot be adopted.
3. This instruction is generally used in pulse execution mode (NEGP, DNEGP).
Program Example 1:
When X0 goes from OFF to ON, the phase of each bit in D10 will be reversed (0
→
1, 1
→
0) and then 1 will be added
to the Least Significant Bit (LSB) of the register. Operation result will then be stored in D10.
X0
NEGP
D10
Program Example 2:
To obtain the absolute value of a negative value:
1. When MSB (b15) of D0 is “1”, M0 = ON. (D0 is a negative value)
2. When M0 = ON, the absolute value of D0 can be obtained by NEG instruction.
M1000
BON
D0
K15
M0
M0
NEGP
D0
Program Example 3:
Obtain the absolute value of the remainder of the subtraction. When X0 = ON,
1. If D0 > D2, M0 = ON.
2. If D0 = D2, M1 = ON.
3. If D0 < D2, M2 = ON.
4. D4 is then able to remain positive.
X0
CMP
D0
D2
M0
M0
SUB
D0
D2
D4
M2
SUB
D2
D0
D4
M1
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...