Omron SYSMAC CP Series Instruction & Reference Manual page 209

Cpu unit
Hide thumbs Also See for SYSMAC CP Series:
Table of Contents

Advertisement

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.
CP1E CPU Unit Instructions Reference Manual(W483)
CY will turn ON
CY
when there is a
borrow.
Mi +1
Su+1
CY will turn ON
R+1
CY
when there is a
borrow.
0.00
P_CY
P_CY
Mi
(BCD)
Su
(BCD)
R
(BCD)
Mi
(BCD)
Su
(BCD)
R
(BCD)
RSET
21.00
−BL
(1)
200
120
D100
−BL
(2)
#00000000
D100
D100
SET
"−"display
21.00
2 Instructions
2
2-173

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents