Examples of CNC Programming

CNC is the acronym for Computerized Numerical Control , therefore, CNC programming is one that, initially under the G&M language, manages to give instructions to the machines intended for numerical control.

Related Articles

G&M is a low-level programming language used to describe very simple actions that have to do with geometry. It is a simple representation of segments of lines and arcs of circumference.

The resulting G&M language programs (General and Miscellaneous Codes) are stored in 6-bit ASCII files. 

There are already few CNC machines that use G&M, however, in order for these equipment to be compatible with other languages, the ISO has created a communication and compatibility standard. All CNC machine builders have adopted this set of standards.

Examples of CNC programming

  • Examples of instructions.
  • General codes:

G00: Quick positioning (no machining)

G01: Linear interpolation (machining)

G02: Circular interpolation (hourly)

G03: Circular interpolation (counterclockwise)

G04: Wait compass

G10: Program offset value adjustment

G20: Start of use of imperial units (inches)

G21: Beginning of use of metric units

G28: Return to the home of the machine

G32: Machine a thread in one pass

G36: Automatic tool compensation in X

G37: Automatic tool compensation in Z

G40: Cancel tool bend radius compensation

G41: Left tool bend radius compensation

G42: Right tool bend radius compensation

G70: Finishing cycle

G71: Turning machining cycle

G72: Face machining cycle

G73: Pattern repeat

G74: Intermittent drilling, with outlet for removing chips

G76: Machine a thread in multiple passes

G96: Roughing start at constant tangential speed

G97: End of roughing at constant tangential speed

G98: Feed rate (units / min)

G99: Feed speed (units / revolution)

  • Miscellaneous Codes:

M00: Optional stop

M01: Optional stop

M02: Program reset

M03: Rotate the spindle clockwise

M04: Rotate the spindle counterclockwise

M05: Brake spindle

M06: Change tool

M07: Open the coolant passage B

M08: Open the coolant passage A

M09: Close the flow of refrigerants

M10: Open jaws

M11: Close jaws

M13: Turn the spindle clockwise and open the coolant passage

M14: Rotate the spindle counterclockwise and open the coolant passage

M30: End program and put the execution pointer at its start

M31: Increase the parts counter

M37: Brake the spindle and open the guard

M38: Open guard

M39: Close the guard

M40: Extend the parts feeder

M41: Retract the parts feeder

M43: Warn the conveyor to advance

M44: Warn the conveyor to back up

M45: Warn the conveyor to brake

M48: Disable Spindle and Feed override

M49: Cancel M48

M62: Activate auxiliary output 1

M63: Activate auxiliary output 2

M64: Deactivate auxiliary output 1

M65: Deactivate auxiliary output 2

M66: Wait until input 1 is ON

M67: Wait until input 2 is ON

M70: Activate mirror in X

M76: Wait until input 1 is OFF

M77: Wait until input 2 is OFF

M80: Disable mirror in X

M98: Subprogram call

M99: Subprogram return

  • Example of a program:


[BILLET X25.4 Z55  Definition of billet size for the simulator (not for the lathe)











This program performs a series of basic tasks on a 55mm x1 ” diameter billet of material, facing it first and then rolling it to 25mm.

Show More

Leave a Reply

Your email address will not be published.

Back to top button