Coding of CNC Machine
Time:2021-05-26
Views:418
G-codes
G-codes are used to command specific movements of the machine, such as machine moves or drilling functions. The majority of G-Code programs start with a percent (%) symbol on the first line, then followed by an "O" with a numerical name for the program (i.e. "O0001") on the second line, then another percent (%) symbol on the last line of the program. The format for a G-code is the letter G followed by two to three digits; for example G01. G-codes differ slightly between a mill and lathe application, for example:
[G00 Rapid Motion Positioning]
[G01 Linear Interpolation Motion]
[G02 Circular Interpolation Motion-Clockwise]
[G03 Circular Interpolation Motion-Counter Clockwise]
[G04 Dwell (Group 00) Mill]
[G10 Set offsets (Group 00) Mill]
[G12 Circular Pocketing-Clockwise]
[G13 Circular Pocketing-Counter Clockwise]
M-codes
[Code Miscellaneous Functions (M-Code)]. M-codes are miscellaneous machine commands that do not command axis motion. The format for an M-code is the letter M followed by two to three digits; for example:
[M02 End of Program]
[M03 Start Spindle - Clockwise]
[M04 Start Spindle - Counter Clockwise]
[M05 Stop Spindle]
[M06 Tool Change]
[M07 Coolant on mist coolant]
[M08 Flood coolant on]
[M09 Coolant off]
[M10 Chuck open]
[M11 Chuck close]
[M13 BOTH M03&M08 Spindle clockwise rotation & flood coolant]
[M14 BOTH M04&M08 Spindle counter clockwise rotation & flood coolant]
[M16 Special tool call]
[M19 Spindle orientate]
[M29 DNC mode ]
[M30 Program reset & rewind]
[M38 Door open]
[M39 Door close]
[M40 Spindle gear at middle]
[M41 Low gear select]
[M42 High gear select]
[M53 Retract Spindle] (raises tool spindle above current position to allow operator to do whatever they would need to do)
[M68 Hydraulic chuck close]
[M69 Hydraulic chuck open]
[M78 Tailstock advancing]
[M79 Tailstock reversing]