9 4
Macros
96-8000 rev R June 2007
A
DDRESS
S
UBSTITUTION
The usual method of setting control addresses A-Z is the address followed by a number. For example:
G01 X1.5 Y3.7 F20. ;
Sets addresses G, X, Y and F to 1, 1.5, 3.7 and 20.0 respectively and thus instructs the control to move linearly,
G01, to position X=1.5 Y=3.7 at a feed rate of 20 inches per minute. Macro syntax allows the address values to be
replaced with any variable or expression.
The previous statement can be replaced by the following code:
#1=1;
#2=.5;
#3=3.7;
#4=20;
G#1 X[#1+#2] Y#3 F#4 ;
The permissible syntax on addresses A-Z (exclude N or O) is as follows:
<address><-><variable>
A-#101
<address>[<expression>]
Y[#5041+3.5]
<address><->[<expression>]
Z-[SIN[#1]]
If the value of the variable does not agree with the range of the address, the control will generate an alarm. For
example, the following code would result in a range error alarm because tool diameter numbers range from 0-50.
#1=75;
D#1;
When a variable or expression is used in place of an address value, the value is rounded to the least significant digit.
If #1=.123456, then G1X#1 would move the machine tool to .1235 on the X axis. If the control is in the metric mode,
the machine would be moved to .123 on the X axis.
When an undefined variable is used to replace an address value, then that address reference is ignored. For ex-
ample, if #1 is undefined then the block
G00 X1.0 Y#1 ;
Becomes
G00 X1.0.
No Y movement takes place.
Macro Statements
Macro statements are lines of code that allow the programmer to manipulate the control with features similar to any
standard programming language. Included are functions, operators, conditional and arithmetic expressions, assign-
ment statements, and control statements.
Functions and operators are used in expressions to modify variables or values. The operators are essential to
expressions while functions make the programmer’s job easier.
Содержание Mill
Страница 12: ...96 8000 rev R June 2007 Safety 5 ...
Страница 14: ...96 8000 rev R June 2007 Safety 7 LATHE WARNING DECALS ...
Страница 15: ...8 Safety 96 8000 rev R June 2007 ...
Страница 17: ...10 Introduction 96 8000 rev R June 2007 ...
Страница 117: ...110 4 5 Axis Programming 96 8000 rev R June 2007 ...
Страница 199: ...Settings 192 96 8000 rev R June 2007 ...
Страница 213: ...206 Maintenance 96 8000 rev R June 2007 ...