Binary Calculations; Binary Add - Adb(50) - Omron C200H Operation Manual

Hide thumbs Also See for C200H:
Table of Contents

Advertisement

Binary Calculations

5-18

Binary Calculations

5-18-1
BINARY ADD – ADB(50)
Description
Flags
Examples
TR 0
00000
25504
25504
The binary calculation instructions - ADB(50), SBB(51), MLB(52) and
DVB(53) - all perform arithmetic operations on hexadecimal 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
calculation, 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-17 BCD Calculations.
Ladder Symbols
ADB(50)
@ADB(50)
Au
Ad
R
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
Indirectly addressed DM word is non-existent. (Content of *DM word
ER:
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.
The following example shows a four-digit addition with CY used to place ei-
ther #0000 or #0001 into R+1 to ensure that any carry is preserved.
CLC(41)
ADB(50)
DM 0100
HR 10
MOV(21)
#0000
HR 11
MOV(21)
#0001
HR 11
IR, SR, AR, DM, HR, TC, LR, #
Au
IR, SR, AR, DM, HR, TC, LR, #
Ad
R
CY
R
Address Instruction
00000
00001
00002
00003
010
= R
00004
00005
= R+1
00006
00007
00008
= R+1
Section 5-18
Operand Data Areas
Au: Augend word (binary)
Ad: Addend word (binary)
R: Result word
IR, AR, DM, HR, LR
Operands
LD
00000
OUT
TR
CLC(41)
ADB(50)
DM
0100
HR
AND NOT
25504
MOV(21)
#
0000
HR
LD
TR
AND
25504
MOV(21)
#
00001
HR
0
010
10
11
0
11
179

Advertisement

Table of Contents
loading

Table of Contents