53
C4 Manual Rev 7.5.2
6.8 Special Commands
There are special commands that use the substep data within a step for different
purposes than normal. These commands are (6.8.1) Creating controlled loops, and
(6.8.2 - 6.8.5) External port controls. In each case only some of the substeps are
used. To enhance program readability, we suggest that you set any unused
substep values to zero.
6.8.1 Controlled Program Looping
The program may be placed into a controlled loop by the use of the PROGRAM
LOOP special command. When the Probe is specified as 3, the Setpoint value is
used as a loop count. This value must be specified as an integer and be in the
range 1 - 999. Each time the Loop Command is reached in the program, the loop
count is decremented by one. As long as the loop count is greater than zero, the
program will execute the step indicated in the Next-Step-Number substep of the
Program Loop step. When the loop count (substep 0) value finally becomes zero,
the step following the Program Loop step is executed.
Example:
Step &
substep Value
07.0 5 Loop count
07.1 0000 (not used)
07.2 0000 (not used)
07.3 1 Loop start step
07.4 3 Identifies this step as a PROGRAM LOOP command
This will loop 5 times from step 1 to step 7 decrementing the loop counter by 1 for
each loop. When the loop counter has reached 0 the program will continue with
step 8.
Notes:
Nested program loops not supported. They may appear to work if you try to use
them, but the loop will never complete and further results are not predictable.
A loop count of 5 (example) will cause the program to execute the loop 5 times. If
the program loop refers to a previously executed step as the loop start step, then
that step will be executed once originally plus the 5 times for the loop, for a total
of 6 times.
Example: If the program that contained the example loop step, above, began with
step 00, then progressed normally through steps 1, 2, 3, 4, 5, and 6 before