245
In the case below, 25,321 +(–13,253) = 12,068 (62E9 + CC3B = 2F24). Neither
OF nor UF are turned ON.
Au: LR 20
62E9
Ad: DM 0010
CC3B
+
Ad: DM 0010
2F24
Note The status of the CY flag can be ignored when adding signed binary data since it
is relevant only in the addition of normal hexadecimal values.
5-20-2 BINARY SUBTRACT – SBB(51)
Mi: Minuend word (binary)
IR, SR, AR, DM, HR, TC, LR, #
Su: Subtrahend word (binary)
IR, SR, AR, DM, HR, TC, LR, #
Ladder Symbols
Operand Data Areas
R: Result word
IR, SR, AR, DM, HR, LR
SBB(51)
Mi
Su
R
@SBB(51)
Mi
Su
R
Description When the execution condition is OFF, SBB(51) is not executed. When the
execution condition is ON, SBB(51) subtracts the contents of Su and CY from Mi
and places the result in R. If the result is negative, CY is set and the 2’s comple-
ment of the actual result is placed in R.
Mi – Su – CY CY R
SBB(51) can also be used to subtract signed binary data. The overflow and un-
derflow flags (SR 25404 and SR 25405) indicate whether the result has exceed-
ed the lower or upper limits of the 16-bit signed binary data range. Refer to page
27 for details on 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.)
CY: ON when the result is negative, i.e., when Mi is less than Su plus CY.
EQ: ON when the result is 0.
OF: ON when the result exceeds +32,767 (7FFF).
UF: ON when the result is below –32,768 (8000).
N: ON when bit 15 of the result is set to 1.
Binary Calculations Section 5-20