PROGRAMMING
B–63844EN/02
15. CUSTOM MACRO
299
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.
[Example] When #1 is 0 and #2 is null, the result of executing G00
X#1 Y#2; will be the same as when G00 X0; is executed.
(b)Operation
< vacant > is the same as 0 except when replaced by < vacant>
When #1 = < vacant > When #1 = 0
#2 = #1
#
#2 = < vacant >
#2 = #1
#
#2 = 0
#2 = #1*5
#
#2 = 0
#2 = #1*5
#
#2 = 0
#2 = #1+#1
#
#2 = 0
#2 = #1 + #1
#
#2 = 0
D Omission of the decimal
point
D Referencing variables
D Undefined variable