G-codes and M-codes are fundamental to programming Computer Numerical Control (CNC) turning machines.
G-Codes for CNC Turning (Preparatory Codes)
G-codes tell the CNC turning machine what kind of motion to perform.
Motion Codes:
- G00: Rapid Traverse.
This code moves the tool quickly to a specified coordinate without cutting. It's used for positioning the tool before or after machining operations. This would rapidly move the tool to the X100.0 and Z50.0 position.G00 X100.0 Z50.0
- G01: Linear Interpolation.
This code moves the tool in a straight line at a programmed feed rate (specified by the F
word).It's the primary code for cutting operations. G01 X50.0 Z-25.0 F0.2
This would move the tool in a straight line from its current position to X50.0 and Z-25.0 at a feed rate of 0.2 mm/revolution (assuming G95 is active).
- G02: Circular Interpolation Clockwise.
This code moves the tool along a circular arc in a clockwise direction at a programmed feed rate. The arc is defined by the endpoint (X, Z) and either the radius (R) or the center point (I, K relative to the starting point). This would create a clockwise arc to the endpoint X40.0, Z-20.0 with a radius of 10.0 at a feed rate of 0.15 mm/revolution.G02 X40.0 Z-20.0 R10.0 F0.15
This achieves the same arc, but the center is defined as I10.0 (in X) and K0.0 (in Z) relative to the starting point.G02 X40.0 Z-20.0 I10.0 K0.0 F0.15
- G03: Circular Interpolation Counterclockwise.
Similar to G02, but the arc is created in a counterclockwise direction. G03 X40.0 Z-20.0 R10.0 F0.15
G03 X40.0 Z-20.0 I10.0 K0.0 F0.15
Plane Selection (though less common on a 2-axis lathe, they can be relevant for live tooling):
- G17: XY Plane Selection (typically for milling on a lathe with live tooling).
- G18: XZ Plane Selection (default for most lathes).
- G19: YZ Plane Selection (less common).
Units and Modes:
- G20: Inch System Selection. Programs dimensions in inches.
- G21: Millimeter System Selection. Programs dimensions in millimeters.
- G40: Cutter Compensation Cancel.
Cancels any active tool nose radius compensation. - G41: Cutter Compensation Left. Activates tool nose radius compensation to the left of the programmed path.
- G42: Cutter Compensation Right.
Activates tool nose radius compensation to the right of the programmed path. - G90: Absolute Programming.
Coordinates are defined from the program origin. - G91: Incremental Programming. Coordinates are defined relative to the current tool position.
- G94: Feed Per Minute.
The feed rate F
is in units per minute (e.g., mm/min or inches/min). - G95: Feed Per Revolution.
The feed rate F
is in units per revolution (e.g., mm/rev or inches/rev), which is synchronized with the spindle speed. - G96: Constant Surface Speed (CSS).
The spindle speed is automatically varied based on the changing diameter to maintain a constant cutting speed at the tool tip. Requires specifying the surface speed with the S
word (e.g., G96 S150). - G97: Constant Spindle Speed.
Cancels CSS mode, and the spindle rotates at the programmed RPM (specified by the S
word).
Canned Cycles (for repetitive operations):
- G70: Finishing Cycle.
Used after a roughing cycle (like G71, G72, G73) to machine the final part profile. - G71: Rough Turning Cycle (Longitudinal). For roughing material along the Z-axis.
- G72: Rough Facing Cycle (Transverse).
For roughing material along the X-axis (facing). - G73: Pattern Repeating Cycle.
For roughing based on a defined pattern. - G74: Peck Drilling Cycle (for deep hole drilling with chip breaking).
- G75: Grooving Cycle.
For machining grooves. - G76: Threading Cycle.
For cutting threads. - G81-G89: Various drilling, tapping, and boring canned cycles (often used with live tooling).
Tool Offsets:
- G43: Tool Length Offset Positive (less common on a 2-axis lathe).
- G49: Tool Length Offset Cancel.
Other Important G-Codes:
- G04: Dwell.
Pauses the program execution for a specified time (P in milliseconds or X in seconds) or spindle revolutions. - G28: Return to Machine Home Position.
- G30: Return to Second, Third, or Fourth Home Position.
- G50: Setting Spindle Speed Limit/Coordinate System Shift.
Can be used to set a maximum spindle RPM in CSS mode or to establish a new work coordinate system (less common on modern controls for this purpose). - G53: Machine Coordinate System Selection.
Moves the tool in the machine's absolute coordinate system, ignoring any work offsets. - G54-G59: Work Coordinate System Selection.
Allows using predefined work offsets, making it easier to machine multiple parts or setups.
M-Codes for CNC Turning (Miscellaneous Codes)
M-codes control the auxiliary functions of the CNC turning machine.
Program Control:
- M00: Program Stop.
Halts the program execution. Requires manual intervention (cycle start) to resume. - M01: Optional Stop. Stops the program only if the "optional stop" switch on the machine control panel is enabled.
- M02: Program End.
Ends the program and may reset the controller. - M30: Program End and Rewind.
Ends the program and typically returns the control to the beginning of the program for the next cycle.
Spindle Control:
- M03: Spindle Start Clockwise (Forward).
Turns on the spindle in the forward direction (typically for most turning operations). The spindle speed is set by the S
word. - M04: Spindle Start Counterclockwise (Reverse).
Turns on the spindle in the reverse direction (used for specific operations like certain threading or when using specific tools). - M05: Spindle Stop.
Turns off the spindle.
Coolant Control:
- M08: Coolant On.
Turns on the machine's coolant system (flood coolant). - M09: Coolant Off.
Turns off the coolant system. - M07: Coolant On (Mist).
Activates mist coolant if the machine is equipped with it.
Tool Change:
- M06: Tool Change.
Initiates a tool change sequence. The specific action depends on the machine's automatic tool changer (ATC) mechanism and usually involves a preceding T
word to select the next tool (e.g.,T0101
for tool 1, offset 1).
Chuck/Tailstock Control (machine-dependent):
- M10/M11: Chuck Clamp/Unclamp (may vary).
- M78/M79: Tailstock Forward/Backward (may vary).
- M68/M69: Chuck Close/Open (hydraulic chucks, may vary).
Other M-Codes:
- M19: Spindle Orientation.
Orients the spindle to a specific angular position. Often used for tool changes or specific machining operations. - M29: Rigid Tapping Mode.
Puts the machine in a mode for synchronized spindle and Z-axis movement for precise tapping. - M98: Subprogram Call.
Calls a subprogram (a separate block of code). - M99: Subprogram End and Return.
Marks the end of a subprogram and returns the control to the line after the M98 call in the main program.
Important Considerations:
- Machine Manufacturer Specifics: While ISO standards define many G and M codes, some codes and their functions can vary between different CNC machine manufacturers and even different models from the same manufacturer. Always refer to the specific machine's programming manual for the most accurate information.
- Controller Interpretation: The CNC controller (e.g., Fanuc, Siemens, Haas) interprets these codes. While there's a degree of standardization, nuances in implementation can exist.
- Modal vs. Non-Modal Codes: Some G-codes are modal, meaning they remain in effect until another G-code from the same group is encountered (e.g., G01 remains active until a G00 or G02/G03 is programmed). M-codes are generally non-modal, meaning they are executed only in the block where they appear.
Understanding G and M codes is crucial for anyone involved in CNC turning, from programming to operation. By combining these codes effectively, complex machining operations can be automated with precision and efficiency.
CNC Theory & MCQ English Book
Comments
Post a Comment