jstolaruk
Lifetime Supporting Member
I put myself through college programming CNCs by hand (before PCs were available). Gcode is actually very simple. Basic examples that I recall:
A line of code can be made up of N,G,M,F,S,X,Y,Z,I,J,K components. Only one of each in a line. There are others that are machine/controler specific but these are the basic ones.
Nxxx, is the line number
Fxx, set feedrate X per minute.
Xxxxx, X axis command
Yxxxx, Y axis command
Zxxxx, Z axis command
Sxxxx, spindle speed
G90 places the controller in absolute coordinate space. All positional commands are relative to a single point in space, 0,0,0.
G91 places the controller in incremental coordinate space. The following move command will be done relative to the current position.
G00 the move command will be a rapid traverse to the X,Y,Z coordinates.
G01 linear move at the current programmed feed rate.
G02 clockwise arc move at the current feed rate. May require I,J,K coordinates.
G03 counter clockwise arc at the current feed rate. May require I,J,K coordinates.
M03 activate spindle clockwise
M04 activate spindle counter clockwise.
M05, spindle off
M30, end of program?
Example
N010 G90
N020 M03 G00 X1.0 Y-1.34
N030 Z-3.0
N040 G01 F10.0 X0.0 Y3.0
N050 G00 Z0
N060 X0 Y0 M05
N070 M30
I know there are some others but I think I last did this in 1982. But I think you can get the drift. Find an old CNC controller manual and there will be some good explainations.
A line of code can be made up of N,G,M,F,S,X,Y,Z,I,J,K components. Only one of each in a line. There are others that are machine/controler specific but these are the basic ones.
Nxxx, is the line number
Fxx, set feedrate X per minute.
Xxxxx, X axis command
Yxxxx, Y axis command
Zxxxx, Z axis command
Sxxxx, spindle speed
G90 places the controller in absolute coordinate space. All positional commands are relative to a single point in space, 0,0,0.
G91 places the controller in incremental coordinate space. The following move command will be done relative to the current position.
G00 the move command will be a rapid traverse to the X,Y,Z coordinates.
G01 linear move at the current programmed feed rate.
G02 clockwise arc move at the current feed rate. May require I,J,K coordinates.
G03 counter clockwise arc at the current feed rate. May require I,J,K coordinates.
M03 activate spindle clockwise
M04 activate spindle counter clockwise.
M05, spindle off
M30, end of program?
Example
N010 G90
N020 M03 G00 X1.0 Y-1.34
N030 Z-3.0
N040 G01 F10.0 X0.0 Y3.0
N050 G00 Z0
N060 X0 Y0 M05
N070 M30
I know there are some others but I think I last did this in 1982. But I think you can get the drift. Find an old CNC controller manual and there will be some good explainations.
Last edited: