Numerical control machining programming is to compile a program list with instruction codes in accordance with the programming format according to the motion sequence of the processing parts, process parameters, workpiece size, direction of tool displacement, and other auxiliary actions (such as tool change, cooling, workpiece loading and unloading, etc.) the process of. The programmed program list is the processing program list.
1Determination of machine coordinate system and movement direction
The three coordinate systems X, Y, and Z of the machine’s linear motion adopt the right-hand Cartesian coordinate system, as shown in Figure 11-6. The coordinate axis definition sequence is to determine the Z axis first, then the X axis, and finally the Y axis. The machine tool that rotates the workpiece (such as a lathe) takes the tool away from the workpiece as the positive direction of the X axis; a machine tool that rotates the tool (such as a vertical Milling Machine), when the tool is the Z axis, face the tool spindle to the column Look, the right direction is the positive direction of the X axis.
The three rotation axis coordinate systems are parallel to the X, Y, and Z coordinate axes, and the forward direction of the right-hand thread is taken as the positive direction.
2Basic instructions of CNC lathe
1. Program format
The processing program is usually composed of three parts: program start, program content and program end.
The beginning of the program is the program number, which is used to mark the beginning of the processing program. The program number is usually represented by the character “%” and the following four digits.
The end of the program can be indicated by the auxiliary functions M02 (end of program), M30 (end of program, return to starting point), etc.
The main content of the program is composed of several program segments (BLOCK), the program segment is composed of one or several information words, and each information word is composed of an address character and a data character letter. Information word is the smallest unit of instruction.
2. Block format
At present, the word address block format is commonly used, and the application standard is JB3832-85.
The following is a typical word address program segment format:
N001 G01 X60.0 Z-20.0 F150 S200 T0101 M03 LF
Among them, N001-represents the first block
G01―indicating linear interpolation
X60.0 Z-20.0―respectively indicate the amount of movement in the X and Z coordinate directions
F, S, T-respectively indicate the feed rate, spindle speed, tool number
M03―means that the spindle rotates in a clockwise direction
LF-indicates the end of the block
3. Basic function codes in CNC system
(1) The sequence number of the program segment: N10, N20…
(2) Preparation function: G00-G99 are functions to make the numerical control device perform certain operations.
G codes are divided into modal codes and non-modal codes. The so-called modal code means that a certain G code (G01) is always valid once it is specified, and it cannot be replaced until the same group of G codes (G03) are used in the following block. The non-modal code is only valid in the specified block, and must be rewritten when needed in the next block.
(Such as G04).
1) Quick point positioning command G00
The G00 instruction is a modal code, which commands the tool to move quickly from the point where the tool is located to the next target position in a point positioning control mode. It is only for rapid positioning, and no movement trajectory requirements.
The instruction writing format is: G00 X_Z_; the actual movement path of the tool is not a straight line, but a broken line, so when using the G00 command, pay attention to whether the tool interferes with the workpiece emergency fixture. Ignoring this point, it is easy to collide, and in the fast state The collision underneath is more dangerous.
2) Linear interpolation command G01
The linear interpolation command is a linear motion command and also a modal code. It commands the tool to make a linear motion with any slope at the specified F feed rate (unit: mm/min) in interpolation linkage mode between two coordinates or three coordinates.
The instruction writing format is: G01 X_Z_F_; F instruction is also a modal instruction, and it can be cancelled with G00 instruction. If there is no F command in the block before the G01 block, the machine does not move. Therefore, there must be an F command in the G01 program.
3) Circular interpolation command G02/G03 (using Cartesian coordinates to judge)
The circular interpolation command instructs the tool to make circular motions in the specified plane at the given F feed rate, cutting out circular arc contours. When machining an arc on a lathe, not only use G02/G03 to indicate the clockwise direction of the arc, use XZ to specify the end point coordinates of the arc, but also specify the radius of the arc.
The instruction writing format is: G02/G03 X_Z_R_;
(3) Auxiliary function: used to specify the auxiliary actions of the machine tool (such as machine start and stop, steering, cutting fluid switch, spindle steering, tool clamping release, etc.)
M01-Program plan suspended
M02-end of program
M03-Spindle forward rotation (CW)
M04-Spindle reversal (CCW)
M06-Tool change in machining center
M07, M08-coolant on
M30-end of program, return to starting point
The M05 command must be used to stop the spindle between M03 and M04 commands.
(4) Feed function F
If the direct designation method is used, write the required feed rate directly after F, such as F1000, which means the feed rate is 1000mm/min); when threading, tapping and threading, because the feed rate is related to the spindle speed, The number after F is the specified lead.
(5) Spindle function S
S specifies the spindle speed, such as S800, which means that the spindle speed is 800r/min.
(6) Tool function T
Instruct the CNC system to change the tool, use the address T and the following 4 digits to specify the tool number and tool compensation number (tool offset number). The first 2 digits are the tool serial number: 0~99, and the last 2 digits are the tool compensation number: 0~32. After each tool processing is finished, the tool compensation must be canceled.
The tool serial number can correspond to the tool position number on the cutter head;
Tool compensation includes shape compensation and wear compensation;
The tool serial number and tool compensation number do not have to be the same, but can also be the same for convenience.
In the numerical control device, the record of the program is distinguished by the program number, that is, the calling program or the editing program must be called by the program number.
1. The structure of the program number: O;
The number behind “O” is represented by 4 digits (1~9999), and “0” is not allowed.
2. Sequence number of block: add sequence number before the block, such as: N;
The number behind “O” is represented by 4 digits (1~9999), and “0” is not allowed.
Workpiece coordinate system setting
The workpiece is installed on the chuck, and the machine coordinate system and the workpiece coordinate system generally do not overlap. To facilitate programming, a workpiece coordinate system should be established so that the tool can be processed in this coordinate system.
G50 X Z
This command specifies the distance from the tool starting point or tool change point to the workpiece origin. Coordinates X and Z are the starting point of the tool tip in the workpiece coordinate system.
For cnc machine tools with tool compensation function, the tool setting error can be compensated by tool offset, so the requirements for adjusting the machine tool are not strict.
Basic tool setting method of CNC lathe
There are three commonly used tool setting methods: trial cutting tool setting method, mechanical inspection tool setting tool setting, and optical inspection tool setting tool setting.
Using G50 U W can make the coordinate system produce translation, replace the old coordinate value with the new coordinate value, and make the machine coordinate system and the workpiece coordinate system replace each other. It should be noted that in the machine tool coordinate system, the coordinate value is the distance between the tool post center point and the machine origin; and in the workpiece coordinate system, the coordinate value is the distance between the tool tip and the workpiece origin.