Chapter 6: Instructions
111
Instruction
Mnemonic
Absolute Value, NEG and NOT
Range
Bit
■
Word
ABS
DABS
NEG
DNEG
NOT
DNOT
ABS: Absolute value
NEG: 2's complement
NOT: 1's complement
■
Double words
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 comp 1.
For example, NEG 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, NOT 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
ABS
D = W0
ABS
D = W1
NEG
D = W2
NOT
D = W3
R0 0
R
Содержание D320 PLC
Страница 1: ...D320 PLC User s Manual...
Страница 18: ...6 D320 PLC User s Manual...
Страница 28: ...16 D320 PLC User s Manual...
Страница 34: ...22 D320 PLC User s Manual...
Страница 78: ...66 D320 PLC User s Manual...
Страница 176: ...164 D320 PLC User s Manual...
Страница 210: ...198 D320 PLC User s Manual...
Страница 258: ...246 D320 PLC User s Manual...