Bcd Subtract: Sub(071) - Omron SYSMAC CVM1 Series Operation Manual

Duplex system
Hide thumbs Also See for SYSMAC CVM1 Series:
Table of Contents

Advertisement

BCD Calculation Instructions
Example
0000
00

5-18-4 BCD SUBTRACT: SUB(071)

Ladder Symbol
(071)
SUB
Mi
Variations
j SUB(071)
Description
Precautions
Flags
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.
TR0
(070)
ADD
0200
0100
A500
04(CY)
(030)
MOV
#0001 D00101
A500
04(CY)
(030)
MOV
#0000 D00101
Although two ADD(070) can be used together to perform 8-digit BCD addition,
ADDL(074) is designed specifically for this purpose.
Su
R
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
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.
ER (A50003):
CY (A50004):
EQ (A50006):
(079)
CLC
D00100
Operand Data Areas
Mi: Minuend word
Su: Subtrahend word
R: Result word
Content of Mi or Su is not BCD.
Content of *DM word is not BCD when set for BCD.
The result is negative, i.e., when Mi is less than Su plus CY.
The result is 0.
Section 5-18
Address Instruction
00000
LD
00001
OUT
00002
CLC(079)
00003
ADD(070)
00004
AND
00005
MOV(030)
00006
LD
00007
AND NOT
00008
MOV(030)
CIO, G, A, T, C, #, DM, DR, IR
CIO, G, A, T, C, #, DM, DR, IR
CIO, G, A, DM, DR, IR
CY
R
Operands
000000
TR0
0200
0100
D00100
A50004
#0001
D00101
TR0
A50004
#0000
D00101
239

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac cv seriesSysmac cvm1d series

Table of Contents