
PROGRAMMING16. CUSTOM MACRO
B–63684EN/01
256
Local and common variables can have value 0 or a value in the following
ranges :
–10
47
to –10
–29
0
10
–29
to 10
47
If the result of calculation turns out to be invalid, an P/S 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.
To reference the value of a variable in a program, specify a word address
followed by the variable number. When an expression is used to specify
a variable, enclose the expression in brackets.
Example: G01X[#1+#2]F#3;
A referenced variable value is automatically rounded according to the
least input increment of the address.
Example:
When G00X#1; is executed on a 1/1000–mm CNC with 12.3456
assigned to variable #1, the actual command is interpreted as
G00X12.346;.
To reverse the sign of a referenced variable value, prefix a minus sign (–)
to #.
Example: G00X–#1;
When an undefined variable is referenced, the variable is ignored up to an
address word.
Example:
When the value of variable #1 is 0, and the value of variable #2 is null,
execution of G00X#1Y#2; results in G00X0;.
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
D Range of variable values
D Omission of the decimal
point
D Referencing variables
D Undefined variable