Introduction
Calling subroutines is managed by 3 function blocks:
L9_JSR
L9_LAB
L9_RET
For detailed information please refer to the function block descriptions.
Up to 1023 subroutines can be established.
Control Expert does not support interrupt handling with LL984 subroutines.
Restrictions
For the calling subroutines feature the following restrictions apply:
Only one LL984 segment can be created inside the subroutine (
) node of the task.L9_LAB
andL9_RET
function blocks can only be placed in an LL984 subroutine network in the .An
L9_LAB
function block can only be placed in row 1, column 1 of an LL984 subroutine network.
Subroutine Structure
A subroutine is identified by a number (1.. 1023).
Subroutines
are called by the L9_JSR
function block within an
LL984 network (normal or subroutine network).
Two additional
function blocks, which are only available in subroutine networks,
mark the starting point (L9_LAB
function block) and
ending point (L9_RET
function block) of a subroutine.
A subroutine may span multiple networks.
The L9_RET
function block is optional and this explicit ending point of a subroutine
can be omitted,
if the last subroutine network is the last network of the subroutine segment or
if a new subroutine network (
L9_LAB
) would entered.
The L9_RET
function block or the implicit
forms, return from the current subroutine network to the calling L9_JSR
function block with an OK status.
Nesting
A subroutine may call other subroutines or recursively call itself up to 100 times.
If the maximum nesting level is reached, an implicit return is
performed and the ERR
output of the L9_JSR
function block is set.
A nesting level problem message is
propagated to the (99) cascaded L9_JSR
function blocks.
Further cascaded L9_JSR
function blocks, which
are being executed after a nesting level problem, do not succeed to
call a subroutine and the ERR
output is being set
until the nesting level stack has been unwound.
L9_JSR
function
blocks, contributing to the problem. A dedicated problem treatment
is possible on each calling level. Subsequent L9_JSR
function blocks of a segment are not influenced by this problem.Please also refer to the L9_JSR
function block description.