13. Program Support Functions
13.5 User Macro Specifications
308
Differences between G22 and G65 commands
(1) The argument can be designated for G65 but not for G22.
(2) The sequence number can be designated for G22 but no for G65, G66 and G66.1.
(3) G22 executes a subprogram after all the commands except M, P, H and L(O) in the G22 block
have been executed, but G65 branches to the subprogram without any further operation.
(4) When any address except L(O), N, P, H or L is included in the G22 block, single block stop
results. This is not the case with G65.
(5) The level of the G22 local variables is fixed but it can be varied in accordance with the nesting
depth for G65. (#1, for instance, has the same significance either before or after G22 but a
different significance in each case with G65.)
(6) The G22 nesting depth extends up to 8 levels in combination with G65, G66 and G66.1. The
G65 nesting depth extends up to only 4 levels in combination with G66 and G66.1.
Macro call command nesting depth
Up to 4 nesting levels are available for macro subprogram calls based on simple call or modal call.
The argument with a macro call instruction is valid only on the called macro level. Since the nesting
depth for macro calls extends up to 4 levels, the argument can be used as a local variable for the
program with each respective macro call.
(Note 1)
When a G65, G66, G66.1 G code macro call or miscellaneous command macro call
is conducted, this is regarded as nesting level 1 and the level of the local variables is
also incremented by one.
(Note 2)
The designated user macro subprogram is called every time the movement
command is executed with modal call A. However, when the G66 command has been
duplicated, the next user macro subprogram is called every time an axis is moved
even with movement commands in the macro.
User macro subprograms are called in sequence from the subprogram commanded
last.
(Example 1)
Main program
(l
1
call)
Macro l
1
User macro operation
After Z1 execution
(l
2
call)
Macro l
1
(l
1
cancel)
(l
2
cancel)
After Z2 execution
After Z3 execution
Macro l
1
Macro l
1
Macro l
1
Macro l
2
G66Ll
1
;
Zz1 ;
x
1
y
1
x
2
G68
x
1
y
1
x
2
x
1
y
1
x
2
G66 Ll
2
;
Zz2 ;
G67 ;
Zz3 ;
G67 ;
Zz4 ;
Zz5 ;
G68
G68