Omron SYSMAC CP Series Instruction & Reference Manual page 210

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

Advertisement

2 Instructions
Subtraction at (1)
Mi+1: CIO 201
0
9
5
8
Su+1: CIO 121
1
7
0
7
09583960+(100000000-17072641)
CY
R+1: D101
1
9
2
5
1
Subtraction at (2)
0
0
0
Su+1: D101
9
2
5
00000000+(100000000-92511319)
CY
R+1: D101
1
0
7
4
Final Subtraction Result
Mi+1: CIO 201
0
9
5
8
Su+1: D101
1
7
0
7
CY
R+1: D101
1
0
7
4
8
Sample program
0.00
0.00
If the result of the subtraction is a negative number (Mi<Su or Mi+1, Mi <Su+1, Su), the result is output
as a 10's complement. The Carry Flag (CY) will turn ON. To convert the 10's complement to the true
number, a program which subtracts the result from 0 is necessary, as an input condition of the Carry
Flag (CY). The Carry Flag turning ON thus indicates that the result of the subtraction is negative.
2-174
S1: CIO 200
3
9
6
0
S2: CIO 120
2
6
4
1
R+1: D100
The Carry Flag (CY) is ON, so the result is subtracted from 0000 0000.
1
3
1
9
0
0
0
0
0
Su: D100
1
1
3
1
9
R+1: D100
8
8
6
8
1
Mi: CIO 200
3
9
6
0
Su: D100
2
6
4
1
The Carry Flag (CY) will be turned ON, so the actual number is
– 7,488,681. Because the content of D101 and D100 is negative, CY is
R+1: D100
used to turn ON CIO 21.00 to indicate this.
8
6
8
1
−B
When CIO 0.00 is ON in the following example, D110 is subtracted from
D100 as 4-digit BCD values, and the result will be output to D120.
D100
D110
D120
−BL
When CIO 0.00 is ON in the following example, D111 and D110 will be
subtracted from D101 and D100 as 8-digit BCD values, and the result will
D100
be output to D121 and D120.
D110
D120
CP1E CPU Unit Instructions Reference Manual(W483)

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents