K1: Mode group, channel, program operation, reset response
9.15 Replacing functions by subprograms
Basic Functions
Function Manual, 09/2011, 6FC5397-0BP40-2BA0
637
9.15.2
Replacement of M, T/TCA and D/DL functions
9.15.2.1
Replacement of M functions
General Information
The following conditions are applicable for replacing the M functions:
• Per block only one M function is replaced.
• A block in which an M function is to be replaced, must not contain the following elements:
- M98
- Modal subroutine call
- Subprogram return
- Part program end
• M functions that trigger system functions must not be replaced by a subprogram (see section "Non
replaceable M functions").
Parameterization
M function and subprogram
M functions and the replacement subprograms are parameterized in the following machine data:
• MD10715 $MC_M_NO_FCT_ CYCLE[<Index>] = <M function number>
• MD10716 $MC_M_NO_FCT_CYCLE_NAME[<Index>] = "<subprogram name>"
The M function and the corresponding replacement subprogram are connected through the same index.
Example: M function
M101
is replaced by subprogram SUB_M101 and M function
M102
by SUB_M102:
System variable for transferring information
For a freely selectable M function, information regarding the M function that has been replaced and additional
functions (T, TCA, D, DL) for evaluation in the replacement subprogram are made available via the system
variable (see Chapter "System variable [Page 641]"). The data contained in the system variables refers to the
block in which the M function to be replaced is programmed.
The M function is selected with the index of machine data MD10715 $MC_M_NO_FCT_ CYCLE[<Index>] in
which the M function to be replaced has been parameterized:
MD10715 $MC_M_NO_FCT_CYCLE[ 0 ]
= 101
MD10716 $MC_M_NO_FCT_CYCLE_NAME[ 0 ]
= "SUB_M101"
MD10715 $MC_M_NO_FCT_CYCLE[ 1 ]
= 102
MD10716 $MC_M_NO_FCT_CYCLE_NAME[ 1 ]
= "SUB_M102"