Education

# CNC Machining Common Programming Skills & Instructions

With the development of science and technology, people have higher and higher requirements on the performance and quality of products, so that the application of CNC machining center has been popularized to a certain extent and the high-performance and high-efficiency machining. CNC machining parts manufacturing with milling, turning, and drilling machines which has gradually become a social need. This article explained the detailed introduction of CNC machining most commonly used programming skills and instructions.

## CNC Machining Common Programming Skills & Instructions

1. ### Pause Command

G04X(U)_ /P_ It refers to the tool pause time (feed stop, spindle not stop). The value after address P or X is the pause time. The value after X should have a decimal point, otherwise it is calculated as one thousandth of the value in seconds (s), and the value after P cannot have a decimal point (that is, an integer), but in milliseconds (MS). For example, G04 x2.0; or G04 X2000; or G04 P2000; pause for 2 seconds.

However, in some hole system processing instructions (such as g82, G88 and g89), in order to ensure the roughness of the hole bottom, there is a pause time when the tool is processed to the hole bottom. At this time, it can only be expressed by the address P. if it is expressed by the address x, the control system thinks that x is the x-axis coordinate value. For example, g82x100.0y100.0z-20.0r5.0f200p2000; drilling (100.0100.0) to hole bottom pause for 2 seconds g82x100.0y100.0z-20.0r5.0f200x2.0; drilling (2.0100.0) to hole bottom will not pause.

1. ### The Differences and Relations Between M00, M01, M02 and M30

• M00 is the program unconditional pause instruction. When the program is executed, the feed stops and the spindle stops. To restart the program, you must return to jog state, press CW to start the spindle, and then return to auto state, press start key to start the program.
• M01 is program selective pause instruction. Before the program is executed, the op stop key on the control panel must be opened. The effect after execution is the same as that of M00. To restart the program, it is the same as above.
• M00 and M01 are often used for inspection of workpiece size or chip removal during machining.
• M02 is the main program end instruction. Execute this command, feed stop, spindle stop, coolant closed. But the program cursor stops at the end of the program.
• M30 is the main program end instruction. The function is the same as M02, the difference is that the cursor returns to the program head position, regardless of whether there are other program segments after M30. Learning programming in group 192963572 can help you.
1. ### Address D & H

Tool compensation parameters D and H have the same function and can be interchanged at will. They all represent the address name of compensation register in CNC system, but the specific compensation value is determined by the address of compensation number after them. However, in the machining center, in order to prevent errors, it is generally stipulated that h is the tool length compensation address, the compensation number is from 1 to 20, D is the tool radius compensation address, and the compensation number starts from 21 (the magazine of 20 tools).

1. ### Mirror Instruction

Mirror processing instructions M21, M22, M23. When only the x-axis or y-axis is mirrored, the cutting sequence CNC milling, cutter compensation direction and arc interpolation direction will be opposite to the actual program, as shown in Figure 1. When the x-axis and y-axis are mirrored at the same time, the sequence of tool feeding, the direction of tool compensation and the direction of arc interpolation remain unchanged.

Note: after using the mirror command, you must use M23 to cancel, so as not to affect the later program. In G90 mode, the mirror or cancel command can only be used after returning to the origin of workpiece coordinate system. Otherwise, the CNC system can not calculate the movement track behind, and the phenomenon of random tool walking will appear. At this time, it must be solved by manual origin return operation. The spindle steering does not change with the mirror command.

1. ### Circular Interpolation Instruction

G02 is clockwise interpolation and G03 is counterclockwise interpolation. In the XY plane, the format is as follows: G02 / g03x_ Y_ I_ K_ F_ Or G02 / g 03 x_ Y_ R_ F_ Where x and y are the coordinates of the end point of the arc, I and j are the incremental values from 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, and F is the feed rate.

In circular arc cutting, note that Q ≤ 180 ° R is a positive value; Q > 180 ° R is a negative value; I and K can also be specified by R. when both are specified at the same time, R command has priority and I and K are invalid; R can’t do round cutting. Round cutting can only be programmed by I, J and K, because there are countless circles with the same radius passing through the same point.

When I and K are zero, they can be omitted; regardless of G90 or G91 mode, I, J and K are programmed according to relative coordinates; when arc interpolation, cutter compensation instruction G41 / G42 cannot be used.