EasyManuals Logo
Home>Omron>Controller>CPM1

Omron CPM1 Programming Manual

Omron CPM1
541 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 #319 background imageLoading...
Page #319 background image
298
Binary Calculation Instructions Section 5-21
and places the result in R. If the result is negative, CY is set and the 2’s com-
plement of the actual result is placed in R.
SBB(51) can also be used to subtract signed binary data. With CQM1-
CPU4@-EV1, CPM1A, and SRM1, the underflow and overflow 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 DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
CY: ON when the result is negative, i.e., when Mi is less than Su plus CY.
EQ: ON when the result is 0.
OF: ON when the result exceeds +32,767 (7FFF).
(CQM1-CPU4@-EV1 only)
UF: ON when the result is below –32,768 (8000).
(CQM1-CPU4@-EV1 only)
Example The following example shows a four-digit subtraction. When IR 00001 is ON,
the content of LR 00 and CY are subtracted from the content of IR 002 and
the result is written to HR 01.
CY is turned ON if the result is negative. If normal data is being used, a nega-
tive result (signed binary) must be converted to normal data using NEG(––).
Refer to 5-19-17 2’S COMPLEMENT – NEG(––) for details.
In the case below, the content of LR 00 (#7A03) and CY are subtracted from
IR 002 (#F8C5). Since the result is positive, CY is 0.
If the result had been negative, CY would have been set to 1. For normal
(unsigned) data, the result would have to be converted to its 2’s complement.
Note For signed binary calculations, the status of the UF and OF flags indicate
whether the result has exceeded the signed binary data range (–32,768
(8000) to +32,767 (7FFF)). (CQM1-CPU4@-EV1 only)
Mi – Su – CY CY R
CLC(41)
00001
SBB(51)
002
LR00
HR 01
Address Instruction Operands
00000 LD 00001
00001 OUT TR 1
00002 CLC(41)
00003 SBB(51)
002
LR 00
HR 01
Mi: IR 002
F8 C5
Su: LR 00
7A 0 3
–
00 00
–
CY = 0
(from CLC(41))
R: HR 01
7E C2

Table of Contents

Other manuals for Omron CPM1

Questions and Answers:

Question and Answer IconNeed help?

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

Omron CPM1 Specifications

General IconGeneral
BrandOmron
ModelCPM1
CategoryController
LanguageEnglish

Related product manuals