Omron SYSMAC CJ - REFERENCE MANUAL 01-2008 Reference Manual page 1238

Sysmac cs/cj/one nsj series programmable controllers
Table of Contents

Advertisement

Block Programming Instructions
Flags
Precautions
Nesting Branches
Examples
Name
Label
Error Flag
ER
Instructions in block programs are generally executed unconditionally. Branch-
ing, however, can be used to create conditional execution based on execution
conditions or operand bits.
Use IF A ELSE B IEND to branch between A and B.
Use IF A IEND to branch between A and doing nothing.
Branches can be nested to up to 253 levels.
A error will occur and the Error Flag will turn ON if the branch instructions are
not in a block program or if more than 254 branches are nested.
Up to 253 branches can be nested within the top level branch.
The following example shows two different block programs controlled by
CIO 000000 and CIO 000002.
The first block executes one of two additions depending on the status of
CIO 000001. This block is executed when CIO 000000 is ON. If CIO 000001
is ON, 0001 is added to the contents of CIO 0001. If CIO 000001 is OFF, 0002
is added to the contents of CIO 0001. In either case, the result is placed in
D00000.
The second block is executed when CIO 000002 is ON and shows nesting
two levels. If CIO 000003 and CIO 000004 are both ON, the contents of
CIO 1200 and CIO 0002 are added and the result is placed in D00010 and
then 0001 is moved into D00011 based on the status of CY. If either
CIO 000003 or CIO 000004 is OFF, then the entire addition operation is
skipped and CIO 000301 is turned ON.
Operand bit
ON?
"A" executed (be-
tween IF and IEND).
Operation
ON if the branch instructions are not in a block program.
ON if more than 254 branches are nested.
OFF in all other cases.
Section 3-32
1199

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents