330
Binary Calculation Instructions Section 5-22
Example The following example shows a four-digit subtraction. When IR 00001 is ON,
the content of LR 00 and CY are subtracted from the content of IR 002 and
the result is written to HR 01.
CY is turned ON if the result is negative. If normal data is being used, a nega-
tive result (signed binary) must be converted to normal data using NEG(––).
Refer to 5-20-17 2’S COMPLEMENT – NEG(––) for details.
In the case below, the content of LR 00 (#7A03) and CY are subtracted from
IR 002 (#F8C5). Since the result is positive, CY is 0.
If the result had been negative, CY would have been set to 1. For normal
(unsigned) data, the result would have to be converted to its 2’s complement.
Note For signed binary calculations, the status of the UF and OF flags indicate
whether the result has exceeded the signed binary data range (–32,768
(8000) to +32,767 (7FFF)).
5-22-3 BINARY MULTIPLY – MLB(52)
Limitations DM 6143 to DM 6655 cannot be used for R.
MLB(52) cannot be used to multiply signed binary data, but MBS(––) can be
used. Refer to 5-22-7 SIGNED BINARY MULTIPLY – MBS(––).
CLC(41)
00001
SBB(51)
002
LR00
HR 01
Address Instruction Operands
00000 LD 00001
00001 OUT TR 1
00002 CLC(41)
00003 SBB(51)
002
LR 00
HR 01
Mi: IR 002
F8C5
Su: LR 00
7A 0 3
−
00 0 0
−
CY = 0
(from CLC(41))
R: HR 01
7E C 2
Md: Multiplicand word (binary)
IR, SR, AR, DM, EM, HR, TIM/CNT, LR, #
Mr: Multiplier word (binary)
IR, SR, AR, DM, EM, HR, TIM/CNT, LR, #
Ladder Symbols
Operand Data Areas
R: First result word
IR, SR, AR, DM, EM, HR, LR
MLB(52)
Md
Mr
R
@MLB(52)
Md
Mr
R