![background image](http://html1.mh-extra.com/html/omron/sysmac-c200hs/sysmac-c200hs_operation-manual_742436230.webp)
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.
CLC(41)
00000
ADB(50)
010
DM 0100
HR 10
MOV(21)
#0000
HR 11
MOV(21)
#0001
HR 11
TR 0
25504
25504
= R
= R+1
= R+1
Address
Instruction
Operands
00000
LD
00000
00001
OUT
TR
0
00002
CLC(41)
00003
ADB(50)
010
DM
0100
HR
10
00004
AND NOT
25504
00005
MOV(21)
#
0000
HR
11
00006
LD
TR
0
00007
AND
25504
00008
MOV(21)
#
00001
HR
11
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.
R+1: HR 11
R: HR 10
0
0
0
1
2
7
A
7
Au: IR 010
A
6
E
2
Ad: DM 0100
8
0
C
5
+
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).
CLC(41)
00000
ADB(50)
LR 20
DM 0010
DM 0020
Address
Instruction
Operands
00000
LD
00000
00001
CLC(41)
00002
ADB(50)
LR
20
DM
0010
DM
0020
Example 1:
Adding Normal Data
Example 2:
Adding Signed Binary Data
Binary Calculations
Section 5-20
Содержание SYSMAC C200HS
Страница 1: ...Cat No W235 E1 05 C200HS SYSMAC Programmable Controllers...
Страница 2: ...C200HS Programmable Controllers Operation Manual Revised February 2002...
Страница 3: ...iv...
Страница 5: ...vi...
Страница 379: ...371 SR word Corresponding key s Bit 279 03 04 05 3 06 07 VER 08 09 Monitoring Operation and Modifying Data Section 7 1...
Страница 470: ...468 Programmer Program Date Page Word Contents Notes Word Contents Notes Data Storage...
Страница 471: ...469 Programmer Program Date Page TC address T or C Set value Notes TC address T or C Set value Notes Timers and Counters...