![IDEC OpenNet series User Manual Download Page 182](http://html.mh-extra.com/html/idec/opennet-series/opennet-series_user-manual_617384182.webp)
12: B
OOLEAN
C
OMPUTATION
I
NSTRUCTIONS
O
PEN
N
ET
C
ONTROLLER
U
SER
’
S
M
ANUAL
12-5
NEG (Negate)
Valid Operands
For the valid operand number range, see page 6-2.
Since the NEG instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction
should be used as required.
Valid Data Types
When a word operand such as D (data register) or L (link register) is designated as the source/destination, 1 point (integer
data type) or 2 points (long data type) are used.
In the integer data type, valid values are –32768 to 32767. If the designated operand is currently –32768 (8000h), the value
will become –32768 (8000h) after it is negated.
In the long data type, valid values are –2,147,483,648 to 2,147,483,647. If the designated operand is currently
–2,147,483,648 (80000000h), the value will become –2,147,483,648 (80000000h) after it is negated.
Example: NEG
• Data Type: Integer
• Data Type: Long
Operand
Function
I
Q
M
R
T
C
D
L
Constant
Repeat
S/D (Source/Destination)
Operand to negate data
—
—
—
—
—
—
X
X
—
—
W (word)
I (integer)
D (double word)
L (long)
—
X
—
X
0 – S/D
→
S/D
When input is on, a two’s complement of operand designated by S/D is produced, and
the new value is stored to the same operand.
NEG(*)
S/D
*****
I0
NEG(I)
S/D
D10
SOTU
0
D10
Before Execution
After Execution
0
D10
1
D10
–1
D10
–32768
D10
–32768
D10
I1
NEG(L)
S/D
D20
SOTU
Before Execution
After Execution
0
D20·D21
0
D20·D21
1
D20·D21
–1
D20·D21
–2147483648
D20·D21
–2147483648
D20·D21
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: [email protected]