281
Programming Appendix A
Programming Precautions
Condition Flags
Using Condition Flags
Condition 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 input
condition immediately after an instruction to reflect the results of instruction execution. Never connect a Condi-
tion Flag directly to the bus bar because this will cause it to reflect execution results for other instructions.
Example: Using Instruction A Execution Results
The same input 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 when
instruction A is executed.
If the Condition Flag is connected directly to the left bus bar, instruction B will be executed based on the execu-
tion results of a previous rung if instruction A is not executed.
Note Condition Flags are used by all instruction within a single program (task) but they are cleared when the
task switches. Therefore execution results in the preceding task will not be reflected later tasks.
a
Correct Use
Instruction A
Instruction B
Condition Flag
Example: =
Reflects instruction A
execution results.
LD a
AN
D =
Instruction Operand
Mnemonic
Instruction A
Instruction B
Instruction B
Instruction A
Incorrect Use
Preceding rung
Condition Flag
Example: =
Reflects the execution results of
the preceding rung if instruction
A is not executed.