How can I use subprograms to increase productivity on my machining center?
Generally speaking, subprograms do not increase throughput for a machining operation. The real benefit of using subprograms is to decrease setup time and NC file size.
Subprograms allow you to repeat a portion of a program many times. For instance, if you had a particular section of a program that needed to be repeated several times, instead of copying that section of the program over and over (and ending up with a very large NC file), you could use a subprogram. You would write the subprogram section once, then refer to it as many times as you need to.
For example, suppose a very sophisticated design needs to be cut into a piece of steel with a 0.050” end mill. The total depth of the cut needs to be 0.125”; a much deeper cut than the small end mill can make.
Through experience we know that the deepest we can cut at any one time is 0.005”. Therefore we can calculate that we need to make 25 passes on the X,Y plane to reach the final depth of 0.125”. Let’s assume that the code required to make just one of these passes is 2000 blocks. If we used a CAM package to generate a program with the 25 passes, we would end up with an NC program with 50,000+ blocks.
The alternative is to use the CAM package to generate a program that provides one pass in the XY plane. We could then manually add the subprogram codes necessary to “call” that section 25 times (incrementally moving the Z axis down 0.005” each time). Not only would this save considerable disk space, but we would end up with a program that machines the same part in only 2010 blocks, a considerable savings.
For information on building and utilizing subprograms, refer to your User’s Guide.
Subprogram Block Numbers, O Code
Call to Subprogram, M98 Code
Return from Subprogram, M99 Code
Subprogram Reference Number, P Code
(Sub Program: This is for Educational Purposes only.)
O00061(CENTRE DRILL, DRILL, COUNTER SINK & TAP EXERCISE)
(PROGRAMMMER: ______ ___)
(THURSDAY, NOV __ /09)
N10 G17 G20 G40 G49 G80 G90 G98
N20 G28 G91 Z0
N30 G28 X0 Y0
N40 T13 M6 (#3 C’DRILL)
N50 G0 G54 G90 X1.2 Y1. S5454 M3 (#01)
N60 G43 Z2. H13 M8
N70 G99 G81 Z-.21 R.1 F4.8
N80 M98 P5000
N90 G28 G49 G91 Z0 M5
N110 T14 M6 (5/16″ DRILL)
N120 G0 G54 G90 X1.2 Y1. S1920 M3 (#01)
N130 G43 Z2. H14 M8
N140 G99 G83 Z-.8188 R.1 Q.15 F9.6
N150 M98 P5000
N160 G28 G49 G91 Z0 M5
N180 T18 M6 (1/2X82″ C’SINK)
N190 G0 G54 G90 X1.2 Y1. S354 M3 (#01)
N200 G43 Z2. H18 M8
N210 G99 G82 Z-.2291 R.1 P.508 F1.9
N220 M98 P5000
N230 G28 G49 G91 Z0 M5
N250 T20 M6 (3/8-16″ TAP)
N260 G0 G54 G90 X1.2 Y1. S373 M3 (#01)
N270 G43 Z2. H20 M8
N280 G99 G83 Z-.875 R.3 F23.3125
N290 M98 P5000
N300 G28 G49 G91 Z0 M5
N310 G28 X0 Y0
N340 X1.7 (#02)
N350 X1.2 Y1.5 (#03)
N360 X.7 Y1. (#04)
N370 X1.2 Y.5 (#05)
N380 X2.55 Y1.5 (#06)
N390 X3.05 (#07)
N400 X2.55 Y2. (#08)
N410 X2.05 Y1.5 (#09)
N420 X2.55 Y1. (#10)
N430 X4. Y1.25 (#11)
N440 X4.5 (#12)
N450 X4. Y1.75 (#13)
N460 X3.5 Y1.25 (#14)
N470 X4. Y.75 (#15)
N480 G0 G80 Z2. M9
Disclaimer, not 100% sure this is right, use at your own risk. the author, school, staff, students, do not take any responsibility for your actions with what is found here.
This is for Educational Purposes only.
Codes: HAAS C.N.C. MILL http://post.ly/C1Fp
You can find the Part 00023 CNC Program in the Jane Campus Forums @ http://janecampus.com/cnc101/cnc-program-part-023-t75.html