122
96-8000 Rev AC
May 2010
l
ocal
S
UbroUtine
e
xaMPle
A local subroutine is a block of code in the main program that is referenced
several times by the main program. Local subroutines are commanded (called)
using an M97 and a Pnnnnn which refers it to the N line number of the local
subroutine.
The local subroutine format is to end the main program with an M30 then enter
the local subroutines after the M30. Each subroutine must have an N line
number at the start and a M99 at the end that will send the program back to the
next line in the main program.
Local Subroutine Example
O00104 (local sub program with an M97)
T1 M06
G90 G54 G00 X1.5 Y-0.5
S1406 M03
G43 H01 Z1. M08
G81 G99 Z-0.26 R0.1 F7.
M97 P1000 (Call local subroutine at line N1000)
T2 M06
G90 G54 G00 X1.5 Y-0.5
S2082 M03
G43 H02 Z1. M08
G83 G99 Z-.75 Q0.2 R0.1 F12.5
M97 P1000 (Call local subroutine at line N1000)
T3 M06
G90 G54 G00 X1.5 Y-0.5
S750
G43 H03 Z1. M08
G84 G99 Z-.6 R0.1 F37.5
M97 P1000 (Call local subroutine at line N1000)
G53 G49 Y0.
M30 (End Program)
N1000 (Begin local subroutine)
X.5 Y-.75
Y-2.25
G98 X1.5 Y-2.5
G99 X3.5
X4.5 Y-2.25
Y-.75
X3.5 Y-.5
G80 G00 Z1.0 M09
G53 G49 Z0. M05
M99
S
UbroUtine
c
anned
c
ycle
e
xaMPle
Sub Program
O1234 (Canned Cycle Example Program)
O1000 (X,Y
T1 M06
Locations)
G90 G54 G00 X.565 Y-1.875 S1275 M03
X 1.115 Y-2.750
Summary of Contents for 96-8000
Page 15: ...6 96 8000 Rev AC May 2010 Mill Warning Decals ...
Page 16: ...7 96 8000 Rev AC May 2010 Safety Lathe Warning Decals ...
Page 41: ...32 96 8000 Rev AC May 2010 ...
Page 93: ...84 96 8000 Rev AC May 2010 ...
Page 129: ...120 96 8000 Rev AC May 2010 ...
Page 133: ...124 96 8000 Rev AC May 2010 ...
Page 268: ......
Page 269: ......