2.3.3 G&M Codes PPT

1. Introduction to G&M Codes

  • Copyright: 2021. Project Lead The Way, Inc.

  • Focus: G & M Codes for CNC programming in Engineering Computer Integrated Manufacturing.

2. G & M Codes Overview

  • Purpose: Operate CNC machines.

  • History: Initially utilized punch tape; evolved into computer chips in the 1970s.

3. Current Use of G & M Codes

  • Translation: Converts human-readable instructions into machine language.

  • Input Methods: Can be typed directly or generated by a software program.

4. Sample Programming Structure

4.1 Tool Change Example

  • Block N01: M06 T1

    • Function: Change to tool #1

  • Comment: Explained through separator comments.

4.2 Spindle Activation

  • Block N02: M03 S1500

    • Function: Turn spindle on at 1500 RPM.

4.3 Coordinate Movement

  • Block N03: G90 G01 X.5 Y.5 Z0 F1

    • Prep Code:

      • G90: Absolute positioning

      • G01: Linear interpolation

    • Coordinate Parameters:

      • X: 0.5

      • Y: 0.5

      • Z: 0

      • Feed Rate: 1 in/min

5. Important Terminology

5.1 Address and Parameters

  • Address Character: A letter designating function classes in G & M code.

  • Parameter: Attributes of features that can be modified.

5.2 Words and Blocks

  • Word: Combination of address (letter) and number.

  • Block: A single line of code in an NC part program.

6. G Codes Overview

6.1 Preparatory Commands

  • G90: Absolute Coordinates

  • G91: Relative Coordinates

  • G00: Rapid Traverse (moving without cutting)

  • G01: Straight Line Interpolation (cutting)

  • G02: Circular Interpolation (clockwise)

  • G03: Circular Interpolation (counter-clockwise)

  • G04: Dwell command (pause for a specified time)

  • G05: User intervention required pause.

6.2 Arc Commands

Method 1: Using Coordinates (I & J for center point)
  • Examples:

    • Absolute:

      • N0 G90; Absolute mode

      • N5 G01 X1 Y2; Starting point

      • N10 G02 X2 Y1 I1 J1; Circular move.

    • Relative:

      • N0 G91; Relative mode

Method 2: Using Radius (R)
  • Examples:

    • Absolute:

      • N10 G02 X2 Y1 R1; Circular move using radius.

    • Relative:

      • N10 G02 X1 Y-1 R1; Circular movement using radius in relative mode.

7. Common G Codes

  • G20: Inch programming units.

  • G21: Millimeter programming units.

  • G80: Cancel canned cycle.

  • G81: Start drilling cycle.

  • G82: Start drilling cycle with dwell.

8. M Codes (Miscellaneous Codes)

  • M00: Pause execution.

  • M01: Optional stop.

  • M02: End of program.

  • M03: Turn on spindle.

  • M05: Turn off spindle.

  • M06: Change tool.

  • M08/M09: Control accessory states.

  • M30: Program end and reset.

  • M47: Rewind for handshaking operations.

9. Recommended Practices in Coding

9.1 Code Management

  • Avoid unnecessary repetition of codes within blocks. Modal codes remain until changed.

  • Clearly denote unit type before starting programming.

9.2 Safe Programming Techniques

  • Use tool change commands to ensure safe tool positioning.

  • Raise the tool out of stock at the end of the program.

9.3 Sample Parts and Programming

  • Absolute Coordinates Example:

    • Points A (0.5, 0.5), B (0.5, 1.5), etc.

  • Sample Program (Absolute): Sequential G & M code to create part features.

  • Incremental programming examples that illustrate movement from current position.

10. Practice Examples and Solutions

10.1 Arc Command Identification

  • Identifying arc commands through practical questions and solutions.

10.2 Code Line Explanations

  • Analyze and explain individual line codes in G&M programming.

11. References

  • Mattson, M. (2010). CNC Programming Principles and Applications. Oregon City, OR: Delmar.