Omron CJ2 - 02-2010 User Manual page 195

Cj2 cpu unit software
Table of Contents

Advertisement

The Equals Flag will turn ON if D100 in the rung above contains #0010. #0200 will be moved to
D200 for instruction (1), but then the Equals Flag will be turned OFF because the #0200 source data
is not 0000 Hex. The MOV instruction at (2) will then be executed and #0300 will be moved to D300.
A rung will therefore have to be inserted as shown below to prevent execution results for the first
MOV instruction from being picked up.
Using Execution Results from Differentiated Instructions
With differentiated instructions, execution results for instructions are reflected in Condition Flags
only when execution condition is met, and results for a previous rung (rather than execution results
for the differentiated instruction) will be reflected in Condition Flags in the next cycle. You must there-
fore be aware of what Condition Flags will do in the next cycle if execution results for differentiated
instructions to be used.
In the following for example, instructions A and B will execute only if execution condition C is met, but
the following problem will occur when instruction B picks up execution results from instruction A. If
execution condition C remains ON in the next cycle after instruction A was executed, then instruction
B will unexpectedly execute (by the execution condition) when the Condition Flag goes from OFF to
ON because of results reflected from a previous rung.
Previous rung
CJ2 CPU Unit Software User's Manual
P_EQ
A
A
C
@Instruction A
Condition Flag
P_EQ (Equals Flag)
@Instruction B
5 Understanding Programming
CMP
#0010
D100
Reflects CMP execution results.
A
MOV
#0200
D200
MOV
#0300
D300
Reflects execution results for instruction A
when execution condition is met.
Reflects execution results for a previous
rung in the next cycle.
5
5-105

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents