Structure and Common Codes of CNC Lathe Machining Program

CNC lathe programs can be divided into three parts: program start, program content, and program end.


The First Part of the CNC Lathe Program-Start


It mainly defines the program number, calls the part processing coordinate system, processing tool, starts the spindle, and opens the cooling fluid.


The highest spindle speed limit is defined as G50 S2000, and the highest spindle speed is set to 2000RPM, which is a very important instruction for CNC lathe.


It is defined that unless otherwise specified, the CNC system defaults to the G54 coordinate system.


The return reference point instruction is G28 U0. In order to avoid collision and/or interference between the tool holder and the workpiece or fixture during tool change, an effective method is that the machine tool first returns to the reference point of the machine tool in the X-axis direction and leaves a safe distance from the spindle.


The tool is defined as G0 T0808 M8, and the 8th left tool and 8th tool compensation are automatically adjusted, and the cooling fluid is turned on.


The spindle speed is defined as G96 S150 M4, and the constant linear speed S function is defined. The S function enables the spindle speed instruction function of the CNC lathe. There are two ways to express it, one is to measure in r/min or rpm. The other measures in meters/minute. Numerical control lathe s code must be used in conjunction with G96 or G97 to set spindle speed or cutting speed.


G97: speed instruction, defines and sets each minute speed.


G96: constant linear speed instruction, which makes the cutting speed at any position of the workpiece the same.


The Second Part of the CNC Lathe of the Program-Content


The content is the main part of the whole program and is composed of several program fragments. Each program segment is composed of several words, each word is composed of an address code and several numbers. The common program segment is composed of G instruction, M instruction and various axis coordinate points, and the definition of feed speed is added.


F is a function of feed speed. There are two ways to express the feed speed of the CNC lathe. One is the feed amount per revolution, expressed in mm/r, mainly used for the feed amount of the lathe. The other is the same as the CNC milling machine, using the feed rate per minute, that is expressed in mm/min. Mainly used for milling feed in the machining center of the lathe.


The Third Part of the CNC Lathe Program-End


When the program ends, the tool holder needs to return to the reference point or the reference point of the machine tool, which is the safe position for the next tool change. Also, stop the spindle, turn off the cooling fluid, and choose to stop or end the program.


The reference point instruction G28U0 is the X-axis reference point of the machine tool, and G0 Z300.0 is the Z-axis reference point.


The stop instruction M01 is the choose stop instruction, which is only effective when the device's choose stop switch is turned on; M30 is the program end instruction. When it is executed, the cooling fluid, feed, and spindle all stop. Reset the CNC program and CNC device and restore them to the original state before machining, preparing for the next program operation and restarting the CNC machining.