Introduction

Every subroutine and every DFB (derived function block) is exited after being processed, i.e. you return to the main program called.

If the subroutine/DFB is left prematurely, the return to the main program can be forced by the return object.

If the status of the left link is 1, a return from the subroutine or DFB to the main program is performed.

Return objects can only be used in subroutines or DFBs. They cannot be used in main programs.

To generate a conditional return, a return object is linked to a Boolean FFB output.

Selecting the return object

You have the following options to select return objects:

  • Use the Edit > New > Return menu command.

    or

  • Choose the symbol.

The active placement mode for return objects is indicated by the cursor symbol.

Note

In the Tools > Options dialog box, in the Data and Languages tab, if the Automatically affect a variable on a new graphical object check box is activated, its properties dialog box is automatically opened when an object is placed. The procedure explained here is valid for deactivated check boxes.

Executing a return

Process the following steps to execute a return:

Step

Action

1

Create a subroutine or a DFB in the FBD programming language.

2

Create the logic for the subroutine/DFB.

3

Create the logic for return.

Example:

4

Select the return object.

5

Click the target position in the FBD section.

or

Use the arrow keys to move the cursor to the target position, and press Enter.

Result:The return object is inserted.

Example:

6

Create a connection between the return logic and return object using a graphical link.

Example: