G code instruction of CNC milling machine

G code instruction for CNC milling machine

G code
Code name-function description
G00——quick positioning
G01——linear interpolation
G02—- –Clockwise circular interpolation
G03——counterclockwise circular interpolation
G04——timing pause
G05——pass the middle Point arc interpolation
G07——Z spline curve interpolation
G08——feed acceleration
G09——feed deceleration
G20——subroutine call
G22——radius size programming method
G220—–used on the system operation interface
G23——diameter size Programming method
G230—–use on the system operation interface
G24——subroutine end
G25——jump processing
G26—- –Cycle processing
G30——Override cancellation
G31——Override definition
G32——Equal pitch thread cutting, inch system
G33– —- Equal-pitch thread cutting, metric
G53, G500-set the workpiece coordinate system to cancel
G54 —— set the workpiece coordinate system one
G55 —— set Set workpiece coordinate system 2
G56——set workpiece coordinate system 3
G57——set workpiece coordinate system 4
G58——set workpiece Coordinate system 5
G59——Set workpiece coordinate system 6
G60——Accurate path mode
G64——Continuous path mode
G70——Inch size inch
G71——Metric size mm
G74—- –Back to reference point (machine zero point)
G75——return to zero point of programming coordinates
G76——return to starting point of programming coordinates
G81——outer circle Canned cycle
G331—–thread canned cycle
G90——absolute size
G91——relative size
G92——prefabricated coordinates
G94——feed rate, feed per minute
G95——feed rate, feed per revolution
Detailed explanation of function

G00—quick Positioning

Format: G00 X(U)__Z(W)__
Explanation: (1) This command makes the tool move quickly to the specified position according to the point control mode. The workpiece
shall not be processed during the movement.
(2) All the programmed axes move at the speed defined by the parameters at the same time. When a certain axis reaches the programmed value, it stops, while the other
axes continue to move.
(3) The coordinates that do not move do not need to be programmed.
(4) G00 can be written as G0
For example: G00 X75 Z200
G0 U-25 W-100

First, X and Z walk 25 at the same time to reach point A quickly, and then move to Z Take 75 fast to point B.
G01—Linear Interpolation
Format: G01 X(U)__Z(W)__F__(mm/min)
Explanation: (1) This command makes the tool move to the specified position according to the linear interpolation method. The moving speed is determined by the F command
Feed speed. All coordinates can be linked to run.
(2) G01 can also be written as G1
Example: G01 X40Z20 F150
Two-axis linkage from point A to point B
G02—inverse circular interpolation

Format 1: G02 X(u)____Z(w)____I____K____F_____
Description: (1) When X and Z are in G90, the arc end point coordinates are absolute coordinates relative to the programmed zero point. In G91,
The arc end point is the incremental value relative to the arc start point. Regardless of G90 or G91, I and K are the coordinates of the end point of the arc.
I is the value in the X direction, and K is the value in the Z direction. The circle center coordinates cannot be omitted during circular interpolation, unless programmed in other formats.
(2) When programming the G02 command, you can directly program quadrant circles, full circles, etc.
Note: When crossing the quadrant, the backlash compensation will be performed automatically. If there is a big difference between the input backlash compensation at the end of the parameter area and the actual backlash
of the machine tool, obvious cut marks will be produced on the workpiece.
(3) G02 can also be written as G2.
Example: G02 X60 Z50 I40 K0 F120
Format 2: G02 X(u)____Z(w)____R(+\-)__F__
Explanation: (1) Cannot be used for full circle programming
> (2) R is the radius of the R arc on one side of the workpiece. R is a symbol, “+” indicates that the arc angle is less than 180 degrees;
“-” indicates that the arc angle is greater than 180 degrees. Among them, “+” can be omitted.
(3) It is based on the coordinates of the end point. When the length between the end point and the starting point is greater than 2R, the arc is replaced by a straight line.
Example: G02 X60 Z50 R20 F120
Format 3: G02 X(u)____Z(w)____CR=____(radius) F__
Format 4: G02 X(u)____Z(w)____D____(diameter ) F___
These two programming formats are basically the same as format 2
G03—circular interpolation

Explanation: Except that the arc rotation direction is opposite, the format is the same as G02 command.
G04—timed pause
Format: G04__F__ or G04 __K__
  Explanation: The processing movement is suspended, and the processing will continue after the time is up. The pause time is specified by the data following F. The unit is seconds.
The range is 0.01 seconds to 300 seconds.
G05—Circular interpolation through the intermediate point

Format: G05 X(u)____Z(w)____IX_____IZ_____F_____
Explanation: (1) X, Z are the coordinates of the end point, IX, IZ are The coordinate value of the middle point. Others are similar to G02/G03
Example: G05 X60 Z50 IX50 IZ60 F120
G08/G09—feed acceleration/deceleration

Format: G08
Explanation: They occupy alone in the block One line, when the program runs to this section, the feed rate will increase by 10%.
If you want to increase 20%, you need to write two separate sections.
G22(G220)—radius size programming method

Format: G22
Explanation: If it occupies a single line in the program, the system operates in radius mode, and the following values ​​in the program are also
Radius prevails.
G23(G230)—diameter size programming method
Format: G23
Explanation: If it occupies a single line in the program, the system will run in diameter mode, and the following values ​​in the program are also based on the diameter
G25—jump processing

Format: G25 LXXX
Explanation: When the program executes to this program, it will transfer to the block specified by it. (XXX is the block number).
G26—Cycle Processing
Format: G26 LXXX QXX
Explanation: When the program executes to this program, the specified program segment starts to this segment as a cycle body,
The number of cycles is determined by Q The following values ​​are determined.
G30—magnification cancellation

Format: G30
Explanation: Occupy a single line in the program, used in conjunction with G31, to cancel the function of G31.
G31—magnification definition

format: G31 F_____
G32—equal pitch thread processing (imperial system)
G33—equal pitch thread processing (metric system)
Format: G32/G33 X(u)____Z(w)____F____
Explanation: ( 1) X and Z are the coordinates of the end point, and F is the thread pitch
(2) G33/G32 can only process single-pole and single-start threads.
(3)The change of X value can process taper thread.
G50—set workpiece coordinates/set the maximum (low) spindle speed
Format: G50 S____Q____#p#page title#e#
Explanation: S is the maximum spindle speed, Q is the minimum spindle speed
> G54—Set workpiece coordinates 1
Format: G54
Explanation: There can be several coordinate systems in the system, G54 corresponds to the first coordinate system, and its origin position value is set in the machine tool
parameter Certainly.
G55—Set workpiece coordinate 2
Same as above
G56—Set workpiece coordinate 3
Same as above
G57—Set workpiece coordinate 4
Same as above
G58—Set workpiece Coordinate 5
Same as above
G59—Set workpiece coordinate 6
Same as above
G60—Exact path method

Format: G60
Explanation: In the actual processing process, several When the actions are connected together, when programming with the exact path, there will be a buffering process (that is, deceleration) when performing
the next section of processing
G64—continuous path mode

Format: G64
Explanation: Relative to G60. Mainly used for rough machining.
G74—back to reference point (machine zero point)
Format: G74 X Z
Explanation: (1) No other content may appear in this paragraph.
(2) The coordinates appearing after G74 will return to zero in order of X and Z.
(3) Before using G74, it must be confirmed that the machine tool is equipped with a reference point switch.
(4) Single-axis zero return can also be performed.
G75—return to programming coordinate zero point
Format: G75 X Z
Description: return to programming coordinate zero point
G76—return to programming coordinate starting point
Format: G76
Description: return to tool start processing location.
G81—outer circle (inner circle) canned cycle
Format: G81__X(U)__Z(W)__R__I__K__F__
Explanation: (1) X, Z are the coordinates of the end point, U, W are relative to the end point Increment value for the current point.
(2) R is the diameter to be processed of the starting section.
(3) I is feed for roughing, K is feed for finishing, I and K are signed numbers, and the signs of the two should be the same.
The sign convention is as follows: cutting from the outside to the central axis (turning the outer circle) is “—”, and vice versa is “+”.
(4) Different X, Z, R determine the different switches of the outer circle, such as: with taper or no degree,
forward taper or reverse taper, left cutting or right cutting, etc.
(5) F is the cutting speed (mm/min)
(6) After the machining is finished, the tool stops at the end point.
Example: G81 X40 Z 100 R15 I-3 K-1 F100
1: G01 feed twice I (the first cut is I, the last cut is I+K finish turning ), carry out deep cutting:
2: G01 two-axis interpolation, cut to the end section, stop if the machining is finished:
3: G01 retract the tool to a safe position, and perform auxiliary cutting surface smoothing at the same time
4: G00 rapid feed to the outside of the high working plane I, reserve I for the next cutting process, repeat to 1.
 G90—programming in absolute value mode
Format: G90
Explanation: (1) When G90 is programmed, all subsequent programmed coordinate values ​​are based on the programmed zero point.
(2) After the system is powered on, the machine tool is in G state.
N0010 G90 G92 x20 z90
N0020 G01 X40 Z80 F100
N0030 G03 X60 Z50 I0 K-10
N0040 M02
G91—incremental programming

Format: G91
Explanation: When G91 is programmed, all coordinate values ​​will use the previous coordinate position as the starting point to calculate the programmed value of
motion. In the next coordinate system, the previous point is always used as the starting point for programming.
Example: N0010 G91 G92 X20 Z85
N0020 G01 X20 Z-10 F100
N0030 Z-20
N0040 X20 Z-15
N0050 M02
G92—set workpiece coordinate system

Format: G92 X__ Z__
Explanation: (1) G92 only changes the coordinate value currently displayed by the system, and does not move the coordinate axis to achieve the purpose of setting the origin of the coordinate
(2) The effect of G92 is to change the displayed tool nose coordinates to the set value.
(3) The XZ behind G92 can be programmed separately or all of them.
G94—feed rate, feed per minute
Note: This is the default state of the machine tool.
G20—subroutine call
Format: G20 L__
Explanation: (1) After L is the program name after N of the subroutine to be called, but N cannot be input.
Only numbers 1~99999999 are allowed after N.
(2) This program must notSomething other than the above description appears.
G24—return at the end of the subroutine

Format: G24
Explanation: (1) G24 means the end of the subroutine, and return to the next segment of the subroutine.
(2) G24 and G20 appear in pairs
(3) This section of G24 does not allow other instructions to appear.
[Edit this paragraph]Example

Example: Use the following example to illustrate the transfer process of parameters in the process of subroutine calling, please pay attention to the application of
Program name: P10
M03 S1000
G20 L200
N200 G92 X50 Z100
G01 X40 F100
G02 Z92 X50 I10 K0 F100
G01 Z-25 F100
G00 X60
If you want to call multiple times, please use the following format
M03 S1000
N100 G20 L200
N101 G20 L200
N105 G20 L200
N200 G92 X50 Z100
G01 X40 F100
G02 Z92 X50 I10 K0 F100
G01 Z-25 F100
G00 X60
G331—thread processing cycle
Format: G331 X__ Z__I__K__R__p__
Description: (1) X direction diameter changeX=0 is the straight thread
(2) Z is the thread length, absolute or relative programming can be used
(3) I is the retraction length in the X direction after the thread is cut, ± value
(4) The diameter difference between the outer diameter of the R thread and the root diameter, positive value
(5) K pitch KMM
(6) Cycle processing times of the p thread, that is, several cuts to complete the cutting
1. The depth of each feed is R÷p and rounded up, and the thread surface is smoothed without feed in the last cut.
2. The title of I value is determined according to the positive and negative directions of X for internal thread retraction.
3. The starting position of the thread processing cycle is to align the tool tip with the outer circle of the thread.
G4 f2
G0 x30 z0
G331 z-50 x0 i10 k2 r1.5 p5
G0 z0
[edit this paragraph ]Notes

1. G00 and G01
There are two types of G00 motion trajectory, straight line and broken line. This command is only used for point positioning, not for cutting processing
G01 Move to the target point specified by the command in a linear motion at the specified feed speed, generally used for cutting
2, G02 and G03
G02: clockwise circular interpolation G03: counterclockwise circular interpolation
3. G04 (delay or pause command)
is generally used for forward and reverse switching, machining blind holes, stepped holes, turning grooving
4, G17, G18, G19 plane selection commands, specifying plane processing , generally used for milling machines and machining centers #p#page title#e#
G17: X-Y plane, can be omitted, or it can be a plane parallel to the X-Y plane
G18: X-Z plane or a plane parallel to it, There is only the X-Z plane in the CNC lathe, and there is no need to specify
G19: Y-Z plane or a plane parallel to it
 5, G27, G28, G29 reference point command
G27: Return to the reference point, check and confirm the reference point position
G28: Automatically return to the reference point (passing the intermediate point)
G29: Return from the reference point , used in conjunction with G28
6, G40, G41, G42 Radius compensation
G40: cancel tool radius compensation
First give this much, and give it to you after finishing it at night
7, G43, G44, G49 Length compensation
G43: Positive length compensation G44: Negative length compensation G49: Cancel tool length compensation
8, G32, G92, G76
G32: Thread cutting G92: Thread cutting canned cycle G76: Thread cutting compound cycle
9. Turning: G70, G71, 72, G73
G71: Axial rough turning compound cycle command G70: Finishing compound cycle G72: Face turning, radial rough turning cycle G73: Copy rough turning cycle
10. Milling machine, machining center:
G73: High-speed deep hole pecking drilling G83: Deep hole pecking drilling G81: Drilling cycle G82: Deep hole drilling cycle
G74: Left-handed thread processing G84: Right-handed Thread processing G76: Fine boring cycle G86: Boring cycle
G85: Reaming G80: Cancel cycle command
11. Programming methods G90, G91
G90: Absolute coordinate programming G91: Incremental coordinate programming
12. Spindle setting command
G50: setting of maximum spindle speed G96: constant linear speed control G97: spindle speed control (cancel constant linear speed control command) G99: return to point R (middle hole) G98 : Return to the reference point (last hole)
13. Spindle forward and reverse stop command M03, M04, M05
M03: Spindle forward M04: Spindle reverse M05: Spindle stop
14. Cutting fluid switch M07, M08, M09
M07: mist cutting fluid on M08: liquid cutting fluidOn M09: cutting fluid off
15, motion stop M00, M01, M02, M30
M00: program pause M01: plan stop M02: machine tool reset M30: program end, pointer returns to the beginning
16, M98 : Call subroutine
17, M99: Return to main program

Leave a Reply

Your email address will not be published. Required fields are marked *