Mechanical Basics Production

63 G Codes and M Codes (28) of CNC Part Program,NC,CNC Machine Parts

63 G Codes and M Codes (28) of CNC: Part programming is not a language programming but it is a coded programming method used for writing the programs for manufacturing of given components. Part Programming uses standard codes and code means the name given for the program written for a standard measurement of the tool.

These codes are used in part programming.G-Codes Stands for General Purpose Codes and M-codes Stands for Miscellaneous or Machine Codes. Minimum 2 marks will come from this region. Therefore, In this article, I will be explaining about 20 G Codes and M Codes in a detailed manner.

Read: Iron-Carbon Phase Diagram for GATE exam

G-Codes-and-M-Codes of-CNC-Part-Programming (2)
G-Codes-and-M-Codes of-CNC-Part-Programming (2)

G Codes and M Codes of CNC Part Programming:

20 G Codes and M Codes(14) of CNC Part Programming-Especially for GATE Exam is as follows.

1.G 00: Rapid Traverse: G00 Code stands for Rapid Traverse. It means that whenever the tool required to travel ideally without removing any material. It is required to travel at maximum possible speed, in such cases G00 Code will be used.

2.G 01: Linear Interpolation Whenever the tool required to travel in a straight-line path, G 01 Code will be used.

3. G 02: Circular Interpolation (Clockwise)

4.G 03: Circular Interpolation (Counter Clockwise) Whenever the tool is required in a contour path, G 02 or G 03 will be used.

5.G 04: Dwell Dwell indicates temporary stoppage of a tool in the machine for a specified duration.

6.G 05: Hold Hold indicates stoppage of a tool in the machine for Unlimited Duration. Ex: G04 F120 Here F120 indicates temporary stoppage duration in seconds.

7.G 08: Acceleration Whenever the machine is getting started, it has to start at the lowest velocity and reaches to the maximum velocity in a specified duration. For this, the G 08 Code will be used.

8.G 09: Retardation Whenever the tool is nearing to the destination, it has to reduce its velocity so that it is possible to stop the tool exactly whenever it is required. For this G 09 Code will be used. G 08 and G 09 are the Default codes used in part programming.

9.G 17: Movement of Tool in XY Plane

10.G 18: Movement of Tool in YZ Plane

11.G 19: Movement of Tool in ZX Plane

12.G 33: Thread Cutting with Constant Pitch.

13.G 34: Thread Cutting with Increasing Pitch.

14.G 35: Thread Cutting with Decreasing Pitch.

15.G 41: Tool Radius Compensation Left

16.G 42: Tool Radius Compensation Right

17.G 70: English Programming (Inches)

18.G 71: Metric Programming (mm)

19.G 90: Absolute Mode If each and every movement of the tool is indicated with reference to the only one single reference point called a machine reference point named as Absolute mode of Programming.

20.G 91: Incremental Mode. If the Present position of the tool is taken as a reference point for programming the next position of the tool called as Incremental mode of programming. These are the 20 G-Codes of CNC Part Programming.

Note: Even though incremental mode of programming is easy to write and modify but according to Indian conditions, we prefer to use absolute mode of programming only because during running of the program for producing the components if the power failure occurs, after restoring the power, it is very easy to identify where the program has got stopped if it is an absolute mode of program. The M Codes required in Part Programming are as follows which are very important for GATE Exam.

The above mentioned 20 codes are important for GATE point of view. I will write a few more but those may not be important for GATE Exam.

  1. G06 Spline interpolation
  2. G07 Hypothetical axis interpolation
  3. G11 Mirror image cancel
  4. G12 Mirror X-Axis values
  5. G13 Mirror Y-Axis values
  6. G14 Mirror XY Axis values
  7. G20 Inch input (equivalent to G70)
  8. G21 Metric input (equivalent to G71 )
  9. G28 Return to machine coordinate origin
  10. G29 Return from machine coordinate origin
  11. G43 Tool length compensation +
  12. G44 Tool length compensation –
  13. G49 Tool length compensation cancel
  14. G50 Scaling cancel
  15. G51 Scaling
  16. G53 Machine coordinate system selected
  17. G54 Work coordinate frame 1 selection
  18. G55 Work coordinate frame 2 selection
  19. G56 Work coordinate frame 3 selection
  20. G57 Work coordinate frame 4 selection
  21. G58 Work coordinate frame 5 selection
  22. G59 Work coordinate frame 6 selection
  23. G61 Exact stop mode (block by block)
  24. G64 Continuous mode (look-ahead)
  25. G73 Peck drilling cycle
  26. G74 Counter tapping cycle
  27. G76 Fine boring cycle
  28. G80 Canned cycle cancel
  29. G81 Drilling cycle, spot boring
  30. G82 Drilling cycle, counterboring
  31. G83 Peck drilling cycle
  32. G84 Tapping cycle
  33. G85 Boring cycle
  34. G86 Boring cycle
  35. G87 Back boring cycle
  36. G88 Boring cycle
  37. G89 Boring cycle
  38. G92 Work coordinates change
  39. G93 Inverse time feed
  40. G94 Feed rate per minute
  41. G95 Feed rate per revolution
  42. G98 Canned cycle initial level return
  43. G99 Canned cycle R point level return

These are the codes of CNC Part Programming. The Aim of speaking about these codes is to solve the problems related to the CNC programming in GATE Exam in an effective manner.

28 M Codes that GATE Student must know in CNC programming:

M codes play a vital role in the CNC Part Programming. Majorly M codes are used to write the main programs and Sub-Programmes in CNC Part Programming. Along with these M Codes, I will be writing about the Main Programmes and Subprograms which are used in CNC Part Programming. But before these, as the GATE Exam is coming by, you should have to focus on those things which are really important i.e. 14 M Codes that GATE Student must know in CNC Programming.

28 M Codes in CNC Part Programming:

However, there are 100 M codes starting from (M00 to M99). But only 14 M codes which are really important in GATE Exam are presented below.
1. M 00 – Program Stop = G05
2. M 01 – Planned Stop = G04
Ex: G 04 F & M 01 F

In both cases, the Stoppage duration was in secs.

3. M 02 – End of Main Program written without the use of Subprogram.
4. M 30 – End of Main Program written with the use of Subprogram.
5. M 17 – End of Sub Program.
6. M 03– Spindle Start (Clockwise)
Ex: M 03 S 500

Where S 500 represents the rpm of the spindle.

7. M 04 – Spindle Start (Counter Clockwise)
8. M 05 – Spindle Stop.
9. M O6 – Tool Change
Ex: M 06 T 13

Here T 13 Represents that the Existing Tool is replaced by T 13 and T can be up to T 32.

10. M 07 – Coolant Pump No.1 ON
11. M 08 – Coolant Pump No.2 ON
12. M 09 – Coolant Pump No.1&2 OFF
13. M 10 – Clamping (Tightening Chuck)
14. M 11 – De Clamp (Releasing Chuck)

These are the 14 M codes that a GATE Aspirant must know for getting good marks in GATE exam.

A few which are not so important for GATE Exam are as follows.

  1. M12 Clamp/Misc. on
  2. M13 Clamp/Misc. off
  3. M19 Oriented spindle stop
  4. M47 Return to program start
  5. M48 Bypass feed rate override cancel
  6. M49 Bypass feed rate override
  7. M90 User-defined DOS call 1
  8. M91 User-defined DOS call 2
  9. M92 User-defined DOS call 3
  10. M93 User-defined DOS call 4
  11. M94 User-defined DOS call 5
  12. M95 User-defined DOS call 6
  13. M98 Call sub-program
  14. M99 Return from sub-program

Now let’s discuss…

CNC Machine Parts: NC, CNC, Parts of CNC Machine, Applications:

If Each and every axis of a machine tool is controlled by using numbers or numerals it is called as a Numerical Controlled Machine Tool. (NC Machine).

 What is a CNC Machine?

If Each and every axis of a machine tool is controlled by using a mini computer[which can run by means of Coding(G-Codes & M-Codes)] called as Computer Numerical Controlled Machine(CNC).

CNC Machine Parts-NC, CNC, Parts of CNC Machine, Servomotor, Applications
CNC Machine Parts-NC, CNC, Parts of CNC Machine, Servomotor, Applications

CNC Machine Parts:

  1. MCU or CPU
  2. Drive Unit (Servomotor)
  3. Feedback Devices
  4. Mini Computer
  5. Very Few Manual Controls

1.MCU:(Memory Controlled Unit)

MCU is working as a brain of human being i.e. MCU is taking input information from the input devices, analyze the data, and all these decisions will be implemented by using output devices available in the CNC machine.

The Input Information is in the form of the decimal system and as the machine can understand only the Binary System of information, a device is required in MCU to convert the decimal to binary and vice versa and that device are called as Arithmetic Logic Unit(ALU).

2.Drive Unit:

It is the device used for converting Electrical energy into Mechanical energy which is required for traveling the axis.

Ex: Electric motor.

Here we can use Servo Motor as the drive unit in CNC Machining.


It is also working similar to that of stepper motor but additionally, there is a quick action Braking System available in the motor so that whenever the power supply is getting stopped, the Braking System will be activated and stops all the moving parts.

Hence it is possible to get the high positional accuracy of the machine. Because the Servo Motors are not available at the time of development of the NC machine, the stepper motor can be used as a drive unit.

3.Feedback Devices:

It is a Displacement Measuring Equipment used to measure the actual distance traveled by the Axis and giving it as a feedback to the MCU and the MCU will compare the distance traveled by the axis with the distance to be traveled and determines the difference in distance.

The MCU will calculate the no.of pulses and send it to the drive unit. This process continues in the form of a cycle.

Feedback Device→MCU→Drive Unit.

4.Mini Computer:

Due to the usage of the minicomputer, the program will be fed into the machine through a keyboard and kept in the memory of a mini-computer in the form of a software program.

Due to the above program, the operation will perform without the intervention of the operator and the dimensional accuracy is also high.

5.Very Few Manual Controls:

Even though the above parts are present in the CNC machine, still the manual interventions are required for switching ON and OFF, loading and unloading of the workpiece etc called as manual controls.

These are the CNC Machine Parts which are explained in a detailed manner.

Advantages of CNC Machines:

  • Due to Servo Motors as drive units, the positional accuracy of the component produced is better.
  • Feeding the program into the machine through the keyboard is very easier.
  • Duplication of software program will be easier i.e.the software program can be copied into the floppy or Disks and can Copy into any number of Machines.
  • Because of the software program, the life of a program is infinity.
  • Design modifications can be easily incorporated into the existing program.
  • Due to the availability of Graphics simulation software in a minicomputer, the cutting path will be generated for the program fed into the machine and based on the cutting path, it is possible to identify whether the program is right or wrong.
  • Because of very few manual controls, complete automation of the CNC machine is possible.

This is the explanation of CNC Machine Parts: NC, CNC, Parts of CNC Machine, Servomotor, Applications in a detailed way along with G Codes and M Codes.


Sharing is Caring. So please do Share…

The article is helpful…Please do share.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.