Introduction

Control elements are used for executing jumps within an LD section and for returning from a subroutine (SRx) or derived function block (DFB) to the main program.

Control elements take up one cell.

Control Elements

The following control elements are available.

Designation

Representation

Description

Jump

When the status of the left link is 1, a jump is made to a label (in the current section).

To generate an unconditional jump, the jump object must be placed directly on the left power rail.

To generate a conditional jump, a jump object is placed at the end of a series of contacts.

Label

LABEL:

Labels (jump targets) are indicated as text with a colon at the end.

This text is limited to 38 characters and must be unique within the entire section. The text must conform to general naming conventions.

Jump labels can only be placed in the first cell directly on the power rail.

Note: Jump labels may not "cut through" networks, i.e. an assumed line from the jump label to the right edge of the section may not be crossed by any object. This also applies to Boolean links and FFB links.

Return

RETURN objects cannot be used in the main program.

  • In a DFB, a RETURN object forces the return to the program which called the DFB.

    • The rest of the DFB section containing the RETURN object is not executed.

    • The next sections of the DFB are not executed.

    The program which called the DFB will be executed after return from the DFB.

    If the DFB is called by another DFB, the calling DFB will be executed after return.

  • In an SR, a RETURN object forces the return to the program which called the SR.

    • The rest of the SR containing the RETURN object is not executed.

    The program which called the SR will be executed after return from the SR.