Omron SYSMAC C200HS Operation Manual page 232

Programmable controllers
Hide thumbs Also See for SYSMAC C200HS:
Table of Contents

Advertisement

Binary Calculations
Example 1: Normal Data
TR 1
00001
25504
25504
222
The following example shows a four-digit subtraction with CY used to place ei-
ther #0000 or #0001 into R+1 to ensure that any carry is preserved.
In the case below, the content of LR 20 (#7A03) and CY are subtracted from
IR 001 (#F8C5). The result is stored in HR 21 and the content of HR 22 (#0000)
indicates that the result is positive.
If the result had been negative, CY would have been set, #0001 would have
been placed in HR 22, and the result would have been converted to its 2's com-
pliment.
R+1: HR 22
0
0
Note The status of the UF and OF flags can be ignored since they are relevant only in
the subtraction of signed binary data.
Address Instruction
00000
CLC(41)
00001
00002
SBB(51)
00003
001
LR20
HR 21
= R
00004
MOV(21)
00005
#0000
HR 22
= R+1
00006
MOV(21)
00007
#0001
00008
HR 22
= R+1
NEG(––)
HR21
00009
HR 21
Mi: IR 001
F
8
C
5
Su: LR 20
7
A
0
3
0
0
0
0
R: HR 21
0
0
7
E
C
2
Section 5-20
Operands
LD
00001
OUT
TR
CLC(41)
SBB(51)
LR
HR
AND NOT
25504
MOV(21)
#
HR
LD
TR
AND
25504
MOV(21)
#
HR
NEG(––)
HR
HR
CY = 0
(from CLC(41))
1
001
20
21
0000
22
1
0001
22
21
21

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents