Inst ToolsInst ToolsInst Tools
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Search
  • Books
  • Software
  • Projects
  • Process
  • Tools
  • Basics
  • Formula
  • Power Plant
  • Root Cause Analysis
  • Electrical Basics
  • Animation
  • Standards
  • 4-20 mA Course
  • Siemens PLC Course
Reading: Various Codes used in CNC Programming
Share
Notification Show More
Font ResizerAa
Inst ToolsInst Tools
Font ResizerAa
  • Courses
  • Design
  • PLC
  • Interview
  • Control System
Search
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Inst Tools > Blog > Common > Various Codes used in CNC Programming

Various Codes used in CNC Programming

A CNC program uses two types of codes G-code and M-code. G-code to run CNC mills, while M-codes are for routers.

Last updated: February 8, 2023 12:54 pm
Shiv Kumar
Common
No Comments
Share
7 Min Read
SHARE

Computer Numerical Control (CNC) programming is a method used by manufacturers to create program instructions for computers to control a CNC machine.

Contents
What are the types of codes available in CNC programming?What is G Code?What is M Code?G-Codes and M-Codes used in CNC programmingHow to Read G Codes?How to Read M Codes?Common G-CodesCommon M-Codes

This CNC programming is highly involved in the manufacturing process to improve automation and increase flexibility.

What are the types of codes available in CNC programming?

  • A CNC program uses two types of codes G-code and M-code.
  • G-code to run CNC mills, while
  • M-codes are for routers.
  • Both these types of codes are necessary for programming a CNC machine for various processes.
Various Codes used in CNC Programming

What is G Code?

A G code in CNC programming controls the machine movements to define how and where a machine should move to fabricate a part.

What is M Code?

An M code in CNC programming controls miscellaneous machine functions, including starting and stopping actions of the machine.

G-Codes and M-Codes used in CNC programming

Both these G-Codes and M-Codes work together to manufacture essential parts and components in the manufacturing and industrial sectors.

How to Read G Codes?

  • G code file breaks lengthy complicated contents into Cartesian coordinates and markers.
  • Each string of numbers has an order, and the G codes follow a careful structure to carry out their functions properly.
  • Use a key to remind a forgotten code by looking at codes you are most familiar with.

How to Read M Codes?

  • M (Miscellaneous) codes are supplemented by other category codes to activate the ideal setting of the CNC machine.
  • This lines with M codes although they are structured in a specific order to keep processes running smoothly.
  • An S code can set the spindle speed as it is moved with an M code,
  • for example. M codes are often used with G codes to operate a machine effectively.

The most common G-codes and M-codes used for CNC programming are shown below.

Common G-Codes

G00 Rapid move G0 X# Y# Z# up to eight axes or G0 Z# X#

G01 Feed Rate move G1 X# Y# Z# up to eight axes or G1 Z# X#

G02 Clockwise Circular or Helical Interpolation Move

G03 Counter Clockwise Circular or Helical Interpolation Move

G04 Dwell time G04 L#

G07 Lathe Diameter Mode

G08 Spline Smoothing On

G09 Exact stops check, Spline Smoothing Off

G10 linear feed rate controlled to move with a decelerated stop

G11 Controlled Coordinate System Origin Setting (Decel stop)

G17 XY Plane Selection

G18 XZ Plane Selection

G19 YZ Plane Selection

G20 Inch System Selection

G21 Millimeter System Selection

G28 Return to Clearance Plane

G33 Threading (Lathe)

G33 and G33.1 will not work on some CNC mills or lathes due to no synchronization between the spindle and the axis.

G35 Bypass Error Checking On Next Line

G40 Cancel Cutter Diameter Compensation

G41 Start Cutter Tool Diameter Compensation to Left

G42 Start Cutter Tool Diameter Compensation to Right

G43 Tool Length Compensation – Negative Direction

G44 Tool Length Compensation – Positive Direction

G49 Tool Length Compensation Canceled

G53 Cancel Motion in Machine Work Coordinate System Offsets

G54 Use Preset Work Coordinate System 1

G55 Use Preset Work Coordinate System 2

G56 Use Preset Work Coordinate System 3

G57 Use Preset Work Coordinate System 4

G58 Use Preset Work Coordinate System 5

G59 Use Preset Work Coordinate System 6

G59.1 Use Preset Work Coordinate System 7

G59.2 Use Preset Work Coordinate System 8

G59.3 Use Preset Work Coordinate System 9

G61 Spline Contouring With Buffering Mode Off

G64 Spline Contouring With Buffering Mode On

G65 Mill out Rectangular Pocket

G66 Mill out Circular Pocket

G67 Fly cut

G68 Mill out rectangular pocket with radius corners

G70 Inch mode

G71 Millimeter mode

G74 Peck drilling (Lathe) G83 Z# X# R#

G80 Cancel Motion Mode

G81 Drill cycle G81 X# Y# Z# R#

G82 Dwell cycle G82 X# Y# Z# R#

G83 Chip Breaking Peck cycle G83 X# Y# Z# R#

G84 Right Hand Tapping cycle G84 X# Y# Z# R# C#

G85 Feed out Canned Boring cycle 1 G85 X# Y# Z# R#

G86 Boring Spindle Stop, Rapid out Cycle 2 G86 X# Y# Z# R#

G87 Back Boring Canned Cycle

G88 Boring Spindle Stop, Manual cycle 3 G88 X# Y# Z# R#

G89 Boring feed out canned cycle 4 G89 X# Y# Z# R#

G90 Absolute Distance Mode

G91 Incremental Distance Mode

G92 Home coordinate system reset G92 X# Y# Z#

G92.2 Cancel Offset Coordinate Systems

G93 Inverse Time Feed Mode

G94 Feed per Minute Mode IPM mode (Lathe) default

G95 IPR mode (Lathe)

G96 Constant Surface Feed On (Lathe)

G97 Constant Surface Feed off (Lathe)

G98 Initial Level Return in Canned Cycles

G99 “R” Level Return In Canned Cycles

Common M-Codes

For most CNC machines,

User-customizable M codes can be changed based on application and user definition

Some default M-codes used are

M00 Program Stop

M01 Program Optional Stop

M02 End the Program

M03 Spindle On Clockwise, Laser, Flame, Power ON

M04 Spindle On Counter Clockwise

M05 Spindle Stop, Laser, Flame, Power OFF

M06 Tool Change

M08 Coolant On

M09 Coolant Off

M10 Reserved for tool height offset

M13 Spindle On, Coolant On

M30 End the Program when macros are used

M91 Readout Display Incremental

M92 Readout Display Absolute

M97 Go to or jump to line number

M98 Jump to macro or subroutine

M99 Return from macro or subroutine

M100 Machine Zero Reset

M199 Mid-program start.

Don't Miss Our Updates
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
You've successfully subscribed !

Continue Reading

Introduction to Mechatronics
What is Arduino? Different Models of Arduino Controllers
Types of Tachometers – Mechanical and Electrical Tachometers
List of Cybersecurity Labs
Electronic Diagrams, Prints and Schematics
Vision Camera Systems in Industrial Automation
Share This Article
Facebook Whatsapp Whatsapp LinkedIn Copy Link
Share
Leave a Comment

Leave a Reply Cancel reply

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

Stay Connected

128.3kFollowersLike
69.1kFollowersFollow
210kSubscribersSubscribe
38kFollowersFollow

Categories

Explore More

4-20mA Transmitter NAMUR Signal Levels
How Does Starlink Work?
How to Protect Electrical Terminal Blocks From Tampering?
What is a Vent Filter? – Water Treatment Plant
Step-by-Step Guide: How PCBs are Manufactured from Start to Finish
Career Opportunities and Scope in Industrial Automation
Everything You Need to Know About Ceramic Bearings
7 Marketing Strategies for Engineering Companies

Keep Learning

Working Principle of Water Chillers

HVAC Water Chillers Principle

Classification of Weighing Balance

Classification of Weighing Balance and Weight

Strain Gauge Accelerometer

Strain Gauge Accelerometer

Standard Operating Procedure

What is SOP and How to Create an SOP?

What is Transparent Solar Panel

What is Transparent Solar Panel? – Working Principle and Theory

Data Protection Tips

8 Data Protection Tips For Businesses And Individuals

Good and Bad Wiring Practices

Home Heating

What Type of Heating is Best for Your Home?

Learn More

Flow Transmitter Readings mismatch with DCS

Flow Transmitter Readings mismatch with DCS

DRUM DB

Siemens Drum block for Sequencer Operation

What is Cloud Computing

What is Cloud Computing? Types of Cloud Services, Components

Stability in Frequency Domain

Feedback Compensation

What is an ELV System - Extra Low Voltage

What is an ELV System? – Extra Low Voltage

How to Prevent Ground Loops in Analog Circuits?

How to Prevent Ground Loops in Analog Circuits?

Thermocouple Questions

Thermocouple Terminal block Questions

Analyzers Questions and Answers

NO2 Analyzer Questions & Answers

Menu

  • About
  • Privacy Policy
  • Copyright

Quick Links

  • Learn PLC
  • Helping Hand
  • Part Time Job

YouTube Subscribe

Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?