Products Catalogue Home     |     About Us    |     Retrofit     |     Download     |     News     |     Tech Support     |     Contact Us     |     
ppr fittings-NF-4011-Newsun Industry Co., Ltd
Home > Tech Support >

CNC machining center CNC programming

1. Pause instruction
G04X(U)_/P_ refers to the tool pause time (the feed stops, the spindle does not stop), and the value after the address P or X is the pause time. The value after X must have a decimal point, otherwise it is calculated in one thousandth of this value, in seconds (s), and the value after P cannot have a decimal point (that is, expressed as an integer), in milliseconds (ms).
For example, G04X2.0; or G04X2000; pause for 2 seconds
G04P2000;
However, in some hole machining commands (such as G82, G88 and G89), in order to ensure the roughness of the hole bottom, there is a pause time when the tool reaches the bottom of the hole. At this time, it can only be expressed by the address P. Address X indicates that the control system considers X to be the coordinate value of the X axis and executes it.
E.g
G82X100.0Y100.0Z-20.0R5.0F200P2000; Drill (100.0, 100.0) to the bottom of the hole and pause for 2 seconds
G82X100.0Y100.0Z-20.0R5.0F200X2.0;
Drilling (2.0, 100.0) to the bottom of the hole will not pause.
2. The difference and connection of M00, M01, M02 and M30
M00 is an unconditional program pause instruction. When the program is executed, the feed stops and the spindle stops. To restart the program, you must first return to the JOG state, press CW (spindle forward rotation) to start the spindle, and then return to the AUTO state, press the START key to start the program.
M01 is a program selective pause command. The OPSTOP key on the control panel must be turned on before the program is executed. The effect after execution is the same as M00, and the program must be restarted as above.
M00 and M01 are often used to check the size of the workpiece in the middle of processing or to remove chips.
M02 is the main program end instruction. When this instruction is executed, the feed will stop, the spindle will stop, and the coolant will shut down. 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, but the difference is that the cursor returns to the program head position, regardless of whether there are other blocks after M30.
3. Addresses D and H have the same meaning
The tool compensation parameters D and H have the same function and can be interchanged arbitrarily. They both represent the address name of the compensation register in the CNC system, but the specific compensation value is determined by the compensation number address behind them. However, in the machining center, in order to prevent errors, generally 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 (tool magazine with 20 tools).
For example, G00G43H1Z100.0;
G01G41D21X20.0Y35.0F200;
4. Mirror instruction
Mirror processing instructions M21, M22, M23. When only the X-axis or Y-axis is mirrored, the cutting sequence (climb milling and up-cut milling), tool compensation direction, and circular interpolation direction will all be opposite to the actual program, as shown in Figure 1. When mirroring the X-axis and Y-axis at the same time, the cutting sequence, tool compensation direction, and circular interpolation direction are all unchanged.
Note: M23 must be used to cancel after the mirroring instruction is used to avoid affecting the subsequent programs. In G90 mode, when using mirror image or cancel command, it can only be used after returning to the origin of the workpiece coordinate system. Otherwise, the CNC system cannot calculate the subsequent motion trajectory, and random tool movement will occur. At this time, the manual origin return operation must be implemented to solve the problem. The rotation of the spindle does not change with the mirroring command.
Figure 1 Tool compensation, forward and reverse changes during mirroring
5. Circular interpolation command
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/G
03X_Y_R_F_, where X and Y are the coordinates of the arc end point, I and J are the incremental values ​​from the arc start point to the center on the X and Y axes, R is the arc radius, and F is the feed.
Pay attention to the arc cutting, 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, the R command has priority, I , K is invalid; R cannot be used for full circle cutting, and full circle cutting can only be programmed with I, J, K, because there are countless circles with the same radius after the same point, as shown in Figure 2.
Figure 2 A circle 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 all programmed according to relative coordinates; during circular interpolation, tool compensation commands G41/G42 cannot be used.
6. The advantages and disadvantages between G92 and G54~G59
G54~G59 is the coordinate system set before processing, and G92 is the coordinate system set in the program. If G54~G59 is used, there is no need to use G92, otherwise G54~G59 will be replaced and should be avoided, such as Table 1 shows.
Table 1 The difference between G92 and working coordinate system
Note: (1) Once G92 is used to set the coordinate system, using G54~G59 will not have any effect, unless the system is restarted after power off, or G92 is then used to set a new workpiece coordinate system. (2) After the program using G92 ends, if the machine tool does not return?
If the origin point is set by 92, the program is restarted, and the current position of the machine tool becomes the origin point of the new workpiece coordinate, which is prone to accidents. Therefore, I hope readers use it with caution.
7. Compile the tool change subroutine.
On machining centers, tool changes are inevitable. However, the machine tool has a fixed tool change point when it leaves the factory. If it is not at the tool change position, the tool cannot be changed. Before the tool is changed, the tool compensation and cycle must be cancelled, the spindle stops, and the coolant is turned off. There are many conditions. If you must ensure these conditions before manually changing the tool, it is not only error-prone but also inefficient. Therefore, we can compile a tool-changing program to save the low-level tool. M98 call can complete the tool change action at one time.
Take PMC-10V20 machining center as an example, the procedure is as follows:
O2002; (program name)
G80G40G49; (cancel fixed cycle, tool compensation)
M05; (Spindle stop)
M09; (Coolant closed)
G91G30Z0; (Z axis returns to the second origin, that is, the tool change point)
M06; (tool change)
M99; (End of subroutine)
When you need to change the tool, you only need to enter "T5M98P2002" in the MDI state to replace the required tool T5, thus avoiding many unnecessary mistakes. Readers can compile corresponding tool change subroutines according to the characteristics of their own machine tools.
8. other
The sequence number of the block is represented by the address N. Generally, the memory space of the numerical control device itself is limited (64K). In order to save storage space, the sequence number of the program segment is omitted. N only represents the block number, which is convenient for searching and editing the program, and has no effect on the machining process. The sequence number can be increased or decreased, and the continuity of the value is not required. However, certain cycle instructions, jump instructions, subroutine calls and mirroring instructions cannot be omitted.
9. In the same program segment, the same instruction (same address character) or the same group of instructions will take effect after appearing.
For example, the tool change program, T2M06T3; T3 instead of T2;
G01G00X50.0Y30.0F200; G00 is executed (Although there is an F value, G01 is not executed).
Command codes that are not in the same group will have the same effect in the same block.
G90G54G00X0Y0Z100.0;
G00G90G54X0Y0Z100.0;
All the above items are running and passing on PMC-10V20 (FANUCSYSTEM) machining center. In practical applications, only a deep understanding of the usage and programming rules of various instructions.

—[Close]— —[ Back]— —[ Print]—