Merging Subprograms with Canned Cycles

This can ease programming of redundant commands in hole-making operations.


Facebook Share Icon LinkedIn Share Icon Twitter Share Icon Share by EMail icon Print Icon

Canned cycles dramatically simplify the task of programming hole-making operations into CNC machining centers. Subprogramming minimizes the required memory and simplifies the task of repeating redundant commands in any program. Since hole-making operations commonly require the programming of redundant commands, it is smart to take advantage of these two programming features in your CNC programs.

It is not uncommon, for example, to spot/center-drill, drill and tap a series of holes. Hole locations must be specified once for each tool. The more holes you have to machine, the more redundant, error-prone and memory-requiring commands you need to repeat. Following are two approaches using subprograms to minimize redundant commands in canned cycles.

First, you can instate the canned cycle to machine the first hole in the main program and then call a subprogram that contains the balance of holes. Here is an example using FANUC programming:

N045 T01 M06 (Spot-drill)
N050 G90 G54 S1500 M03 T02
N055 G00 X5.0 Y3.0
N060 G43 H01 Z0.1 M08
N065 G81 R0.1 Z-0.15 F5.0 (Spot-drill first hole)
N070 M98 P1000 (Call subprogram, machine balance of holes)
N075 T02 M06 (13/64 drill)
N080 G90 G54 S1200 M03 T03
N085 G00 X5.0 Y3.0
N090 G43 H01 Z0.1 M08
N095 G73 R0.1 Z-0.95 Q0.1 F5.0 (Peck-drill first hole)
N100 M98 P1000 (Call subprogram, machine balance of holes)
N105 T03 M06 (1/4-20 tap)
N110 G90 G54 S800 M03 T04
N115 G00 X5.0 Y3.0
N120 G43 H01 Z0.1 M08
N125 G84 R0.1 Z-0.7 F40.0 (Tap first hole)
N130 M98 P1000 (Call subprogram, machine balance of holes)

Commands N065, N095 and N125 machine the first hole with each tool. Commands N070, N100 and N130 invoke the subprogram that contains the balance of holes. Since tool-ending structure is also redundant, you can include the related commands in the subprogram as well. Here is a sample subprogram:

N1 X6.0
N2 X6.5
N3 X7.5
N4 X8.0 Y2.5

N24 G80 M09
N25 G91 G28 Z0 M19
N26 M01
N27 M99

The second approach involves instating the canned cycle in the main program but not actually machining the hole yet. In this way, all of the hole locations can be included in the subprogram. The word L0, if included in the initial canned cycle command, will cause the machine to set up the canned cycle criteria but not machine the hole. To accomplish this with the previous example, add L0 to each of main program commands N065, N095 and N125, replacing those commands with:

N065 G81 R0.1 Z-0.15 F5.0 L0 (Spot-drill first hole)
N095 G73 R0.1 Z-0.95 Q0.1 F5.0 L0 (Peck-drill)
N125 G84 R0.1 Z-0.7 F40.0 L0 (Tap)

Then, ensure that the subprogram (O1000, in this case) contains the coordinates for the first hole.
A somewhat transparent benefit of using a subprogram to specify hole locations is related to program verification. In our example, if the spot drill machines them correctly, so will the subsequent drill and tap. If a mistake is made for a hole location, only one command need be changed.