Sunday, December 7, 2008

cnc program

Almost all current CNC controls use a word address format for programming. (The only exceptions to this are certain conversational controls.) By word address format, we mean that the CNC program is made up of sentence-like commands. Each command is made up of CNC words. Each CNC word has a letter address and a numerical value. The letter address (X, Y, Z, etc.) tells the control the kind of word and the numerical value tells the control the value of the word. Used like words and sentences in the English language, words in a CNC command tell the CNC machine what it is we wish to do at the present time.

One very good analogy to what happens in a CNC program is found in any set of step by step instructions. Say for example, you have some visitors coming in from out of town to visit your company. You need to write down instructions to get from the local airport to your company. To do so, you must first be able to visualize the path from the airport to your company. You will then, in sequential order, write down one instruction at a time. The person following your instructions will perform the first step and then go on to the next until he or she reaches your facility.

In similar manner, a manual CNC programmer must be able to visualize the machining operations that are to be performed during the execution of the program. Then, in step by step order, the programmer will give a set of commands that makes the machine behave accordingly.

Though slightly off the subject at hand, we wish to make a strong point about visualization. Just as the person developing travel directions MUST be able to visualize the path taken, so MUST the CNC programmer be able to visualize the movements the CNC machine will be making BEFORE a program can be successfully developed. Without this visualization ability, the programmer will not be able to develop the movements in the program correctly. This is one reason why machinists make the best CNC users. An experienced machinist should be able to easily visualize any machining operation taking place.

Just as each concise travel instruction will be made up of one sentence, so will each instruction given within a CNC program be made up of one command. Just as the travel instruction sentence is made up of words (in English), so is the CNC command made up of CNC words (in CNC language).

The person following your set of travel instructions will execute them explicitly. If you make a mistake with your set of instructions, the person will get lost on the way to your company. In similar fashion, the CNC machine will execute a CNC program explicitly. If there is a mistake in the program, the CNC machine will not behave correctly.

Program:
    O0001 (Program number) 
    N005 G54 G90 S400 M03 (Select coordinate system, absolute mode, and turn spindle on CW at 400 RPM) 
    N010 G00 X1. Y1. (Rapid to XY location of first hole) 
    N015 G43 H01 Z.1 M08 (Instate tool length compensation, rapid in Z to clearance position above surface to drill, turn on coolant) 
    N020 G01 Z-1.25 F3.5 (Feed into first hole at 3.5 inches per minute) 
    N025 G00 Z.1 (Rapid back out of hole) N030 X2. (Rapid to second hole)
    N035 G01 Z-1.25 (Feed into second hole) 
    N040 G00 Z.1 M09 (Rapid out of second hole, turn off coolant) 
    N045 G91 G28 Z0 (Return to reference position in Z) 
    N050 M30 (End of program command)

While the words and commands in this program probably do not make much sense to you (yet), remember that we are stressing the sequential order by which the CNC program will be executed. The control will first read, interpret and execute the very first command in the program. Only then will it go on to the next command. Read, interpret, execute. Then on to the next command. The control will continue to execute the program in sequential order for the balance of the program. Again, notice the similarity to giving any set of step by step instructions. 

No comments: