Omron CP1E-E@@D@-@ Computer Hardware User Manual


 
2 Instructions
2-100
CP1E CPU Unit Instructions Reference Manual(W483)
Precautions
When CPS(114)/CPSL(115) is executed, the result is reflected in the Arithmetic Flags. Control the
desired output or right-hand instruction with a branch from the same input condition that controls
CPS(114)/CPSL(115), as shown in the following diagram.
Do not program another instruction between CPS(114)/CPSL(115) and the instruction controlled by
the Arithmetic Flag because the other instruction might change the status of the Arithmetic Flag.
The immediate-refreshing variation (!CPS(114)/!CPSL(115)) can be used with words allocated to
CPU Unit built-in inputs specified in S
1
and/or S
2
. When !CPS(114)/!CPSL(115) is executed, input
refreshing will be performed for the external input word specified in S
1
and/or S
2
and that refreshed
value will be compared.
Sample program
When CIO 0.00 is ON in the following example, the eight-digit signed binary data in D2 and D1 is com-
pared to the eight-digit signed binary data in D6 and D5 and the result is output to the Arithmetic Flags.
If the content of D2 and D1 is greater than that of D6 and D5, the Greater Than Flag will be turned
ON, causing CIO 20.00 to be turned ON.
If the content of D2 and D1 is equal to that of D6 and D5, the Equals Flag will be turned ON, causing
CIO 20.01 to be turned ON.
If the content of D2 and D1 is less than that of D6 and D5, the Less Than Flag will be turned ON,
causing CIO 20.02 to be turned ON.
i
CPS/CPSL
S1
S2
A
Arithmetic Flag
(Example: Equal Flag)
In this case, the Equals Flag and output A will be turned
ON when S
1
= S
2
or S
1
+1, S
1
= S
2
+1, S
2
.
CPS/CPSL
S1
S2
A
Instruction B
Arithmetic Flag
(Example: Equal Flag)
In this case, the results of instruction B might
change the results of CPS(114)/CPSL(115).
CPSL
D1
D5
20.00
0.00
>
20.01
=
20.02
<
D2
1234
D1
5678
> ON (1)
= OFF (0)
< OFF (0)
D6
ABCD
D5
EF12
Result
Comparison
Flag status