Programming and Operating Manual (Milling)
6FC5398-4DP10-0BA1, 01/2014
111
Set-up
The structure of a subroutine is identical to that of a main program (see Section "Program structure (Page 50)"). Like main
programs, subroutines contain M2 - end of program in the last block of the program sequence. This means a return to the
program level where the subroutine was called from.
End of program
The end instruction RET can also be used instead of the M2 program end in the subroutine.
RET must be programmed in a separate block.
The RET instruction is used when G64 continuous-path mode is not to be interrupted by a return. With M2, G64 is
interrupted and exact stop is initiated.
See the following illustration for example of sequence when calling a subroutine twice:
Subroutine name
The program is given a unique name allowing it to be selected from several subroutines. When you create the program, the
program name may be freely selected, provided the following conventions are observed.
The same rules apply as for the names of main programs.
Example: LRAHMEN7
It is also possible to use the address word L... in subroutines. The value can have 7 decimal places (integers only).
Note
With address L, leading zeros are
meaningful for differentiation.
Example: L128 is not L0128 or L00128.
These are three different subroutines.
Note
The subroutine name LL6 is reserved for tool change.
Subroutine call
Subroutines are called in a program (main or subroutine) with their names. To do this, a separate block is required.
Example:
N10 L785
; Call subroutine L785
N20 LRAHMEN7
; Call subroutine LRAHMEN7