203
5-18-16 DOUBLE 2’S COMPLEMENT – NEGL(––)
S: First source word
IR, SR, AR, DM, HR, TC, LR
Ladder Symbols
Operand Data Areas
R: First result word
IR, SR, AR, DM, HR, LR
NEGL(––)
S
R
---
@NEGL(––)
S
R
---
Limitations S and S+1 must be in the same data area, as must R and R+1.
Description Converts
the eight-digit hexadecimal content of the source words (S
and S+1) to
its
2’
s complement and outputs the result to the result words (R and R+1). This
operation
is
ef
fectively the same as subtracting the eight-digit content S and S+1
from $0000 0000 and outputting the result to R and R+1.
If the content of S is 0000 0000, the content of R will also be 0000 0000 after
execution and EQ (SR 25506) will be turned on.
If the content of S is 8000 0000, the content of R will also be 8000 0000 after
execution and UF (SR 25405) will be turned on.
Note Refer to page 29 for details on 32-bit signed binary data.
Flags ER: Indirectly
addressed DM word
is non-existent. (Content of
∗
DM word is
not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the content of S+1, S is 0000 0000; otherwise OFF.
UF: ON when the content of S+1, S is 8000 0000; otherwise OFF.
Example The
following example shows how to use NEGL(––)
to find the 2’
s complement
of
the hexadecimal value in LR 21, LR 20 (001F FFFF) and output the result to
DM 0021, DM 0020.
NEG(––)
LR20
DM 0020
---
00000
Address Instruction Operands
00000 LD 00000
00001 NEGL(––)
LR 20
DM 0020
0000
001F
FFE0
–
0000
FFFF
0001
S+1:
LR 21
S: LR 20
R+1: DM 0021
R: DM 0020
Data Conversion Section 5-18