CNC machining program structure

CNC machining program structureCNC machining program structure

(1) Composition of the program

A complete processing program is composed of several blocks; one block is composed of several code words; each code word is composed of letters (address symbols) and several numbers (some with symbols) composition.

N01 G91 G00 X50 Y60 LF

N02 G01 X1000 Y5000 F150 S300 T01 M03 LF

N10 G00 X-50 Y-60 M02 LF

The above is a complete part processing program, consisting of 10 blocks, each block starts with “N” and ends with LF. M02 is the end of the entire program.

Some CNC systems stipulate that the entire program starts with%. End with EM.

One block represents a complete machining step and action. The number of characters is limited.

(2) Block format

Block format: In a block, the arrangement, writing method and sequence of code words, as well as the length restrictions and regulations of each word and block. If the format does not meet the requirements, the CNC system cannot accept it.

The commonly used block format is the word-address block format. Each word starts with an address symbol (letter), followed by symbols and numbers. There is no strict requirement for the order of the words. Unneeded words or the same continuation words as the previous paragraph can be omitted. Features: The program is simple, readable, and easy to check.

(3) Main program and subprogram

In a part processing program, if there are a certain number of consecutive blocks that are identical in several places, it can be compiled into a subprogram and stored in the subprogram memory. The part other than the subprogram is the main program. During the execution of the main program, the subprogram is called where necessary. It can be called repeatedly, and some NC programs can also be nested in multiple layers.

In the subprogram format, there is a subprogram name, and M17 is used as the subprogram end. Others, the same as the main program.

Minimum setting unit

After the CNC system sends out a pulse command, after the conversion, amplification, and feedback of the servo system, the minimum displacement of the actual movement of the workpiece (tool) on the machine tool is called the minimum setting unit, also known as the least command increment ) Or pulse equivalent. Generally: 0.01-0.001mm. When programming, all programming dimensions should be converted to values ​​corresponding to the minimum setting unit.