Omron CJ - 08-2008 Operation Manual page 485

Programmable controllers
Table of Contents

Advertisement

Condition Flags
Name
Less Than or
P_LE
Equals Flag
Always ON Flag
P_On
Always OFF Flag
P_Off
Using the Condition Flags
Condition Flag
Example: P_EQ
Saving and Loading Condition Flag Status
Symbol
Label
< =
Turned ON when the first operand of a Comparison Instruction is less
than or equal to the second.
ON
Always ON. (Always 1.)
OFF
Always OFF. (Always 0.)
The Condition Flags are shared by all of the instructions, so their status may
change often in a single cycle. Be sure to read the Condition Flags immedi-
ately after the execution of instruction, preferably in a branch from the same
execution condition.
Instruction A
The result from instruction A is
reflected in the Equals Flag.
Instruction B
Since the Condition Flags are shared by all of the instructions, program oper-
ation can be changed from its expected course by interruption of a single task.
Be sure to consider the effects of interrupts when writing the program. Refer
to SECTION 2 Programming of CS/CJ Series Programming Manual (W394)
for more details.
The Condition Flags are cleared when the program switches tasks, so the sta-
tus of a Condition Flag cannot be passed to another task. For example the
status of a flag in task 1 cannot be read in task 2.
The Condition Flag status instructions (CCS(282) and CCL(283)) can be used
to save and load the status of the Condition Flags between different locations
within a task (program) or between different tasks or cycles.
The following example shows how the Equals Flag is used at a different loca-
tion in the same task.
Task
Instruction A
P_EQ
Note This instruction does not exist in CJ1 CPU Units.
Stores result of comparison in the Condition Flags.
CMP
This will enable loading the results to use with
Instruction B.
CCS
Saves status of Condition Flags.
Loads the statuses of the Conditions Flags that
CCL
were stored.
The result of the comparison instruction in the
Instruction B
Equals Flag can be used by Instruction B without
interference from Instruction A.
Section 9-20
Function
Instruction
Operand
LD
Instruction A
=
AND
Instruction B
437

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents