Flexible NC programming
1.25 Subprogram technique
Job planning
174 Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
Example
Main program:
Program code Comment
PROC MAIN_PROGRAM
Beginning of the program
...
N50 SUB_PROG
Subprogram call: SUB_PROG
N60 ...
...
N100 M30
End of program
Subprogram:
Program code Comment
PROC SUB_PROG
...
N100 RET
Prompts return jump to block N60 in the main program.
1.25.2.10 Parameterizable subprogram return jump (RET ...)
Function
Usually, an RET or M17 end of subprogram returns to the program from which the subprogram
was called and processing continues with the program line following the subprogram call.
However, on the other hand, there are also applications where the program should be
resumed at another position, e.g.:
● Resuming program execution after calling the stock removal cycles in the ISO dialect
mode (after describing the contour).
● Return to main program from any subprogram level (even after ASUB) for error handling.
● Return jump through several program levels for special applications in compile cycles and
in the ISO dialect mode.
In cases such as these, the
RET command is programmed together with "return jump
parameters".
Syntax
RET("<destination block>")
RET("<destination block>",<block after destination block>)
RET("<destination block>",<block after destination block> <number of
return jump levels>)
RET("<destination block>", ,<number of return jump levels>)
RET("<destination block>",<block after destination block>,<number of
return jump levels>,
<return jump to the beginning of the program>)
RET( , ,<number of return jump levels>,<return jump to the beginning
of the program>)