Subroutines, Macros
2.19 Macro technique (DEFINE...AS)
Job planning
2-42 Programming Manual, 03/2006 Edition, 6FC5398-2BP10-1BA0
Three-digit M/G function
Supports programming of three-digit M and G functions.
Example:
N20 DEFINE M100 AS M6
N80 DEFINE M999 AS M6
Note
Macros can also be declared in the NC program. Only identifiers are permissible as macro
names. G function macros can only be defined in the macro module globally for the entire
control.
Nesting of macros is not possible.
Example: macro definitions
DEFINE M6 AS L6 A subroutine is called at tool change to handle the
necessary data transfer. The actual M function is
output in the subroutine (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.
Example: macro file
After reading the macro file into the control, activate the macros (see above). The macros
can now be used in the parts program.
%_N_UMAC_DEF
;$PATH=/_N_DEF_DIR ;Customer-specific macros
DEFINE PI AS 3.14
DEFINE TC1 AS M3 S1000
DEFINE M13 AS M3 M7 ;Spindle right, coolant on
DEFINE M14 AS M4 M7 ;Spindle left, coolant on
DEFINE M15 AS M5 M9 ;Spindle stop, coolant off
DEFINE M6 AS L6 ;Call tool change program
DEFINE G80 AS MCALL ;Deselect drilling cycle
M30