Binary Calculations - Omron SYSMAC C200HS Operation Manual

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

Advertisement

Binary Calculations

Example 1:
Adding Normal Data
TR 0
00000
25504
25504
Example 2:
Adding Signed Binary Data
00000
220
The following example shows a four-digit addition with CY used to place either
#0000 or #0001 into R+1 to ensure that any carry is preserved.
In the case below, A6E2 + 80C5 = 127A7. The result is a 5-digit number, so CY
(SR 25504) = 1, and the content of R + 1 becomes #0001.
Note The UF and OF flags would also be turned ON during this addition, but they can
be ignored since they are relevant only in the addition of signed binary data.
In the following example, ADB(50) is used to add two 16-bit signed binary val-
ues. (The 2's complement is used to express negative values.)
The effective range for 16-bit signed binary values is –32,767 (8000) to +32,768
(7FFF). The overflow flag (OF: SR 25404) is turned ON if the result exceeds
+32,768 (7FFF) and the underflow flag (UF: SR 25405) is turned ON if the result
falls below –32,767 (8000).
Address Instruction
00000
CLC(41)
00001
00002
ADB(50)
00003
010
DM 0100
HR 10
= R
00004
MOV(21)
00005
#0000
HR 11
= R+1
00006
MOV(21)
00007
#0001
00008
HR 11
= R+1
Au: IR 010
A
6
Ad: DM 0100
+
8
0
R+1: HR 11
R: HR 10
0
0
0
1
2
7
Address Instruction
CLC(41)
00000
00001
ADB(50)
00002
LR 20
DM 0010
DM 0020
Section 5-20
Operands
LD
00000
OUT
TR
CLC(41)
ADB(50)
DM
0100
HR
AND NOT
25504
MOV(21)
#
0000
HR
LD
TR
AND
25504
MOV(21)
#
00001
HR
E
2
C
5
A
7
Operands
LD
00000
CLC(41)
ADB(50)
LR
DM
0010
DM
0020
0
010
10
11
0
11
20

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents