Omron SYSMAC CP Series Instruction & Reference Manual page 133

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

Advertisement

Precautions
• Using CMP(020)Results in the Program
When CMP(020)/CMPL(060) 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
CMP(020)/CMPL(060), as shown in the following diagram. In this case, the Equals Flag and output A
will be turned ON when S
• Using CMP(020) Results in the Program
Do not program another instruction between CMP(020)/CMPL(060) and the instruction controlled by
the Arithmetic Flag because the other instruction might change the status of the Arithmetic Flag.
• The immediate-refreshing variation (!CMP(020)) can be used with words allocated to CPU Unit built-
in inputs specified in S
for the external input word specified in S
Sample program
• When CIO 0.00 is ON in the following example, the eight-digit unsigned binary data in CIO 0011 and
CIO 0010 is compared to the eight-digit unsigned binary data in CIO 0009 and CIO 0008 and the
result is output to the Arithmetic Flags. The results recorded in the Greater Than, Equals, and Less
Than Flags are immediately saved to CIO 20.00 (Greater Than), CIO 20.01 (Equals), and CIO 20.02
(Less Than).
0.00
CP1E CPU Unit Instructions Reference Manual(W483)
= S
or S
+ 1, S
= S
1
2
1
1
Arithmetic Flag
(Example: Equal Flag)
Arithmetic Flag
(Example: Equal Flag)
In this case, the results of instruction B might
change the results of CMP(020).
and/or S
. When !CMP(020) is executed, input refreshing will be performed
1
2
and/or S
1
i
CMPL
10
8
20.00
>
20.01
=
20.02
<
+ 1, S
.
2
2
CMP
S1
S2
A
CMPL
S1
S2
Instruction B
A
and that refreshed value will be compared.
2
S1+1=11CH
S1=10CH
1 2 3 4
5 6 7 8
Comparison
S2+1=9CH
S2=8CH
A B C D
E F 1 2
2 Instructions
Flag status
>
OFF (0)
Result
=
OFF (0)
<
ON (1)
2-97
2

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents