16. CUSTOM MACRO
An ordinary machining program specifies a G code and the travel distance
directly with a numeric value; examples are G100 and X100.0.
With a custom macro, numeric values can be specified directly or using
a variable number. When a variable number is used, the variable value
can be changed by a program or using operations on the MDI panel.
G01 X#1 F300 ;
When specifying a variable, specify a number sign (#) followed by a
variable number. Personal computers allow a name to be assigned to a
variable, but this capability is not available for custom macros.
An expression can be used to specify a variable number. In such a case,
the expression must be enclosed in brackets.
Variables are classified into four types by variable number.
Table 16.1 Types of variables
This variable is always null. No value can
be assigned to this variable.
#1 – #33 Local
Local variables can only be used within a
macro to hold data such as the results of
operations. When the power is turned off,
local variables are initialized to null. When
a macro is called, arguments are assigned
to local variables.
#100 – #149 (#199)
#500 – #531 (#999)
Common variables can be shared among
different macro programs. When the power
is turned off, variables #100 to #149 are
initialized to null. Variables #500 to #531
hold data even when the power is turned
off. As an option, common variables #150
to #199 and #532 to #999 are also avail-
able. However, when these values are us-
#1000 – System
System variables are used to read and
write a variety of NC data items such as the
current position and tool compensation val-
Common variables #150 to #199 and #532 to #999 are
D Variable representation
D Types of variables