Subroutine techniques
Identical motion sequences and function flows that are repeated several times can be implemented as subroutines. There are two types of subroutines:
- Local subroutines
- Global subroutines or cycles
Several subroutines (local or global) nested in one another can be called. The number of subroutines used and the nesting depth are fixed [6]-24.
Variables are transferred from the main program to the subroutine indirectly using P parameters or directly in cycles by calling specific transfer parameters (@P...).
Overview of program definition and program call:
Main program
Definition: | %PROG_NAME or % PROG_NAME | The main program definition is only required when there are local subroutines. |
Call: | From the operating console by specifying the complete file name (including file extension) |
|
Local subroutine
Definition: | %L UP_NAME | Separator between "L" and program definition, otherwise it is assumed that a main program is defined |
Call in NC program: | LL UP_NAME | Separator between "LL" and program call, otherwise it is assumed that a global subroutine is called |
Global subroutine
Definition: | %PROG_NAME or % PROG_NAME | A subroutine definition is only required if there are local subroutines |
Call in NC program: | L FILE_NAME | Specify the complete file name (including file extension). Separator between “L” and program call |
Notice
If the first character that is neither a separator nor a "%” is found in the file outside the comments, this character is evaluated as the first character of an unnamed main program. It also means that no block numbers may be programmed in front of "%".
Additional information
- Local subroutines (Call LL <string>) <string>)
- Global sub-routines (Call L <string>)
- Parametric subroutine call (LL / L V.E. or macro)
- Implicit global subroutine call at program start
- Implicit global subroutine call at program end
- Cycles as global or local subroutines (Call L | LL CYCLE)
- Calling block sequences (L SEQUENCE)