Forever

Control Block

Description

The Forever Block performs a list of blocks over and over indefinitely. Internal to the Forever Block is a yield command at the end limiting the maximum looping rate to the current sample rate of the controller. Forever blocks have no tabs on the bottom since execution will never leave the enclosed list of blocks. Forever blocks only terminate if they are aborted as tasks, if an internal decision is made that exits from the loop, or if an exception occurs departing the loop.

Escapes

The Forever block does not produce any escapes.

Examples

This example shows a Forever block blinking a warning indicator:

When using an industrial HMI connected by Modbus it is often necessary to maintain information that the HMI presents. A Forever block can be used for such ongoing information maintenance:

This Forever Block executes until a power level has gotten too low:

However if criteria is known that might terminate the loop then the While and Repeat Until indefinite loops are better structures being clearer and more concise:

Related Topics

Yield
While
Repeat Until