Flexible NC programming
1.26 Macro technique (DEFINE ... AS)
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
203
1.26 Macro technique (DEFINE ... AS)
CAUTION
Use of macros can significantly alter the control's programming language! Therefore,
exercise caution when using macros.
Function
A macro is a sequence of individual statements, which have together been assigned a name
of their own. G, M and H functions or L subprogram names can also be used as macros.
When a macro is called during a program run, the statements programmed under the
program name are executed one after the other.
Application
Instruction sequences that are repeated are only programmed once as macro in a dedicated
macro block (macro file) or once at the beginning of the program. The macro can then be
called in any main program or subprogram and executed.
Activating
In order to use the macros of a macro file in the NC program, the macro file must be
downloaded into the NC.
Syntax
Macro definition:
DEFINE <Macro name> AS <instruction 1> <instruction 2> ...
Call in the NC program:
<macro name>
Significance
DEFINE ... AS : Keyword combination to define a macro
<macro name>: Macro name
Only identifiers are permissible as macro names.
The macro is called from the NC program using the macro name.
<operation>: Programming instruction that should be included in the macro.