https://www.americanmicroinc.com/resources/difference-g-code-m-code/#what
What is G Code?
A G code in CNC programming controls the movements of a machine, dictating how and where a machine should move to fabricate a part.
What is M Code?
An M code in CNC programming controls miscellaneous machine functions, including starting and stopping specific actions or programs.
These two codes work together to manufacture parts and components, making them essential in the manufacturing and industrial sectors.
Different letters dictate how the machine moves and numbers set the parameters. While the system is called G code, G is not the only letter used. Other letters have different functions in the program, which tend to be the same, regardless of a machine’s dialect.
For example, the functions of the following letters in G code include:
- N: The N value gives the line number.
- G: The G number tells when the tool to move and stop.
- X, Y, Z: These values indicate the position of the tool in three dimensions — X for horizontal, Y for vertical and Z for depth.
- F: F relates to how quickly the machine feeds the piece.
- S: S tells the machine how quickly to move the spindle.
- T: The T tells the machine which tool to use.
- M: M values give miscellaneous functions or machine functions, telling the device how to act by giving on and off directions.
- I and J: These values indicate the incremental center of any arcs the machine makes.
- R: R gives the radius of arcs made by the machine.
- A: A values direct the tool around the x-axis.
- B: The number with B shows the rotational value around the y-axis.
- C: An auxiliary axis that rotates around the z-axis gets its positional value from the C value.
- D: This number shows how much the system offsets the tool diameter.
- L: L gives the system a value to indicate repeating operations and how many times they need to loop.
- P: The program jumps in time or a delayed time with the P command.
Other alphanumeric designations depend on the machine’s capabilities.
These three operations include the following:
- Move in a straight line as quickly as possible.
- Move in a straight line at a specified rate.
- Move in a circle at a specified speed.
- G0: Go as fast as possible to a specified coordinate.
- G1: Move in a straight line.
- G2: Create an arc in a clockwise direction.
- G3: Make a counterclockwise arc.
M codes give the machine instruction on when to turn on or off operations not involved with cutting. For specific processes, for example, the machine may need to flood the system with coolant and shut it off after the temperature drops. These are two separate actions in M code.
M commands have generic values that include the following:
- M00: Stop whatever program is currently operating — axes, coolant flooding or spindle.
- M01: This command indicates an optional stop for the program.
- M02: End of the currently running program.
- M03: Begin to move the spindle clockwise.
- M04: Start moving the spindle counterclockwise or in reverse.
- M05: Stop moving the spindle.
- M06: Load on a different tool. Typically, this command comes with the T value. For example, you may see “T1 M06.”
- M08: Start flooding the system with coolant.
- M09: Stop the coolant flow.
https://carlsonmfg.com/cnc-g-code-m-code-programming/
G00 Rapid Transverse Motion G01 Motion by a feed rate G02 Motion in an arc clockwise G03 Motion in an arc counter clockwise G04 Dwell G17 XY Plane selection G18 XZ Plane selection G19 YZ Plane selection G28 Return to Machine zero for axis selected G40 Cutter compensation Cancel G41 2D Cutter compensation Left G42 2D Cutter compensation Right G43 Tool length compensation + (add to tool length offset) G44 Tool length compensation – (subtract tool length offset) G49 Cancels G43 G44 G50 Sets a speed limit for Constant surface speed (lathe) G52 Set Work Coordinate system G54 Work coordinate system #1 G55 Work coordinate system #2 G56 Work coordinate system #3 G57 Work coordinate system #4 G58 Work coordinate system #5 G59 Work coordinate system #6 G65 Macro Subroutine call G70 Bolt Hole Circle G71 Holt Hole Arc G72 Bolt holes along an Angle G73 High Speed Peck Drilling G74 Reverse Tapping G80 Turns off all canned cycles G81 Drilling G82 Spot Drilling G83 Peck drilling G84 Tapping cycle G90 Calls up an absolute Co-ordinate grid system Positioning G91 Calls up an incremental Co-ordinate grid system Positioning G92 Set Work Coordinate system shift value -(grid shift) G94 Feed per minute mode G95 Feed per spindle revolution mode G96 turns on Constant Surface Speed (lathe) G97 Turns off Constant Surface Speed (lathe) G98 Canned cycle initial point return G99 Canned cycle R Plande return M00 Program stop – Tells the CNC machine to stop in the middle of a program. M01 Optional Program Stop – Tells the CNC machine to stop ONLY if the optional stop switch is active M02 Program end M03 Turns the Spindle on in a Clockwise direction M04 Turns the Spindle on in a Counter-Clockwise direction M05 Turns the Spindle off M06 Tool change M07 Optional coolant is not available on all machine configurations M08 Turns flood coolant on M09 Turns flood coolant off M10 Normally used to turn 4th Axis brake on (mill) M11 Normally used to turn 4th Axis brake off (mill) M19 Spindle Orientation M30 Program end and reset M31 Chip conveyor on (forward) M33 Chip conveyor off M88 Turns through the spindle coolant on M89 Turns through the spindle coolant off M97 Calls up sub program for local program M98 Sub Program Call M99 Loop or return to rerun a sub program
https://www.doubao.com/chat/181318342283522