News

A Guide to CNC Lathe Programming Codes

By: Ruian Precision Machinery Views: 4107 Date: 2024-10-10

CNC lathe programming codes: the following is an overview of common CNC lathe codes. Codes and instructions vary by controller, so consult the relevant control manual before programming.


G codes (preparatory functions)
G00: rapid positioning; G01: linear interpolation; G02: clockwise circular interpolation; G03: counterclockwise circular interpolation; G90: absolute programming; G91: incremental programming; G92: set workpiece zero; G98: return to the initial point in a canned cycle.
G99: return to the R point in a canned cycle; G17: select XY plane; G18: select ZX plane; G19: select YZ plane; G27: return to and check the reference point; G28: return to reference point; G29: return from reference point; G40: cancel tool-radius compensation; G41/G42: left/right tool-radius compensation; G43/G44: tool-length compensation; G49: cancel tool-length compensation; G52: set local coordinate system; G53: select machine coordinate system; G54–G59: select work coordinate system; G60: unidirectional positioning; G61: exact stop; G64: cutting mode; G66: modal macro call; G67: cancel modal macro call; G73: deep-hole drilling cycle; G74: reverse tapping cycle; G76: fine boring cycle; G80: cancel canned cycle; G81/G82: drilling cycle; G83: deep-hole drilling cycle; G84: tapping cycle; G85: keyway cutting cycle; G86: boring cycle; G87: back keyway cycle; G88/G89: boring cycles.


M codes (auxiliary functions)
M00: program stop; M01: optional stop; M02: program end; M03/M04: spindle forward/reverse; M05: spindle stop; M06: tool change; M08/M09: coolant on/off; M18: cancel spindle orientation; M19: spindle orientation; M29: rigid tapping; M30: end and rewind; M98: call subprogram; M99: return from or repeat subprogram.


F code (feed rate)
F specifies the tool feed rate relative to the workpiece. Units depend on the selected mode, such as G94 for millimeters per minute or G95 for millimeters per spindle revolution.


S code (spindle speed)
S specifies spindle speed; the number following S is the speed in revolutions per minute.
T code (tool selection)
T selects a tool. On the control described in the original article, the four digits specify the tool number and compensation number; verify the format for your controller.
This overview of CNC lathe programming codes is intended as a starting point. Always check the applicable machine and controller documentation.