Here is a Fanuc subprogram example which shows, how cnc machinists can make their cnc programs easier to write and maintain by useing sub-programming method.
Contents
CNC Sub Programs
Sub-programming is a way in which cnc machinists can call other cnc programs stored in cnc machines from their programs (called as main-programs).
Read article about How to do Fanuc Sub Programming.
This Sub-programming process makes it easier for cnc programmers/machinists to keep their cnc programs small by dividing programs into small pieces of repeatable useful code.
![Fanuc Sub Programming](http://www.helmancnc.com/wp-content/uploads/2013/03/Fanuc-Sub-Programming.jpg)
Fanuc Sub Programming
As the below cnc program example shows,
cnc machinist want to drill some holes and then he want to tap the same holes.
Example Without Fanuc Sub-Program Call
The simplest way to program can be read here G81 Drilling Cycle G84 Tapping Cycle CNC Program Example.
Example with Fanuc Sub-Program Call
Below is the same program example but this time we are using Sub-programming technique.
Fanuc Subprogram Example
![Fanuc Subprogram Example](http://www.helmancnc.com/wp-content/uploads/2013/03/Fanuc-Subprogram-Example.jpg)
Fanuc Subprogram Example
O1000 ; N1 T1 M6 ; N2 G0 G90 G40 G21 G17 G94 G80 ; N3 G54 X10 Y10 S? M3 ; N4 G43 Z100 H1 ; N5 Z5 ; N6 G81 R3 Z-20 F? M8 ; N7 M98 P1001 ; N8 G0 G90 Z100 N9 T2 M6 ; N10 G0 G90 G40 G21 G17 G94 G80 ; N11 G54 X10 Y10 S? M3 ; N12 G43 Z100 H1 ; N13 Z5 ; N14 G84 G99 G95 R3 Z-20 F1.25 M8 ; N15 M98 P1001 ; N16 G0 G90 Z100 ; N17 T0 M6 ; N18 M30 ;
Sub Program
O1001 ; N101 Y30 ; N102 Y50 ; N103 Y70 ; N104 X30 ; N105 X50 ; N106 X70 ; N107 X90 ; N108 Y50 ; N109 Y30 ; N110 Y10 ; N111 X70 ; N112 X50 ; N113 X30 ; N114 G80 ; N115 M99