Omron CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009 Reference Manual page 296

Programmable controllers
Hide thumbs Also See for CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009:
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 external inputs
specified in S
external input word specified in S
refreshing cannot be performed on inputs allocated to Group-2 High-density I/O Units or Units
mounted to Slave Racks.)
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
CS/CJ/NSJ Series Instructions Reference Manual (W474)
= S
or S
+ 1, S
1
2
1
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 for the
1
2
and/or S
1
CMPL
20.00
>
20.01
=
20.02
<
= S
+ 1, S
.
1
2
2
CMP
S1
S2
Arithmetic Flag
(Example: Equal Flag)
A
CMPL
S1
S2
Instruction B
A
and that refreshed value will be compared. (Immediate
2
i
S1+1=11CH
10
1 2 3 4
8
Comparison
S2+1=9CH
A B C D
3. Instructions
S1=10CH
Flag status
5 6 7 8
>
OFF (0)
Result
=
OFF (0)
<
S2=8CH
E F 1 2
3
ON (1)
259

Advertisement

Table of Contents
loading

Table of Contents