
B-63322EN/03 NC FUNCTIONS 18.CUSTOM MACRO
- 237 -
- Sub program call by T code
By setting parameter, sub program can be called by T codes.
When commanded:
N_ G_ X_ Y_ … Tt ; ,
the same operation is done as when commanded:
#149 = t;
N_ G_ X_ Y_ … M98 P9000; .
The T type code t is stored as arguments of common variable
#149.
- Sub program call by S code
By setting parameter, sub program can be called by S codes.
When commanded:
N_ G_ X_ Y_ … Ss ; ,
the same operation is done as when commanded:
#147 = t;
N_ G_ X_ Y_ … M98 P9029; .
The T type code t is stored as arguments of common variable
#147.
- Sub program call by second auxiliary function code (B code)
By setting parameter, sub program can be called by B codes.
When commanded:
N_ G_ X_ Y_ … Bb ; ,
the same operation is done as when commanded:
#146 = t;
N_ G_ X_ Y_ … M98 P9028; .
The T type code t is stored as arguments of common variable
#146.
- Types of variables
Variables are divided into local variables, common variables, and
system variables, according to their variable numbers. Each type has
different use and nature.
- Local variables #1 - #33
Local variables are variables used locally in the macro.
Accordingly, in case of multiples calls (calling macro B from
macro A), the local variable used in macro A is never destroyed
by being used in macro B.
- Common variables #100 - #199, #500 - #999
Compared with local variables used locally in a macro, common
variables are common throughout the main program, each sub
program called from the main program, and each macro. The
common variable #1 used in a certain macro is the same as the
common variable #i used in other macros. Therefore, a common
variable #1 calculated in a macro can be used in any other macros.
Common variables #100 to #199 are cleared when power is turned