Omron CJ - REFERENCE MANUAL 02-2010 Reference Manual page 395

Table of Contents

Advertisement

Subtraction at (1)
Mi+1: CIO 201
2
0
Su+1: CIO 121
B
8
A
CY
R+1: D101
1
6
8
Subtraction at (2)
0
0
Su+1: D101
6
8
CY
R+1: D101
1
9
7 A E
Final Subtraction Result
Mi+1: CIO 201
2
0 F 5
Su+1: D101
6
8
CY
R+1: D101
1
9
7 A E
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 the 2's complement and the Carry Flag (CY) will turn ON to indicate that the result of the subtraction
is negative. To convert the 2's complement to the true number, an instruction which subtracts the result
from 0 is necessary using the Carry Flag (CY) as an execution condition.
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Mi: CIO 200
F
5
5
A
1
0
Su: CIO 120
3
6
0
E
3
R+1: D100
The Carry Flag (CY) is ON, so the result is subtracted from 0000 0000 to
5
1
F 9
2 D
obtain the actual number.
0
0
0
0
0
0
Su: D100
5
1
F 9
2 D
R+1: D100
0
6 D 3
Mi: CIO 200
5 A 1
0
Su: D100
5
1
F 9
2 D
The Carry Flag (CY) is turned ON, so the actual number is –97AE06D3.
Because the content of D101 and D100 is negative, CY is used to turn
R+1: D100
ON CIO 21.00 to indicate this.
0
6 D 3
When CIO 0.00 is ON in the following example, D110 will be
subtracted from D100 as 4-digit signed binary values and the
D100
result will be output to D120.
D110
D120
L
When CIO 0.00 is ON in the following example, D111 and D110
will be subtracted from D101 and D100 as 8-digit signed binary
D100
values and the result will be output to D121 and D120.
D110
D120
3. Instructions
3
359

Advertisement

Table of Contents
loading

Table of Contents