9 NC Programming Routines
9.7 Subprogram Programming
144
;USE 7.25 X 3.00 STOCK TO VERIFY
G00 X1 Y1 Z.1 ;RAPID TO 1, 1, .1
M98 P1000 L4 ;RUN SUBPROGRAM 4 TIMES
G90 G00 X0 Y0 Z.1
M2 ;END OF MAIN PROGRAM
O1000 ;SUBPROGRAM TO MILL SQUARE AND MOVE
G90 G01 Z-.1 F2 ;PLUNGE AT CURRENT LOCATION
G91 ;INCREMENTAL COORDINATES
X1 F5 ;FIRST MOVE, FEED 5
Y1 ;SECOND MOVE
X-1 ;THIRD MOVE
Y-1 ;FOURTH MOVE
G90 G0 Z.1 ;RAPID ABOVE WORKPIECE
G91 G00 X1.5 ;RAPID TO START OF NEXT SQUARE
M99 ;RETURN FROM SUBPROGRAM
Note: Only selected lines are explained below.
Code
Explanation
M98P1000L4;CALLS
SUBPROGRAM 1000 AND
EXECUTES IT 4 TIMES
M98P1000
Call the subprogram whose O code is O1000.
L4
Run the subprogram 4 times.
O1000; SUBPROGRAM
TO MILL SQUARE AND
MOVE
Indicates the start of subprogram 1000.
M99; RETURN FROM
SUBPROGRAM
Indicates the end of the subprogram.