Calling Subroutines
Original instructions
Introduction
Calling subroutines is managed by 3 function blocks:
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:
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,
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.
NOTE: The message is only visible at those 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.