![Omron CVM1D Operation Manual Download Page 244](http://html1.mh-extra.com/html/omron/cvm1d/cvm1d_operation-manual_742532244.webp)
239
When CIO 000000 is ON in the following example, CY is cleared by CLC(079),
the content of CIO 0200 is added to the contents of CIO 0100 and the status of
CY, the results is placed in D00100, and then either all zeros or 0001 is moved
into D00101 depending on the status of CY (A50004). This ensures that any
carry from the last digit is preserved in R+1 so that the entire result can be later
handled as 8-digit data.
00000
LD
000000
00001
OUT
TR0
00002
CLC(079)
00003
ADD(070)
0200
0100
D00100
00004
AND
A50004
00005
MOV(030)
#0001
D00101
00006
LD
TR0
00007
AND NOT
A50004
00008
MOV(030)
#0000
D00101
(070)
ADD
0200
0100
D00100
(030)
MOV
#0001 D00101
(030)
MOV
#0000 D00101
(079)
CLC
0000
00
A500
04(CY)
A500
04(CY)
TR0
Address Instruction
Operands
Although two ADD(070) can be used together to perform 8-digit BCD addition,
ADDL(074) is designed specifically for this purpose.
5-18-4 BCD SUBTRACT: SUB(071)
Variations
j
SUB(071)
(071)
SUB
Mi
Su
R
Operand Data Areas
Ladder Symbol
Mi: Minuend word
CIO, G, A, T, C, #, DM, DR, IR
R: Result word
CIO, G, A, DM, DR, IR
Su: Subtrahend word
CIO, G, A, T, C, #, DM, DR, IR
When the execution condition is OFF, SUB(071) is not executed. When the
execution condition is ON, SUB(071) 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 10’s com-
plement of the actual result is placed in R. To convert the 10’s complement to the
true result, subtract the content of R from zero (see example below).
Mi – Su – CY
CY
R
Note An equivalent symbol math instruction (–BC(416)) is also available.
Mi and Su must be BCD.
Note Refer to page 101 for general precautions on operand data areas.
Flags
ER (A50003):
Content of Mi or Su is not BCD.
Content of *DM word is not BCD when set for BCD.
CY (A50004):
The result is negative, i.e., when Mi is less than Su plus CY.
EQ (A50006):
The result is 0.
Example
Description
Precautions
BCD Calculation Instructions
Section 5-18
Summary of Contents for CVM1D
Page 462: ...SYSMAC CVM1D Duplex System Programmable Controllers Operation Manual Revised August 2001...
Page 463: ...iv...
Page 465: ...vi...