Thursday, September 27, 2018

G Code and M Code

First of all the question is what is G and M Code? What is the use of it? How to use of it?

The machines Computer Numeric Control is called CNC Machine in short. These machines are operated by the G code and M code. CNC machine used to cutting the metal in various shape by making a program of G and M code. The momentum and motion are defined the G code and the action taken by the machine is done by M code. Here I am talking about 3 axis milling and here are some G and M code of it. These are basic ISO standard generic code which are mostly based on Fanuc, Haas, Mitshubishi Controller

G CODE

CODE
Function
G00
Rapid move in straight line
G01
Move in straight line by given feed rate
G02
Move in Clockwise Circular arc in given feed rate
G03
Move in Counter Clockwise Circular arc in given feed rate
G04
Stop for a specified time. Dwell time
G10
Programmable parameter input
G15
Polar Coordinates OFF, return to Cartesian Coordinates
G16
Polar Coordinates ON
G17
X-Y plane selection
G18
X-Z plane selection
G19
Y-Z plane selection
G20
Program coordinates are in inches
G21
Program coordinates are in mm
G27
Reference point return
G28
Return to home position
G29
Return from the reference position
G30
Return to the 2nd, 3rd, and 4th reference point
G32
Constant lead threading
G40
cutter compensation off 
G41
cutter compensation (LEFT)
G42
Tool cutter compensation (RIGHT)
G43
length compensation plus
G44
  length compensation Minus
G49
length compensation cancel
G50
Reset all scale factors to 1.0
G51
 scale factors on
G52
Local workshift for all coordinate systems
G53
Cancel work offsets
G54
1st Work coordinate system
G55
2nd Work coordinate system
G56
3rd Work coordinate system
G57
4th Work coordinate system
G58
5th Work coordinate system
G59
6th Work coordinate system
G61
Check mode Exact stop 
G62
Corner override Auto
G63
Tapping mode
G64
Best speed path(Not used in Mitshubishi)
G65
Custom macro simple call
G68
 Rotation of Coordinate System
G69
Coordinate System Rotation Cancel 
G73
Drilling cycle (small retract)
G74
Left hand tapping cycle
G76
Fine boring cyle
G80
Cancel canned cycle
G81
Drilling cycle
G82
Drilling cycle with dwell 
G83
Peck drilling cycle (retract up to set)
G84
Tapping cycle
G85
Boring canned cycle, no dwell
G86
Boring canned cycle, spindle stop, rapid out
G87
canned cycle Back boring 
G88
Boring canned cycle, spindle stop, manual out
G89
Boring canned cycle, dwell, feed out
G90
Absolute programming of XYZ (type B and C systems)
G90.1
Absolute programming IJK (B and C systems)
G91
Incremental programming of XYZ (B and C systems)
G91.1
Incremental programming IJK (type B and C systems)
G92
Offset coordinate system and save parameters
G92 
Clamp of maximum spindle speed
G92.1
Cancel offset and zero parameters
G92.2
Cancel offset and retain parameters
G92.3
Offset coordinate system with saved parameters
G94
Units per minute feed mode. Units in inches or mm.
G95
Units per revolution feed mode. Units in inches or mm.
G96
Constant surface speed
G97
Cancel constant surface speed
G98
Return to initial Z plane after canned cycle
G99
Return to initial R plane after canned cycle


M CODE

CODE
Function
M01
Optional Stop
M02
Program End
M03
Spindle ON Clockwise
M04
Spindle On Counter Clockwise
M05
Spindle Stop
M06
Tool Change
M07
Coolant On Mist.
M08
Coolant On Flood
M09
Coolant OFF
M29
Rigid Tapping Mode

In next post i will come with some example of G Code and M Code Program with simulation.