K1: Mode group, channel, program operation, reset response
9.15 Replacing functions by subprograms
Basic Functions
Function Manual, 09/2011, 6FC5397-0BP40-2BA0
643
9.15.2.4 Example: Replacement of an M function
Example 1
The function M6 is replaced by calling the subprogram "SUB_M6".
The information relevant for a tool change should be transferred using system variables.
Parameterization
Main program
Subprogram "SUB_M6"
Machine data Meaning
MD10715 $MN_M_NO_FCT_CYCLE[2] = 6 Tool change with M6
MD10716 $MN_M_NO_FCT_CYCLE_NAME[2] = "SUB_M6" Replacement
subprogram for M6
MD10718 $MN_M_NO_FCT_CYCLE_PAR = 2 Information transfer
using system
variables
Programming Comment
PROC MAIN
... ;
N10 T1 D1 M6 ;
;
M6 is replaced by subroutine "SUB_M6"
... ;
N90 M30
Programming Comment
PROC SUB_M6
N110 IF $C_T_PROG==TRUE ; IF address T is programmed
N120 T[$C_TE]=$C_T ; Execute T selection
N130 ENDIF ; ENDIF
N140 M[$C_ME]=6 ; Execute tool change.
N150 IF $C_D_PROG==TRUE ; IF address D is programmed
N160 D=$C_D ; Execute D selection
N170 ENDIF ; ENDIF
N190 M17