Item number
Application instructions-16
Ladder format
NEG (d)
Instruction format
NEG (d)
Usable I/O
d
I/O to take complement
Function
•
Calculates two's complements of d (Reverses each bit contained in d and adds "1." However, C (R7F0) remains
unchanged).
Before execution
1
1
0
0
0
1
+
After execution
0
0
1
Notes
•
Use edge trigger as the startup condition for this instruction.
Program example
R000
DIF0
NEG (WR0000)
Program description
•
When R000 rises, 2's complement of the content of WR0000 is obtained.
Example) If WR0000 is H1234, WR0000 = HEDCC after the instruction is executed;
WR0000 = H1234 when executed again
Name
Condition code
R7F4
R7F3
R7F2
DER
ERR
SD
Number of steps
Condition
Bit
R,
TD, SS,
X
Y
M
CU, CT
WX WY
0
1
1
0
0
0
0
0
1
0
0
1
1
1
1
1
1
0
0
1
1
1
1
1
LD
R000
AND DIF0
[
NEG WR0000
]
5-88
Chapter 5 Instruction Specifications
Two's complement (NEGATE)
Processing time (µs)
R7F1
R7F0
Average Maximum
V
C
22
Steps
2
29
Word
Double word
WR,
WM TC DX DY
1
1
0
1
0
0
0
1
0
1
1
0
0
1
1
0
Remark
Upper case: W
Lower case: DW
DR,
Other
DM