Contact Us


ADD:2205#, 31th Building, XiangZhangLuZhou, ZhangMuTou Town,Dongguan City,Guangdong Province, China 523622



Position:Home > Support

Common Skills of Manual Programming in CNC Machining

2018/11/30 16:19:20 Viewers:
For NC machining, programming is very important, which directly affects the quality and efficiency of processing. I believe that we love and hate programming. So how to quickly master the programming skills of CNC machining center? Now let's learn with the editor.

[pause instruction]

G04X(U)/P_is the tool pause time (feed stop, spindle stop), and the value after address P or X is the pause time. The value after X should take decimal point, otherwise it is calculated as one thousandth of this value in seconds (s), and the value after P can not take decimal point (i.e. integer), in milliseconds (ms).

However, in some drilling instructions (such as G82, G88 and G89), in order to ensure the roughness of the bottom of the hole, there is a pause time when the tool is machined to the bottom of the hole, which can only be expressed by address P. If expressed by address X, the control system considers X to be the coordinate value of X axis.

[Differences and connections between M00, M01, M02 and M03]

M00 is the program's unconditional pause instruction. Program execution to this feed stop, spindle stop. To restart the program, you must first return to JOG state, press CW (spindle forward) to start the spindle, and then return to AUTO state, press START key to start the program.

M01 is a program selective pause instruction. The OPSTOP key on the control panel must be opened before the program can be executed. The effect after execution is the same as that of M00, and the program should be restarted as above. M00 and M01 are often used for dimension inspection or chip removal of workpieces in the process.

M02 is the main program termination instruction. To execute this instruction, feed stops, spindle stops, coolant closes. But the program cursor stops at the end of the program.

M30 is the main program termination instruction. Function with M02, the difference is that the cursor returns to the program header position, regardless of whether there are other program segments after M30.

[Addresses D and H have the same meaning]

Tool compensation parameters D and H have the same function and can be interchanged arbitrarily. They all represent the address names of compensation registers in CNC system. But the key to determine the specific compensation value is the compensation number address behind them. However, in order to prevent errors in the machining center, it is generally stipulated that H is the tool length compensation address, compensation number is from 1 to 20, D is the tool radius compensation address, and compensation number is from 21 (tool Library of 20 knives).

Mirror instruction

Mirror processing instructions M21, M22, M23. When only X or Y axes are mirrored, the cutting sequence (forward milling and reverse milling), tool compensation direction and arc interpolation steering will be contrary to the actual program. When X-axis and Y-axis are mirrored at the same time, the order of tool-taking, the direction of tool-compensation and the direction of arc interpolation are unchanged.

Note: After using the mirror instruction, you must cancel it with M23 to avoid affecting the following program. In G90 mode, when using mirroring or canceling instructions, it is necessary to return to the origin of the workpiece coordinate system. Otherwise, the NC system can not calculate the back trajectory, and there will be random tool movement. At this time, the manual origin restoring operation must be implemented to solve the problem. The spindle steering does not change with the mirror instruction.

[arc interpolation instructions]

G02 is clockwise interpolation, G03 is counterclockwise interpolation. In the XY plane, the format is as follows: G02/G03X_Y_I_K_F or G02/G03X_Y_R_F, where X and Y are the end coordinates of the arc, I and J are the increments of the starting point of the arc to the center of the circle on the X and Y axes, R is the radius of the arc, F is the feed.

In arc cutting, it should be noted that Q < 180 degrees, R is positive; Q > 180 degrees, R is negative; the designation of I and K can also be specified by R. When both are specified at the same time, R command takes precedence, I and K are invalid; R can't do round cutting, and round cutting can only be programmed by I, J and K, because after the same point, there are countless circles with the same radius. When I and K are zero, it can be omitted; I, J and K are programmed according to relative coordinates in both G90 and G91 modes; when circular interpolation, the tool compensation instruction G41/G42 cannot be used.

[Advantages and disadvantages between G92 and G54-G59]

G54-G59 is the coordinate system set before processing, while G92 is the coordinate system set in the program. If G54-G59 is used, there is no need to use G92 again, otherwise G54-G59 will be replaced and should be avoided.

Note: (1) Once G92 is used to set the coordinate system, the use of G54-G59 will not have any effect unless the system is restarted after power failure or the new workpiece coordinate system is set with G92. (2) When the G92 program is finished, if the machine tool does not return to the origin set in 92, the program will be started again. The current position of the machine tool will become the origin of the new workpiece coordinates, which is prone to accidents. Therefore, I hope that readers will use it carefully.

[Programming tool changer subroutine]

In the machining center, tool change is inevitable. But when the machine tool leaves the factory, there is a fixed tool changing point. If it is not in the tool changing position, it can not change the tool. Moreover, before changing the tool, the tool compensation and cycle must be cancelled, the spindle stopped and the coolant closed. There are many conditions. If these conditions are guaranteed before each manual tool change, it is not only easy to make mistakes but also inefficient. Therefore, we can compile a tool change program to save, and then we can use M98 call to complete the tool change at one time.

Taking PMC-10V20 machining center as an example, the program is as follows:

O2002; (program name)


M05; (spindle stop)

M09; (Coolant shutdown)

G91G30Z0; (Z axis returns to the second origin, i.e. tool change point)

M06; (knife changing)

M99; (Subprogram End)

In the case of tool change, just type "T5M98P2002" in the state of MDI to replace the required tool T5, thus avoiding many unnecessary errors. Readers