Omron CPM1 - PROGRAMING MANUAL 02-2001 Programming Manual page 481

Hide thumbs Also See for CPM1 - PROGRAMING MANUAL 02-2001:
Table of Contents

Advertisement

BCD Calculation Instructions
Description
Flags
Example
00000
When the execution condition is OFF, ADDL(54) is not executed. When the
execution condition is ON, ADDL(54) adds the contents of CY to the 8-digit val-
ue in Au and Au+1 to the 8-digit value in Ad and Ad+1, and places the result in R
and R+1. CY will be set if the result is greater than 99999999.
ER:
Au and/or Ad is not BCD.
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 there is a carry in the result.
EQ:
ON when the result is 0.
When 00000 is ON, the following program section adds two 12-digit numbers,
the first contained in LR 00 through LR 02 and the second in DM 0010 through
DM 0012. The result is placed in HR 10 through HR 13.
The rightmost 8 digits of the two numbers are added using ADDL(54), i.e., the
contents of LR 00 and LR 01 are added to DM 0010 and DM 0011 and the results
is placed in HR 10 and HR 11. The second addition adds the leftmost 4 digits of
each number using ADD(30), and includes any carry from the first addition. The
last instruction, ADB(50) (see 7-22-1 BINARY ADD – ADB(50)) adds two all-
zero constants to place any carry from the second addition into HR 13.
CLC(41)
@ADDL(54)
DM 0010
@ADD(30)
DM 0012
@ADB(50)
Au + 1
Au
Ad + 1
Ad
+
CY
CY
R + 1
R
Address Instruction
00000
LD
00001
CLC(41)
00002
@ADDL(54)
LR 00
HR 10
00003
@ADD(30)
LR 02
HR 12
00004
@ADB(50)
#0000
#0000
HR 13
Section
7-21
Operands
00000
LR
00
DM
0010
HR
10
LR
02
DM
0012
HR
12
#
0000
#
0000
HR
13
463

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents