create and use subroutines on CNC milling

Source:shengfe Date:2018-06-24 07:27

create and use subroutines on CNC milling
 
One of the useful things about a CNC machine is that it can undertake repetitive tasks very easily. That means it can remove a lot of the drudgery from many jobs in the workshop.
 
Within a CNC program, a subroutine is a section of the program that can be used to hold the instructions for a task. Whenever that task has to be carried out, the program can call on the subroutine to carry out those instructions. Every time the subroutine is called, the same instructions are carried out, so you could type instructions into a subroutine just once and have the CNC program use those in- structions hundreds or thousands of times. Subroutines are useful for performing a repetitive task while machining a single workpiece, but they are also useful for machining multiple workpieces at one go.
 
You can avoid the use of subroutines entirely by using a CAM program, but writing your own program, with your own subroutines, does give a great deal of flexibility in many cases. You can also use subroutines to hold sections of code that have been created in a CAM program, giving you a great deal of control but avoiding any difficult calculations.
 
Inside a program, subroutines are separate blocks of program instructions, and they need a specific first instruction and a specific end instruction to distinguish them from the rest of the program.
 
O codes are used to define subroutines and each subroutine must have a refer- ence number. Note that O codes use the letter O, not the digit zero. In this printed book, the letter O and the digit 0 have different shapes.
 
CNC milling