Omron C200HE Computer Hardware User Manual


 
243
5-20 Binary Calculations
Binary calculation instructions ADB(50), SBB(51), MLB(52), DVB(53),
ADBL(––), SBBL(––), MBS(––), MBSL(––), DBS(––), and DBSL(––) perform
arithmetic operations on hexadecimal data.
Four of these instructions (ADB(50), SBB(51), ADBL(––), and SBBL(––)) can
act on both normal and signed data, two (MLB(52) and DVB(53)) act only on nor-
mal data, and four (MBS(––), MBSL(––), DBS(––), and DBSL(––)) act only on
signed binary data.
The addition and subtraction instructions include CY in the calculation as well as
in the result. Be sure to clear CY if its previous status is not required in the cal-
culation, and to use the result placed in CY, if required, before it is changed by the
execution of any other instruction. STC(40) and CLC(41) can be used to control
CY. Refer to 5-19 BCD Calculations.
Signed binary addition and subtraction instructions use the underflow and over-
flow flags (UF and OF) to indicate whether the result exceeds the acceptable
range for 16-bit or 32-bit signed binary data. Refer to page 27 for details on
signed binary data.
5-20-1 BINARY ADD ADB(50)
Au: Augend word (binary)
IR, SR, AR, DM, HR, TC, LR, #
Ad: Addend word (binary)
IR, SR, AR, DM, HR, TC, LR, #
Ladder Symbols
Operand Data Areas
R: Result word
IR, SR, AR, DM, HR, LR
ADB(50)
Au
Ad
R
@ADB(50)
Au
Ad
R
Description When the execution condition is OFF, ADB(50) is not executed. When the
execution condition is ON, ADB(50) adds the contents of Au, Ad, and CY, and
places the result in R. CY will be set if the result is greater than FFFF.
Au + Ad + CY CY R
ADB(50) can also be used to add signed binary data. The overflow and under-
flow flags (SR 25404 and SR 25405) indicate whether the result has exceeded
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 greater than FFFF.
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