Omron SYSMAC CS Series Instruction & Reference Manual page 317

Hide thumbs Also See for SYSMAC CS Series:
Table of Contents

Advertisement

Subtraction at (1)
Mi+1: CIO 201
0
9
5
Su+1: CIO 121
1
7
0
09583960+(100000000-17072641)
CY
R+1: D101
1
9
2
5
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
Su+1: D101
1
7
0
CY
R+1: D101
1
0
7
4
Example Programming
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.
CS/CJ/NSJ Series Instructions Reference Manual (W474)
S1: CIO 200
8
3
9
6
0
S2: CIO 120
7
2
6
4
1
R+1: D100
The Carry Flag (CY) is ON, so the result is subtracted from 0000 0000.
1
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
8
3
9
6
0
Su: D100
7
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
8
6
8
1
When CIO 0.00 is ON in the following example, D110 is subtracted from
-B
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
3. Instructions
3
283

Advertisement

Table of Contents
loading

Table of Contents