Detailed description
2.11 Subroutine call through NC language replacement
Basic logic functions: Mode group, channel, program operation, reset response (K1)
176 Function Manual, 11/2006, 6FC5397-0BP10-2BA0
2.11.2 M function replacement
Subroutine call via M function
Note
Subroutine calls using an M function are referred to below as M function replacement.
The following machine data are used to configure M function replacement:
• MD10715 $MN_M_NO_FCT_CYCLE
(M function to be replaced by a subroutine)
• MD10716 $MN_M_NO_FCT_CYCLE_NAME
(Name of the subroutine of M function)
In this case in machine data
MD10715 the M function is defined through which the call of the subroutine takes place in
machine data
MD10716 $MC_M_NO_FCT_CYCLE_NAME.
Call rules
If the M function configured with MD10715 $MC_M_NO_FCT_CYCLE is programmed in a
part program block, the appropriate subroutine is called at the end of the part program block.
If the M function is programmed again within the called subroutine, the M function is not
replaced again. In addition, other M function expansions configured with MD10715
$MC_M_NO_FCT_CYCLE or MD10716 $MC_M_NO_FCT_CYCLE_NAME are not executed.
Exceptions
The M function is also replaced in an ASUB if the ASUB was started in a subroutine that was
called via an M function.
Address extension of M function
Using system variable $C_ME it is possible to read the address extension of the M function
in the called subroutine.
Example configurations
• Call of subroutine SUB_M101 via M101
MD10715 $MC_M_NO_FCT_CYCLE[0] = 101
MD10716 $MC_M_NO_FCT_CYCLE_NAME[0] = "SUB_M101"
• Call of subroutine SUB_M102 through M102
MD10715 $MC_M_NO_FCT_CYCLE[1] = 102
MD10716 $MC_M_NO_FCT_CYCLE_NAME[1] = "SUB_M102"