EasyManuals Logo

Omron SYSMAC C20P User Manual

Omron SYSMAC C20P
211 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #100 background imageLoading...
Page #100 background image
92
If a carry is generated, SR 1904 (CY) is turned ON and the constant 0001 is
transferred to DM 06. If a carry is not generated SR 1904 remains OFF and
the constant 0000 is transferred to DM 06.
5–16–2 BCD Subtract – SUB(31)
Mi : Minuend word (BCD)
IR, SR, DM, HR, TC, #
Su : Subtrahend word (BCD)
IR, SR, DM, HR, TC, #
Ladder Symbol
Operand Data Areas
R : Result word
IR, DM, HR
SUB(31)
Mi
Su
R
When the execution condition is OFF, SUB(31) is not executed and the next
instruction is moved to. When the execution condition is ON, SUB(31) sub-
tracts 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 complement 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).. This instruction will be ex-
ecuted every scan as long as the execution condition remains ON. If the in-
struction is to be executed only once then it must be used in conjunction with
DIFU(13) or DIFD(14).
Mi – Su – CY CY R
ER: Mi and/or Su is not BCD.
CY: ON when the result is negative, i.e., when Mi is less than Su plus CY.
EQ: ON when the result is 0.
Be sure to clear the Carry Flag (CY) with CLC(41) before executing SUB(31)
if its previous status is not required, and check the status of CY after doing a
subtraction with SUB(31). If CY is ON as a result of executing SUB(31) (i.e.,
if the result is negative), the result is output as the 10’s complement of the
true answer. To convert the output result to the true value, subtract the value
in R from 0.
When 0002 is ON, the following diagram clears CY, subtracts the contents of
DM 01 and CY from the content of IR 10 and places the result in HR 2.
If CY is set by executing SUB(31), the result in HR 2 is subtracted from zero
(note that CLC(41) is again required to obtain an accurate result), the result
is placed back in HR 2, and HR 300 is turned ON to indicate a negative re-
sult.
If CY is not set by executing SUB(31), the result is positive, the second sub-
traction is not performed and HR 300 is not turned ON. HR 300 is pro-
grammed as a self-maintaining bit so that a change in the status of CY will
not turn it OFF when the program is rescanned.
Description
Flags
Caution
Example
BCD Calculations Section 5–16

Table of Contents

Other manuals for Omron SYSMAC C20P

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Omron SYSMAC C20P and is the answer not in the manual?

Omron SYSMAC C20P Specifications

General IconGeneral
BrandOmron
ModelSYSMAC C20P
CategoryController
LanguageEnglish

Related product manuals