5-63
5 Understanding Programming
CJ2 CPU Unit Software User’s Manual
5-6 Instructions
5
5-6-1 Basic Understanding of Instructions
z Instruction Conditions
Instruction conditions are special conditions related to overall instruction execution that are output by
the following instructions. Instruction conditions have a higher priority than power flow (P.F.) when it
comes to deciding whether or not to execute an instruction. An instruction may not be executed or
may act differently depending on instruction conditions. Instruction conditions are reset (canceled) at
the start of each task, i.e., they are reset when the task changes.
The following instructions are used in pairs to set and cancel certain instruction conditions. These
paired instructions must be in the same task.
z Flags
In this context, a flag is a bit that serves as an interface between instructions.
Instruction
condition
Description Setting instruction
Canceling instruc-
tion
Interlocked An interlock turns OFF part of the program.
Special conditions, such as turning OFF output
bits, resetting timers, and holding counters are
in effect.
IL(002) ILC(003)
BREAK(514)
execution
Ends a FOR(512) - NEXT(513) loop during exe-
cution. (Prevents execution of all instructions
until to the NEXT(513) instruction.)
BREAK(514) NEXT(513)
Executes a JMP0(515) to JME0(516) jump. JMP0(515) JME0(516)
Block program
execution
Executes a program block from BPRG(096) to
BEND(801).
BPRG(096) BEND(801)
Input flags Output flags
Flag Description Flag Description
Carry (CY) Flag The Carry Flag is used as an
unspecified operand in data
shift instructions and addi-
tion/subtraction instructions.
Condition Flags Condition Flags include the Always
ON/OFF Flags, as well as flags that are
updated by results of instruction execu-
tion. In user programs, these flags can be
specified by labels, such as P_On, P_Off,
P_ER, P_CY, P_EQ rather than by
addresses.
Flags for Special
Instructions
These include teaching flags
for FPD(269) instructions and
network communications
enabled flags.
Flags for Special
Instructions
These include memory card instruction
flags and MSG(046) execution com-
pleted flags.