![](/images/new-backgrounds/1256769/256769333x1.webp)
20 Custom Macro
In the case of G66.1, the rules of block execution:
The selected macro will be called already from the block, in which code G66.1 has been specified, taking into account the rules of argument assignment described at point 1.
Each NC block following G66.1 to a block containing code G67 will produce a macro call with the rules of argument assignment described under point 2. No macro will be called if an empty block is found (e.g., N1240) where a reference is made to a single N address, or from a block containing a macro instruction.
20.3 Custom Macro Call Using G Code
Maximum 10 different G codes can be selected by parameters, to which macro calls are initiated. Now instead of specifying
Nn G65 Pp <argument assignment> the following command can be used
Nn Gg <argument assignment>.
The particular program number to be called by the G code has to be selected in parameters. None of codes G65, G66, G66.1 and G67 may be specified for this purpose.
G(9010)=code G calling program O9010 G(9011)=code G calling program O9011
:
G(9019)=code G calling program O9019
If a negative value is written in parameters, the selected G code will generate a modal call. If, e.g.,
MODGEQU=0, call is G66 type MODGEQU=1, call is G66.1 type.
If the value of the parameter is 0, the macro will be called at the end of each motion block. If the value of the parameter is 1, the macro will be called for each block.
If a standard G code is selected for user call (e.g., G01), and a reference is made to that code again in the body of the macro, it will not produce another call, instead, it will be interpreted and executed by the control as an ordinary G code.
If a reference is made to the calling G code again in the body of the macro, and it is different from a standard G code, the control will return error message 3005 ILLEGAL G CODE.
–Calling a user M, S, T, A, B, C from a user G code call,
–Calling a user G code from a user M, S, T, A, B, C call is enabled, depending on the parameter
value.
FGMAC=0, not enabled (executed as ordinary M, S, ... G codes) FGMAC=1, enabled, i.e. a new call is generated.
The user G codes have the following sets of arguments:
–if the code is of G65 or G66 type, the set of arguments assigned to G65, plus P and L,
–if the code is of G66.1 type, the points described are applicable to its set of arguments. A modal code can be deleted by instruction G67.
167