372
MACROS
96-8000
June 1999
Offsets
All tool work offsets can be read and set within a macro expression. This allows the programmer to preset
coordinates to approximate locations, or to set coordinates to values based upon the results of skip signal
locations and calculations. When any of the offsets are read, the interpretation lookahead queue is stopped
until that block is executed.
#5201-#5205 G52 X, Y, Z, A, B OFFSET VALUES
#5221-#5225 G54 îš“ îš“ îš“ îš“ îš“ îš“ îš“
#5241-#5245 G55 îš“ îš“ îš“ îš“ îš“ îš“ îš“
#5261-#5265 G56 îš“ îš“ îš“ îš“ îš“ îš“ îš“
#5281-#5285 G57 îš“ îš“ îš“ îš“ îš“ îš“ îš“
#5301-#5305 G58 îš“ îš“ îš“ îš“ îš“ îš“ îš“
#5321-#5325 G59 îš“ îš“ îš“ îš“ îš“ îš“ îš“
#7001-#7005 G110 X, Y, Z, A, B OFFSET VALUES
îš“ îš“ îš“ îš“ îš“ îš“ îš“ îš“ îš“
#7381-#7385 G129 X, Y, Z, A, B OFFSET VALUES
A DDRESS C ONSTANT S UBSTITUTION
The usual method of setting control addresses A..Z is by appending a constant to the address. For instance,
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 con-
stants to be replaced with any variable or expression in any section of code (i.e., you do not have to be in a
macro subroutine).
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, then the usual control alarm will result.
For instance, the following code would result in a range error alarm because tool diameter numbers range from
0..50.
#1=75;
D#1;