226
PROGRAMMING EXAMPLES
96-8000
June 1999
SUBPROGRAMS AND C ANNED C YCLES
After reviewing the canned cycle, we can get a good idea of the amount of lines of code required to produce the
five holes. The best way to conserve on program space and programming time is to use a subprogram. We can
do this by grouping the X and Y locations of the holes into a separate program and then calling up this program
when we need to tell a canned cycle the X,Y coordinates.
Instead of writing the X,Y locations once for each tool, we can write the X,Y locations once for any number of
tools.
The canned cycle program that we reviewed on the previous page could use some constructive rearranging.
%%
O1234 (Example program) O1000 (X,Y LOC. SUB)
T1 M06 X 1.115 Y-2.750
G00 G90 G54 X.565 Y-1.875 S1275 M03 X 3.365 Y-2.875
G43 H01 Z.1 M08 X 4.188 Y-3.313
G82 Z-.175 F10. R.1 P300 X 5.0 Y-4.0
M98 P1000 M99
G00 G80 Z1.0 M09 %
T2 M06
G00 G90 G54 X.565 Y-1.875 S2500 M03
G43 H02 Z.1 M08
G83 Z-.620 F15. R.1 Q.175
M98 P1000
G00 G80 Z1.0 M09
T3 M06
G00 G90 G54 X.565 Y-1.875 S900 M03
G43 H03 Z.2 M08
G84 Z-.600 F56.25 R.2
M98 P1000
G00 G80 Z1.0 M09
G28 G91 Y0 Z0
M30
%