Function, Hint, 2 instructions – Omron SYSMAC CP CP1E-N@@D@-@ User Manual
Page 209

2-173
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Sym
bol
Math I
n
stru
ctio
ns
2
–B/–BL
Function
–B
–B(414) subtracts the BCD values in Su from Mi and outputs the result to R. If the result of the subtrac-
tion is negative, the result is output as a 10’s complement.
–BL
–BL(415) subtracts the BCD values in Su and Su+1 from Mi and Mi+1 and outputs the result to R, R+1.
If the result is negative, it is output to R, R+1 as a 10’s complement.
Hint
• 10’s Complement
A 10’s complement is the value obtained by subtracting each digit from 9 and adding one to the
result. For example, the 10’s complement for 7556 is calculated as follows: 9999 - 7556 + 1 = 2444.
For a four digit number, the 10's complement of A is 9999 – A + 1 = B. To obtain the true number from
the 10’s complement B: A = 10000 – B. For example, to obtain the true number from the 10’s comple-
ment 2444: 10000 – 2444 = 7556.
Example: 9,583,960 – 17,072,641 = -7,488,681. (BCD)
In this example, the eight-digit BCD content of CIO 121 and CIO 120 is subtracted from the content of
CIO 201 and CIO 200, and the result is output in eight-digit BCD to D101 and D100. The result is nega-
tive, so the instruction at (2) will be executed, and the true value will then be output to D101 and D100.
R
CY
(BCD)
(BCD)
(BCD)
Mi
Su
CY will turn ON
when there is a
borrow.
–
R+1
CY
R
(BCD)
(BCD)
(BCD)
Mi +1
Su+1
Mi
Su
CY will turn ON
when there is a
borrow.
0.00
(1)
P_CY
P_CY
(2)
RSET
21.00
SET
21.00
−BL
200
120
D100
−BL
#00000000
D100
D100
“
−”display