Flexible NC programming
1.26 Macro technique (DEFINE ... AS)
Job planning
204 Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
Rules when defining a macro
● Any identifier, G, M, H functions and L program names can be defined in a macro.
● Macros can also be defined in the NC program.
● G function macros can only be defined in the macro module globally for the entire control
(modal).
● H and L functions can be programmed with 2 digits.
● M and G functions can be programmed using 3 digits.
CAUTION
Keywords and reserved names may not be re-defined using macros.
General conditions
Nesting of macros is not possible.
Examples
Example 1: Macro definition at the beginning of the program
Program code Comments
DEFINE LINE AS G1 G94 F300 ; Macro definition
...
...
N70 LINE X10 Y20 ; Macro call
...
Example 2: Macro definitions in a macro file
Program code Comments
DEFINE M6 AS L6 ; A subprogram is called at tool change to handle
the necessary data transfer. The actual M
function is output in the subprogram (e.g.,
M106).
DEFINE G81 AS DRILL(81) ; Emulation of the DIN-G function.
DEFINE G33 AS M333 G333 ; During thread cutting synchronization is
requested with the PLC. The original G function
G33 was renamed to G333 by machine data so that
the programming is identical for the user.