0
3.4kviews
Sub Programming :
1 Answer
0
159views

One of such and mostly used technique is Sub-programming. Sub-programming is easy to use and understand with just simple commands like M98, M99 you can achieve greater flexibility.

Subprograms are normal CNC programs which are called from a program (normally called main-program) to add some kind of repeatable machining operation.

enter image description here

For Sub Programming No Extra Skill Required CNC machinist/ CNC programmer not have to learn a new G-code or programming style. Subprograms are like normal programs which we daily add, write, alter and delete. CNC Subprograms End with M99 One important distinction among a main-program and a subprogram is that main-programs end with M30 but subprograms end with M99 CNC Subprograms Naming Subprogram are normal CNC programs, so are named (numbered) similar way like O0001, O0005 etc.

How to Insert a CNC Subprogram? Subprograms are inserted the same way in CNC machine controls, as other CNC programs are made.

CNC Subprogram Call Subprograms can be called from main-program multiple times at multiple locations. Even subprograms can call other subprograms. Normally subprogram can be nested up-to four levels.

CNC Subprogram End When a sub-program ends with M99 the control is given back to the calling program (main-program), and program execution starts from that point onward. Subprogram Example 1

If a main-program (O0001) calls a subprogram (O0002) and that subprogram calls another subprogram (O0003). So when O0003 after completion of its machining will end with M99 the control will be returned to O0002 and machining will continue until that sub-program ends with M99, at that call the control will be back to O0001 and that will continue to execute until it reaches M30, which will end the program.

Drawing/Image

enter image description here

CNC Program

;Main Program

O777
G91 G28 Z0
M06 T01
M03 S1200
G90 G54 G43 H1
G00 X30 Y110
Z2
M98 P030888 (call subprog O888 three times)
G28 Z0
M30

;Subprogram

O888
G91
G01 Z-9 F200
Y-80
X50
Y80
G00 Z9
G00 X30
M99
Please log in to add an answer.