G codes & M-codes
G-code:
G-code which has many variants, is the common name for the most widely used numerical control (NC) programming language.
It is used mainly in computer-aided manufacturing for controlling automated machine tools. G-code is sometimes called G programming language.
In fundamental terms, G-code is a language in which people tell computerized machine tools how to make something. The how is defined by instructions on where to move, how fast to move, and through what path to move. The most common situation is that, within a machine tool, a cutting tool is moved according to these instructions through a toolpath, cutting away excess material to leave only the finished workpiece. The same concept also extends to noncutting tools such as forming or burnishing tools, photoplotting.
G-codes are also called preparatory codes, and are any word in a CNC program that begins with the letter G. Generally it is a code telling the machine tool what type of action to perform, such as:
-
Rapid move (transport the tool through space to the place where it is needed for cutting; do this as quickly as possible)
-
Controlled feed move in a straight line or arc
-
Series of controlled feed moves that would result in a hole being bored, a workpiece cut (routed) to a specific dimension, or a profile (contour) shape added to the edge of a workpiece
-
Set tool information such as offset
-
Switch coordinate systems
M-Codes:
M or miscellaneous codes are used to either turn ON or OFF different functions which control certain machine tool operations. They control machine auxiliary options like coolant and spindle direction. Only one M-code can appear in each block of code.
Uses of G codes and M codes:
G-codes Uses:
Sr.No.
|
Codes
|
Category
|
Function
|
1
|
G00
|
Motion
|
Move in a straight line at rapids speed.
|
2
|
G01
|
Motion
|
Move in a straight line at last speed commanded by a Feed rate
|
3
|
G02
|
Motion
|
Clockwise circular arc at Feed rate
|
4
|
G03
|
Motion
|
Counter-clockwise circular arc at Feed rate
|
5
|
G04
|
Motion
|
Dwell: Stop for a specified time.
|
6
|
G15
|
Co-ordinate
|
Turn Polar Coordinates OFF
|
7
|
G16
|
Co-ordinate
|
Turn Polar Coordinates ON
|
8
|
G17
|
Co-ordinate
|
Select X-Y plane
|
9
|
G18
|
Co-ordinate
|
Select X-Z plane
|
10
|
G19
|
Co-ordinate
|
Select Y-Z plane
|
11
|
G20
|
G-Code
|
Input in Inches
|
12
|
G21
|
G-Code
|
Input in Metrics
|
13
|
G27
|
G-Code
|
Reference Point Return Check
|
14
|
G28
|
G-Code
|
Automatic Zero Return
|
15
|
G29
|
G-Code
|
Return from Zero position
|
16
|
G31
|
G-Code
|
Skip Function
|
17
|
G36
|
G-Code
|
Automatic Tool Compensation
|
18
|
G40
|
G-Code
|
Tool Compensation Cancel
|
19
|
G50
|
G-Code
|
Co-ordinate System Setting
|
20
|
G52
|
G-Code
|
Local Coordinate System Setting
|
21
|
G53
|
G-Code
|
Machine Co-ordinate System Setting
|
22
|
G90
|
Co-ordinate
|
Absolute positioning
|
23
|
G91
|
Co-ordinate
|
Incremental positioning
|
M -codes Uses:
Sr. No.
|
Codes
|
Category
|
Function
|
1
|
M00
|
M-Code
|
Program Stop (non-optional)
|
2
|
M01
|
M-Code
|
Optional Stop: Operator Selected to Enable
|
3
|
M02
|
M-Code
|
End of Program
|
4
|
M03
|
M-Code
|
Spindle ON (CW Rotation)
|
5
|
M04
|
M-Code
|
Spindle ON (CCW Rotation)
|
6
|
M05
|
M-Code
|
Spindle Stop
|
7
|
M06
|
M-Code
|
Tool Change
|
8
|
M07
|
M-Code
|
Mist Coolant ON
|
9
|
M08
|
M-Code
|
Flood Coolant ON
|
10
|
M09
|
M-Code
|
Coolant OFF
|
Share with your friends: |