13. Program Support Functions
13.5 User Macro Specifications
299
13.5 User Macro Specifications
13.5.1 User Macro Commands; G65, G66, G66.1, G67, G68(G23)
Function and purpose
By combining the user macros with variable commands, it is possible to use macro program call,
arithmetic operation, data input/output with PLC, control, decision, branch and many other
instructions for measurement and other such applications.
Macro call instruction
L Main program
L Macro program
....... ;
....... ;
M30 ;
G68 ;
Macro programs use variables, arithmetic instructions and control instructions to create
subprograms which function to provide special-purpose control.
These special-purpose control functions (macro programs) are called by the macro call instructions
exactly when required from the main program.
The following G codes are available for the macro call commands.
G code
Function
G65
User macro Simple call
G66
User macro Modal call A (Movement command call)
G66.1
User macro Modal call B (Per-block call)
G67
User macro Modal call cancel
G68
User macro program termination (same as G23)
Detailed description
(1) When the G66 (or 66.1) command is entered, the specified user macro subprogram will be
called after each block has been executed (or after the movement command in the block) with
the movement commands has been executed until the G67 (cancel) command is entered.
(2) The G66 (or G66.1) and G67 commands must be paired in the same program.