FANUC Series 16/18/160/180-Model C Machining Center Operators Manual

PROGRAMMING
B–62764EN/01
16. CUSTOM MACRO
371
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]
Variables are classified into four types by variable number.
Table 16.1 Types of variables
Variable
number
Type of
variable
Function
#0 Always
null
This variable is always null. No value can
be assigned to this variable.
#1 – #33 Local
variables
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
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-
ing.
#1000 – System
variables
System variables are used to read and
write a variety of NC data items such as the
current position and tool compensation val-
ues.
NOTE
Common variables #150 to #199 and #532 to #999 are
optional.
16.1
VARIABLES

D Variable representation
D Types of variables

Leave a Reply

Your email address will not be published. Required fields are marked *