Getting to Know the Codes in CNC Machine Programming Languages

A machine is a process of entering data into a machine computer in a language that can be understood by the CNC machine itself. The programming language that can be understood and understood by a CNC machine computer is in the form of numeric. Which is a language that is a combination of letters and numbers. For that, we must enter a program into the CNC machine computer so that it can process data information and change it in the form of movement commands on the cutting tool or workpiece.

But before that, we will describe a little about the working principle of the CNC machine first, yes. Check out the brief explanation below.

Working Principles of CNC Machines


The work steps in making products using CNC machines are almost the same as manufacturing machines in general. But there is only additional control from the computer in regulating machine movements. The working principle of a CNC machine is when the program is run, data will be sent to the processor. Then the processor which acts as the brain of the CNC machine reads the data in the program and then instructs the actuator to move according to the program to produce a product that fits the design.

In carrying out the commands of the movement of the cutting tool to achieve the desired goal, a programming language is needed, in the form of codes in the form of letters and numbers as well as programming methods. This programming uses a numeric known as code language that has been standardized by ISO and DIN. The language code that is entered into the machine can be in the form of G code, M code, and S code.

So What Is The G Code, M Code, and S Code?

In the programming language, G code means Geometry, so G code is more related to commands about machine geometry such as tool movement direction, input units and so on. While the M code is more about setting machine functions such as moving the spindle, flowing coolant and so on. And for the S code or speed to set how fast the spindle is spinning.

The following is a table of commonly used G and M.

G Code

No. G Code Function
1. G00 Non motion
2. G01 according to Feed
3. G02 circular interpolation CW
4. G03 Circular interpolation CCW
5. G04 Program stops at specified time
6. G17 X,Y field selection
7. G20 Inch input
8. G21 mm Input
9. G28 Back to Reference Point
10. G31 Skip Command
11. G40 Cutter compensation cancel
12. G41 left cutter compensation
13. G42 right cutter compensation
14. G52 Setting Local Coordinates
15. G54 G55 G56 G57 Coordinate System Workpiece
16. G80 Canceling Cycle Work
17. G81 Hole Making
18. G82 Counter Hole Making
19. G85 Boring Step Count
20. G90 Absolute System Command
21. G91 Incremental System Command
22. G94 Cutting Speed ​​per Minute
23. G98 Return to Cycle Initial point
24. G99 Return to point R Cycle

M Code

NO Code M Function
1. M00 Program Stop
2. M01 Optional Program Stop
3. M02 End Program
4. M03 Spindle on CW
5. M04 Spindle on CCW
6. M05 Spindle stop
7. M06 Alternate Tool
8. M08 Turn on Coolant
9. M09 Turn off Coolant
10. M19 Spindle Orientation
11. M28 Back to Reference Point
12. M29 Tapping Process
13. M30 End of Program (Reset)
14. M41 Low Gear Selection
15. M42 High Gear Selection
16. M94 Cancel Image
17. M95 Image Mirroring with X Axis
18. M96 Image Mirroring with Y Axis
19. M98 Subprogram Calls
20. M99 End of Program Soup

codes are commonly called programming language codes. This code language functions as a means of communication between the machine and the user, namely providing data information to the machine that must be run.

After understanding the code in the programming language, then how to write the data to the CNC machine? See how to

Writing Program on CNC Machine

a program on a CNC machine, it must comply with the format and structure of the program that has been set. Below is an example of the format for writing a CNC Milling machine program


Information :

  • N        : Program Number
  • G/M    : Program Command
  • X          : X Axis Amount
  • Y          : Y Axis Amount
  • Z          : Z Axis Amount
  • F          : Feed Rate

Example :

01 G54        
02 M03 S1000        
03 G00 50 0 0 0
04 G01 0 50 0 60
05 M05        
06 M30        
  1. (G54) Setting the initial coordinates of the workpiece (if previously set)
  2. (M03) The machine spindle rotates clockwise. (S1000) Spindle speed 1000 rpm
  3. (G00) motion without cutting. (X50) moves lengthwise as far as 50 mm to the right
  4. (G01) the slicing motion of the workpiece. (Y50) moves transversely forward a distance of 50 mm forward. (F60) with a cutting speed of 60 mm/min
  5. (M05) Spindle stops rotating
  6. (M30) End Program
READ MORE: An important machine in the cosmetic industry is an automatic feeder machine
Facebook Comments
WeCreativez WhatsApp Support
Tim dukungan pelanggan kami siap menjawab pertanyaan Anda. Tanya kami apa saja!
πŸ‘‹ Hallo, Ada yang bisa saya bantu?