283
Conversion Instructions Section 5-19
Example The following example shows how to use NEG(––) to find the 2’s complement
of the content of DM 0005 and output the result to IR 105.
5-19-18DOUBLE 2’S COMPLEMENT – NEGL(––)
Limitations This instruction is available in the CQM1-CPU4@-E/-EV1 only.
DM 6143 to DM 6655 cannot be used for R.
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 effectively the same as subtracting the eight-digit content S
and S+1 from $0000 0000 and outputting the result to R and R+1; it will calcu-
late the absolute value of negative signed binary data.
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 1-10 Calculating with Signed Binary Data for more details.
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 R+1, R is zero after execution; otherwise
OFF.
UF: ON when the content of S+1, S is 8000 0000; otherwise OFF.
00000 LD 00100
00001 NEG(––)
DM 0005
105
000
Address Instruction Operands
NEG(––)
DM 0005
105
000
00100
#0000
#001F
#FFE1
–
Output to IR 105.
Content of DM 0005.
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
000
@NEGL(––)
S
R
000
000
Not used. Set to 000.