Precautions; Condition Flags - Omron CJ2 CPU - REV 10-2010 User Manual

Cj2 cpu unit software
Table of Contents

Advertisement

5-10 Precautions

5-10-1 Condition Flags

Using Condition Flags
Conditions flags are shared by all instructions, and will change during a cycle depending on results of
executing individual instructions. Therefore, be sure to use Condition Flags on a branched output with
the same execution condition immediately after an instruction to reflect the results of instruction execu-
tion. Never connect a Condition Flag directly to the bus bar because this will cause it to reflect execution
results for other instructions.
Example: Using Instruction A Execution Results
Mnemonic
Correct Use
Condition Flag
P_EQ (Equals Flag)
The same execution condition (a) is used for instructions A and B to execute instruction B based on the
execution results of instruction A. In this case, instruction B will be executed according to the Condition
Flag only if instruction A is executed.
Incorrect Use
Condition Flag
P_EQ (Equals Flag)
If the Condition Flag is connected directly to the left bus bar, instruction B will be executed based on the
execution results of a previous rung if instruction A is not executed.
When interrupt tasks are being used, an interrupt task will operate when its start conditions are met,
even during execution of a cyclic task. In this case, the Condition Flags are returned to their original sta-
tus when processing switches back from the interrupt task to the cyclic task, even if those flags were
turned ON/OFF in the interrupt task.
CJ2 CPU Unit Software User's Manual
Instruction A
Reflects instruction A
execution results.
Instruction B
Preceding rung
Instruction A
Reflects the execution results of
the preceding rung if instruction
A is not executed.
Instruction B
5 Understanding Programming
5
5-105

Advertisement

Table of Contents
loading

Table of Contents