8 6
Macros
96-8000 rev R June 2007
Example 3: G65 P2000 I1 J2 K3 I4 J5 K6;
The following letters cannot be used to pass parameters to a macro subroutine: G, L, N, O or P.
Macro Variables
There are three categories of macro variables: system variables, global variables, and local variables.
Macro Constants are floating point values placed in a macro expression. They can be combined with addresses A-Z
or they can stand alone when used within an expression. Examples of constants are .0001, 5.3 or -10.
Local Variables
Local variables range between #1 and #33. A set of local variables is available at all times. When a call to a subrou-
tine with a G65 command is executed, the local variables are saved and a new set is available for use. This is called
“nesting” of the local variables. During a G65 call, all of the new local variables are cleared to undefined values and
any local variables that have corresponding address variables in the G65 line are set to the G65 line values. Below is
a table of the local variables along with the address variable arguments that change them.
:
e
l
b
a
i
r
a
V
:
s
s
e
r
d
d
A
:
e
t
a
n
r
e
t
l
A
1
A
2
B
3
C
4
I
5
J
6
K
7
D
I
8
E
J
9
F
K
0
1
I
1
1
H
J
:
e
l
b
a
i
r
a
V
:
s
s
e
r
d
d
A
:
e
t
a
n
r
e
t
l
A
2
1
K
3
1
M
I
4
1
J
5
1
K
6
1
I
7
1
Q
J
8
1
R
K
9
1
S
I
0
2
T
J
1
2
U
K
2
2
V
I
:
e
l
b
a
i
r
a
V
:
s
s
e
r
d
d
A
:
e
t
a
n
r
e
t
l
A
3
2
W
J
4
2
X
K
5
2
Y
I
6
2
Z
J
7
2
K
8
2
I
9
2
J
0
3
K
1
3
I
2
3
J
3
3
K
Note that variables 10, 12, 14-16 and 27-33 do not have corresponding address arguments. They can be set if a
sufficient number of I, J and K arguments are used as indicated above in the section about arguments.
Once in the macro subroutine, the local variables can be read and modified by referencing the variable numbers 1-33.
When the L argument is used to do multiple repetitions of a macro subroutine, the arguments are set only on the
first repetition. This means that if local variables 1-33 are modified in the first repetition, then the next repetition will
have access only to the modified values. Local values are retained from repetition to repetition when the L address is
greater than 1.
Calling a subroutine via an M97 or M98 does not nest the local variables. Any local variables referenced in a subrou-
tine called by an M98 are the same variables and values that existed prior to the M97 or M98 call.
Global Variables
Global variables are variables that are accessible at all times. There is only one copy of each global variable. Global
variables occur in three ranges: 100-199, 500-699 and 800-999. The global variables remain in memory when power
is turned off.
Occasionally, there have been some macros written for factory installed options that use the global variables. For
example, probing, pallet changers, etc. When using global variables, be sure they are not in use by another program
on the machine.
System Variables
System variables give the programmer the ability to interact with a variety of control conditions. By setting a system
variable, the function of the control can be modified. By reading a system variable, a program can modify its behavior
based on the value in the variable. Some system variables have a Read Only status; this means that the program-
mer cannot modify them. A brief table of currently implemented system variables follows with an explanation of their
use.
Summary of Contents for Mill
Page 12: ...96 8000 rev R June 2007 Safety 5 ...
Page 14: ...96 8000 rev R June 2007 Safety 7 LATHE WARNING DECALS ...
Page 15: ...8 Safety 96 8000 rev R June 2007 ...
Page 17: ...10 Introduction 96 8000 rev R June 2007 ...
Page 117: ...110 4 5 Axis Programming 96 8000 rev R June 2007 ...
Page 199: ...Settings 192 96 8000 rev R June 2007 ...