
PROGRAMMING
B–63124EN/01
16. CUSTOM MACRO
255
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.
#1=#2+100 ;
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.
Example: #1
An expression can be used to specify a variable number. In such a case,
the expression must be enclosed in brackets.
Example: #[#1+#2–12]
Local and common variables can have value 0 or a value in the following
ranges :
–10
47
to –10
–29
10
–29
to 10
47
If the result of calculation turns out to be invalid, an alarm No. 111 is
issued.
When a variable value is defined in a program, the decimal point can be
omitted.
Example:
When #1=123; is defined, the actual value of variable #1 is 123.000.
When the value of a variable is not defined, such a variable is referred to
as a “null” variable. Variable #0 is always a null variable. It cannot be
written to, but it can be read.
(a) Quotation
When an undefined variable is quotated, the address itself is also
ignored.
When #1 = <vacant > When #1 = 0
G90 X100 Y#1
#
G90 X100
G90 X100 Y#1
#
G90 X100 Y0
16.1
VARIABLES
D Variable representation
D Range of variable values
D Omission of the decimal
point
D Undefined variable