
18. CUSTOM MACRO
B–63002EN/01
NC FUNCTION
218
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.
This command cannot be done in the same block with a sub program
calling M code, or with M98 command. The T code is not output.
When T code is commanded in macros called by G code, or in sub
programs called by M codes or T codes, the T code is treated as
ordinary T codes.
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 – #149, #500 – #531
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 #149 are cleared when power is turned off,
but common variables #500 to #531 are not cleared after power is
turned off.
NOTE
The range of common variables can be enlarged to #100 to
#199, and #500 to #999 by the option.
System variables
A variable with a certain variable number has a certain value. If the
variable number is changed, the certain value is also changed.
The certain value are the following:
16 points DI (for read only)
48 points DO (for output only)
Tool offset amount, work zero point offset amount
Position information (actual position, skip position, block end
position, etc.)
Modal information (F code, G code for each group, etc.)
Alarm message (Set alarm number and alarm message, and the
CNC is set in an alarm status. The alarm number and message is
displayed.)
Types of variables