The structure and common code of the CNC lathe machining program
The CNC car program can be divided into three parts:program start,program content and program end.
The first part of the program begins
Mainly define the program number,call out the part machining coordinate system,machine tool,start the spindle,open the coolant and so on.
The maximum spindle speed limit is defined as G50 S2000,and the maximum spindle speed is set to 2000 RPM.This is a very important command for CNC lathes.
If the coordinate system definition is not specified,the CNC system defaults to the G54 coordinate system.
Return to the reference point command G28 U0.In order to avoid collision and/or interference between the tool holder and the workpiece or fixture during the tool change,an effective method is to return the machine to the machine reference point in the X-axis direction and leave the spindle.A safe interval.
The tool definition G0 T0808 M8,automatically adjust the No.8 left offset knife No.8 knife to fill the coolant.
The spindle speed is defined by G96 S150 M4.The constant linear speed S function is defined.The S function makes the spindle speed command function of the CNC lathe.There are two expressions,one is r/min or rpm.The other is measured in m/min.The S code of the CNC lathe must be used with G96 or G97 to set the spindle speed or cutting speed.
G97:Speedcommand,define and set the speed per minute.
G96:Constant line speed command so that the cutting speed is the same at any position on the workpiece.
The second part of the program content
Program content is the main part of the entire program and consists of multiple program segments.Each block consists of several words,each of which consists of an address code and several numbers.Commonly used are the G command and the M command and the block of coordinate points of each axis,and the function definition of the feed amount is added.
The F function refers to the function of the feed speed.There are two expressions of the CNC lathe feed speed.One is the feed per revolution,which is expressed in mm/r units,and is mainly used for the feed of the machining.The other type uses the same feed per minute as the CNC milling machine,ie expressed in mm/min units.It is mainly used for the feeding of milling in the turning and milling center.
The third part of the program end
At the end of the program,the tool holder needs to return to the reference point or the machine reference point,which is the safe position of the next tool change.At the same time,the spindle stops,the coolant is turned off,and the program selects to stop or end the program.
The reference point reference G28U0 is the machine reference point back to the X-axis direction,and G0 Z300.0 is the reference point back to the Z-axis direction.
The stop command M01 is a stop command selected.It is valid only when the device selects the stop switch to open.M30 is the program end command.When executed,the coolant,feed,and spindle are all stopped.The NC program and the CNC device are reset and returned to the original state before machining,preparing for the next program run and NC machining restart.