Introduction
In FBD, subroutines are called using a special subroutine block, see also section Subroutine call in the Reference manual.
The subroutine to be called must be located in the same task as the FBD section calling.
For an unconditional subroutine call, EN
and ENO
of the subroutine block are hidden or the input EN
is assigned the value 1.
For a conditional
subroutine call, EN
and ENO
of the subroutine block are shown and the input EN
is linked with a Boolean FFB output.
For a parallel call
of several subroutines, EN
and ENO
of the subroutine blocks are shown and the output ENO
is connected to the EN
input of the next subroutine
block.
Subroutine calls are expansions to IEC 61131-3 and must be explicitly enabled via the
dialog box, in the tab by activating the check box.Activating the placement mode for subroutine blocks
You have the following options to activate the placement mode for subroutine blocks:
Use the
menu command.Use the
menu command from the shortcut menu.or
Select the
symbol.
The active placement mode for subroutine blocks is indicated
by the cursor symbol.
Note
In the
dialog box, in the tab, if the check box is activated, its properties dialog box is automatically opened when an object is placed. The procedures explained here are used when the check box is cleared.Placing subroutine blocks:
Placing subroutine blocks:
Step |
Action |
---|---|
1 |
Activate the placement mode for subroutine blocks, see also Activating the placement mode for subroutine blocks. |
2 |
Click the target cell in the FBD section. or Use the arrow keys to move the cursor to the target position, and press Enter. Result: The selected subroutine block is inserted and the selection mode is active again. |
3 |
|
Unconditional subroutine call
Unconditional subroutine call:
Step |
Action |
---|---|
1 |
Place a subroutine block in the section, see also Placing subroutine blocks:. |
2 |
Place the mouse pointer on the subroutine block. Result: The mouse pointer changes its
symbol to |
3 |
Double-click the Result: A data selection box is opened. |
4 |
Enter Example: ![]() |
5 |
Double-click the Result: A selection dialog box for selecting the subroutine to be called is opened. Example: ![]() |
6 |
Enter the name of the subroutine,
or click the Result: The subroutine call is inserted into the section and a syntax and semantics check is performed. Example: ![]() If the subroutine has already been created (see also Create a Sub-Program Section (SR)), the procedure ends here. If the subroutine has not yet been created, continue with step 7. |
7 |
Create the subroutine, see alsoCreate a Sub-Program Section (SR). |
Conditional subroutine call
Conditional subroutine call:
Step |
Action |
---|---|
1 |
Execute the Unconditional subroutine call procedure, but do not
assign a value to the |
2 |
Create a Boolean logic for the subroutine call. |
3 |
Connect the logic’s Boolean
output to the Example: ![]() Note: To execute the conditional subroutine call you
can also allocate any Boolean variable to the Example: ![]() |
Parallel call of several subroutines
Calling several subroutines:
Step |
Action |
---|---|
1 |
Execute the Unconditional subroutine call procedure for all subroutines to be called in parallel. |
2 |
Connect the Example: ![]() |
3 |
Possibly create a Boolean logic for the first subroutine block. |