86 D50 PLC User's Manual
Instruction
Mnemonic Absolute Value, NEG and NOT Range
Bit
■ Byte
ABS
DABS
NEG
DNEG
NOT
DNOT
ABS: Absolute value
NEG: 2's complement
NOT: 1's complement
■ Word
Ladder
ABS: Take the absolute value of D, and store it in D.
NEG: Take the 2’s complement and store it in D.
NOT: Take the 1’s complement and store it in D.
Description
1. For the ABS (absolute value) instruction, if the highest bit (MSB) is 1, take the 2’s
complement. If the highest bit is 0, leave it as it is.
For example, the absolute value of $9A52 (=1001 1010 0101 0010) is $65AE (=0110
0101 1010 1110). The absolute value of $7A52 (=0111 1010 0101 0010) is $7A52.
2. The NEG (2’s complement) instruction is expressed as the 1’s complement + 1.
For example, DNEG of $7A52 (=0111 1010 0101 0010) is $85AE (=1000 0101 1010
1110)
3. The NOT (1’s complement) instruction is performed by reversing each bit.
For example, DNOT of $7A52 (=0111 1010 0101 0010) is $85AD (=1000 0101 1010
1101)
4. This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression Operation Results
Initial conditions: W0 = $9A52
W1 = $7A52
W2 = $7A52
W3 = $7A52
Operation results: W0 = $65AE
W1 = $7A52
W2 = $85AE
W3 = $85AD
ABS
D =
R
NEG
D =
R
NOT
D =
R
DABS
D = W0
DABS
D = W1
DNEG
D = W2
DNOT
D = W3
R0 0
R
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com