PROGRAMMING

 
 
G and M code operations or lines are entered in the ISO variable line format. An operation is a line of text containing the operation code and any information needed to do that operation. Multiple G and M code operations cannot be placed on one line, they must occupy separate lines, although one G and one M code may appear in the same program line.

The text necessary to execute an operation is composed of a sequence of letters A..Z, digits 0..9, signs (+ and -) and spaces.
EXAMPLE: If a G operation for linear interpolation is to be coded then the text line will include the string G01, "G" for a G operation and "01" because linear interpolation is operation 1.  If further information is to be specified such as an X coordinate of 0.5 inches, a Z coordinate of 1.5 inches and a feed rate of 4 inches per minute then further strings can be added with spaces as separators:
G1 X0.5 Z2.5 F4

G code Functions

A G code is command in the program specifying the mode on which a CNC machine moves along programming lines. The mode of movement is indicated by the numerical value following the G address. A G code is usually placed at the beginning of a block so it can set the control for a particular mode when acting on the words in the block

 
Preparatory function descriptions
 
  G00-Rapid positioning
G01-linear interpolation
G02-Circular interpolation clockwise
G03-Circular interpolation counterclockwise
G04-Dwell
G12-Circle cutting clockwise
G13-Circle cutting counterclockwise
G17-X and Y plane designation
G18-X and Z plane designation
G19-Y and Z plane designation
G25-Program copy
G28-Return to reference position
G29-Return from reference position
G40-Cancel cutter radius compensation
G41-Cutter radius compensation left side of profile
G42-Cutter radius compensation right side of profile
G43-Tool position offset Z axis
G49-Cancel tool position offset Z axis
G73-Canned cycle for high speed deep hole drilling
G76-Canned cycle for boring, shift to side for rapid withdraw
G80-Cancel canned all canned cycles
G81-Canned cycle for standard drilling
G82-Canned cycle for spot facing
G83-Canned cycle for deep hole drilling
G84-Canned cycle for tapping
G85-Canned cycle for boring, feed both ways
G86-Canned cycle for boring, rapid withdraw
G87-Canned cycle for boring, manual withdraw
G88-Canned cycle for boring with dwell, manual withdraw
G89-Canned cycle for boring with dwell, feed both ways
G90-Absolute positioning/programming
G91-Incremental positioning/programming
G92-Programming of absolute Zero point (distance to X0 Y0)
G94-Feed rate in inches per minute (IPM)
G95-Feed rate in inches per revolution (IPR)
G98-Return to initial Z level, canned cycles
G99-Return to initial Z point, canned cycles
The G codes will vary according to manufacturer's specifications
 
 
 
 

Miscellaneous Functions (M-codes)

The miscellaneous functions use the address letter M followed by up to two digits to perform various instructions that do not involve dimensional movements of the machine. They are also referred to as machine functions, or simply M codes. They include stopping the program, starting or stopping the spindle, tool change, coolant flow, and others. Some M codes are standardized and are common to most CNC controllers; others have special assignment for particular controllers. Only one M function can be used in any one block of information.
 
 
Miscellaneous function descriptions
 
M00-Program stop, start program again by pressing button
M01-Optional stop, operator can switch (/) on or off
M02-Program end
M03-Spindle on clockwise rotation
M04-Spindle on counterclockwise rotation
M05-Spindle stop rotation
M06-Command to change tools, automatic tool changer (ATC)
M08-Coolant on
M09-Coolant off
M30-Program end, all functions stop, memory/tape rewinds
M94-Mirror image off
M95-Mirror image on
M98-Subroutine call
M99-Subroutine return
 The M codes will vary according to manufacturer's specifications