G-CODE & M-CODE USED IN CNC (SSK)
What is G-Code?
G-Code = Geometric / Motion commands
These codes control tool movement in CNC machines.
🔹 What
G-Codes do
- Move
tool in straight lines or curves
- Set
units (mm/inch)
- Set
work coordinate system
- Perform
drilling cycles
- Control
feedrate mode
- Positioning
modes
⭐ IMPORTANT
G-CODES with Meaning
1. G00 – Rapid Positioning
Moves tool fast (no cutting).
Used to move above the part safely.
2. G01 – Linear Interpolation
Straight-line cutting with feedrate (F).
3. G02 – Circular Interpolation
(Clockwise)
Used for arcs and circles.
4. G03 – Circular Interpolation
(Counter-clockwise)
5. G20 – Programming in Inches
6. G21 – Programming in Millimetres
7. G17 / G18 / G19 – Plane Selection
- G17
= XY plane
- G18
= ZX plane
- G19
= YZ plane
8. G40 / G41 / G42 – Cutter Compensation
- G40
= Cancel
- G41
= Left compensation
- G42
= Right compensation
9. G90 – Absolute Programming
Coordinates taken from datum (zero).
10. G91 – Incremental Programming
Coordinates taken from last position.
11. G94 – Feed per minute
12. Common Drilling Cycle G-Codes
- G73
– Peck drilling (high-speed)
- G81
– Simple drilling
- G83
– Deep hole peck drilling
- G84
– Tapping cycle
✅ What
is M-Code?
M-Code = Machine commands
These codes control machine functions (not tool path).
🔹 What
M-Codes do
- Start/Stop
spindle
- Start/Stop
coolant
- Tool
change
- Program
stop/end
⭐ IMPORTANT
M-CODES with Meaning
1. M00 – Program Stop
Stops program until operator presses cycle start.
2. M01 – Optional Stop
Stops only if optional stop button is ON.
3. M03 – Spindle ON (Clockwise)
4. M04 – Spindle ON (Counter-clockwise)
5. M05 – Spindle OFF
6. M06 – Tool Change
7. M08 – Coolant ON
8. M09 – Coolant OFF
9. M30 – Program End & Reset
Goes back to beginning of program.
📌 Simple
Example CNC Program
N10 G21
(Units in mm)
N20 G90 (Absolute mode)
N30 G00 X0 Y0
(Rapid to start point)
N40 G01 X50 F200 (Cut straight line)
N50 G02 X70 Y20 R20 (CW Arc)
N60 M05
(Spindle OFF)
N70 M30
(Program end)
Comments