328
Binary Calculation Instructions
Section 5-22
5-22 Binary Calculation Instructions
5-22-1 BINARY ADD – ADB(50)
Limitations
DM 6144 to DM 6655 cannot be used for R.
Description
When the execution condition is OFF, ADB(50) is not executed. When the exe-
cution 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.
ADB(50) can also be used to add signed binary data. The Overflow and
Underflow 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.
Flags
ER:
Indirectly addressed EM/DM word is non-existent.
(Content of
*
EM/
*
DM word is not BCD, or the EM/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 e32,767 (7FFF).
UF:
ON when the result is below –32,768 (8000).
Example
The following example shows a four-digit addition with CY used to place either
#0000 or #0001 into R+1 to ensure that any carry is preserved.
Au
:
Augend word (binary)
IR, SR, AR, DM, EM, HR, TIM/CNT, LR, #
Ad
:
Addend word (binary)
IR, SR, AR, DM, EM, HR, TIM/CNT, LR, #
Ladder Symbols
Operand Data Areas
R
:
Result word
IR, SR, AR, DM, EM, HR, LR
ADB(50)
Au
Ad
R
@ADB(50)
Au
Ad
R
Au + Ad + CY
CY
R
CLC(41)
00000
ADB(50)
010
DM 0100
HR 10
MOV(21)
#0000
HR 11
MOV(21)
#0001
HR 11
TR 0
25504
25504
= R
= R+1
= R+1
Address Instruction
Operands
00000
LD
00000
00001
OUT
TR
0
00002
CLC(41)
00003
ADB(50)
010
DM
0100
HR
10
00004
AND NOT
25504
00005
MOV(21)
#
0000
HR
11
00006
LD
TR
0
00007
AND
25504
00008
MOV(21)
#
00001
HR
11