E L C P r o g r a m m i n g M a n u a l
F o r m o r e i nf o r m a t i o n v i sit :
w w w. e a t o n . c o m
MN05003003E
3-80
API Mnemonic
Operands
Function
29
D NEG P
D
Negative (2’s Compliment)
Bit Devices
Word devices
Program Steps
Type
OP
X Y M S K H KnX
KnY
KnM KnS T
C D E
F
D
*
*
*
*
*
*
*
*
NEG, NEGP: 3 steps
DNEG, DNEGP: 5 steps
ELC ELCB
ELCM
PB PC/PA/PH
PV
PB PH/PA
32 16
P
32 16
P
32 16
P
32 16 P 32 16 P
Operands:
D
: Store the result of the 2’s Compliment operation
Description:
1. The bit pattern of the selected device is inverted. This means any occurrence of a ‘1’ becomes
a ‘0’ and any occurrence of a ‘0’ will be as a ‘1’. When this is complete, a binary 1 is added to
the bit pattern. The result is the logical sign change of the value, e.g. a positive number will
become a negative number or a negative number will become a positive.
2. This instruction works best using pulse instruction (NEGP, DNEGP).
3. If
operand
D
uses index F, then only 16-bit instruction is available.
Program Example 1:
When X0 goes from OFF
→
ON, all bits in D10 will be inverted (0
→
1, 1
→
0) and then 1 will be
added and saved in the original register, D10.
X0
NEGP
D10
Program Example 2:
Obtaining the absolute value of a negative value:
1.
When the 15th bit of D0 is “1”, M0 = ON. (D0 is a negative value).
2.
When M0 = ON, the absolute value of D0 can be obtained using the 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,
a) If D0 > D2, M0 = ON.
b) If D0 = D2, M1 = ON.
c) If D0 < D2, M2 = ON.
d) D4 will always be a positive value.
Содержание ELC-PB
Страница 1: ......
Страница 5: ...For more information visit www eaton com MN05003003E iv...
Страница 29: ...ELC Programming Manual For more information visit www eaton com MN05003003E 1 24 MEMO...
Страница 502: ...3 Instruction Set MN05003003E For more information visit www eaton com 3 333...
Страница 601: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 432...
Страница 625: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 456...