![background image](http://html1.mh-extra.com/html/omron/sysmac-c200hs/sysmac-c200hs_operation-manual_742436219.webp)
209
Note The actual SUB(31) operation involves subtracting Su and CY from 10,000 plus
Mi. For positive results the leftmost digit is truncated. For negative results the
10s complement is obtained. The procedure for establishing the correct answer
is given below.
First Subtraction
IR 010 1029
DM 0100
– 3452
CY
– 0
HR 20 7577
(1029 + (10000 – 3452))
CY
1 (negative
result)
Second Subtraction
0000
HR 20 –7577
CY
–0
HR 20 2423
(0000 + (10000 – 7577))
CY
1
(negative result)
In the above case, the program would turn ON HR 2100 to indicate that the value
held in HR 20 is negative.
5-19-8
DOUBLE BCD SUBTRACT – SUBL(55)
Mi: First minuend word (BCD)
IR, SR, AR, DM, HR, TC, LR
Su: First subtrahend word (BCD)
IR, SR, AR, DM, HR, TC, LR
Ladder Symbols
Operand Data Areas
R: First result word
IR, SR, AR, DM, HR, LR
SUBL(55)
Mi
Su
R
@SUBL(55)
Mi
Su
R
Limitations
Each of the following pairs must be in the same data area: Mi and Mi+1, Su and
Su+1, and R and R+1.
Description
When the execution condition is OFF, SUBL(55) is not executed. When the exe-
cution condition is ON, SUBL(55) subtracts CY and the 8-digit contents of Su
and Su+1 from the 8-digit value in Mi and Mi+1, and places the result in R and
R+1. 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. Since an 8-digit constant cannot be directly entered,
use the BSET(71) instruction (see 5-16-3 BLOCK SET – BSET(71)) to create an
8-digit constant.
Mi + 1
Mi
Su + 1
Su
R + 1
R
–
CY
CY
Note The DOUBLE 2’s COMPLEMENT – NEGL(––) instruction can be used to con-
vert binary data only, it cannot be used with BCD data.
BCD Calculations
Section 5-19
Содержание 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...