Preparatory codes use the address word G followed by two digits. These functions usually set the N/C system to assume certain operation conditions, or they prepare the N/C system to do something in a certain manner. The Electronics Industries Association (EIA) and the Aircraft Industries Association (AIA) have adopted a standard for G-codes (called EIA-274-D) that assigns specific functions to specific G-codes. That standard has also been adopted by the American National Standards Institute (ANSI). However, there is much deviation and variation from one N/C machine to another. The programmer is advised to consult the programming manual for the particular N/C machine being programmed to determine which code goes with which function, as well as what variable data must also be included and how to include them.
Preparatory codes can be categorized into the following groups:
Most G-codes are modal, that is, they stay in effect until changed or deactivated (canceled). Much G-code variation exists among various makes of N/C controllers. The following descriptions (including the more commonly used G80-series canned Z-axis cycles), while typical of many controllers, are not applicable to every N/C controller and do not necessarily conform to the RS-274-D standard. The programmer is advised to consult the programming manual for the particular machine being programmed.
|G-Codes for Movement
|sets the controller for rapid travel mode axis motion used for point-to-point motion. Two-axis X and Y moves may occur simultaneously at the same velocity, resulting in a nonlinear dogleg cutter path. With axis priority, three-axis rapid travel moves will move the Z-axis before the X- and Y- if the Z-axis cutter motion is in the negative positive direction; otherwise the Z axis will move last.
|sets the controller for linear motion at the programmed feedrate. The controller will coordinate (interpolate) the axis motion of two-axis moves to yield a straight-line cutter path at any angle. A feedrate must be in effect. If no feedrate has been specified before entering the axis destination commands, the feedrate may default to zero inches per minute, which will require a time of infinity to complete the cut.
|sets the controller for motion along an arc path at programmed feedrate in the clockwise direction. The controller coordinates the X and Y axes (circular interpolation) to produce an arc path. How it works is discussed in a subsequent chapter.
|is the same as G02, but the direction is counterclockwise. G00, G01, G02, and G03 will each cancel any other of the four that might be active.
|is used for dwell on some makes of N/C controllers. It acts much like the M00 miscellaneous command in that it interrupts execution of the program. Unlike the M00 command, G04 can be an indefinite (untimed) dwell or it can be a timed dwell if a time span is specified.
|G-Codes for Offsetting the Cutter's Center
|deactivates both G41 and G42, eliminating the offsets.
|is used for cutter offset compensation where the cutter is on the left side of the workpiece looking in the direction of motion. It permits the cutter to be offset an amount the programmer specifies to compensate for the amount a cutter is undersize or oversize.
|is the same as G41 except that the cutter is on the right side looking in the direction of motion. G41 and G42 can be used to permit the size of a milling cutter to be ignored (or set for zero diameter) when writing N/C programs. Milling cut statements can then be written directly in terms of workpiece geometry dimensions. Cutting tool centerline offsets required to compensate for the cutter radius can be accommodated for the entire program by including a few G41 and/or G42 statements at appropriate places in the program.
|G-Codes for Setting Measurement Data Units
|sets the controller to accept inch units.
|sets the controller to accept millimeter units.
|G-Codes for Calling (Executing) Canned Cycles
|is used by some models of N/C controllers for a canned cycle for milling rectangular pockets. It cancels itself upon completion of the cycle.
|is used by some models of N/C controllers for a canned cycle for milling circular pockets. It cancels itself upon completion of the cycle.
|deactivates (cancels) any of the G80-series canned Z-axis cycles. Each of these canned cycles is modal. Once put in effect, a hole will be drilled, bored, or tapped, each time the spindle is moved to a new location. Eventually the spindle will be moved to a location where no hole is desired. Canceling the canned cycle terminates its action.
|is a canned cycle for drilling holes in a single drill stroke without pecking. Its motion is feed down (into the hole) and rapid up (out of the hole). A Z-depth must be included.
|is a canned cycle for counterboring or countersinking holes. Its action is similar to G81, except that it has a timed dwell at the bottom of the Z-stroke. A Z-depth must be included.
|is a canned cycle for peck drilling. Peck drilling should be used whenever the hole depth exceeds three times the drill's diameter. Its purpose is to prevent chips from packing in the drill's flutes, resulting in drill breakage. Its action is to drill in at feedrate a small distance (called the peck increment) and then retract at rapid travel. Then the drill advances at rapid travel ("rapids" in machine tool terminology) back down to its previous depth, feeds in another peck increment, and rapids back out again. Then it rapids back in, feeds in another peck increment, etc., until the final Z-depth is achieved. A total Z-depth dimension and peck increment must be included.
|is a canned cycle for tapping. Its use is restricted to N/C machines that have a programmable variable-speed spindle with reversible direction of rotation. It coordinates the spindle's rotary motion to the Z-axis motion for feeding the tap into and out of the hole without binding and breaking off the tap. It can also be used with some nonprogrammable spindle machines if a tapping attachment is also used to back the tap out.
|is a canned cycle for boring holes with a single-point boring tool. Its action is similar to G81, except that it feeds in and feeds out. A Z-depth must be included.
|is also a canned cycle for boring holes with a single-point boring tool. Its action is similar to G81, except that it stops and waits at the bottom of the Z-stroke. Then the cutter rapids out when the operator depresses the START button. It is used to permit the operator to back off the boring tool so it does not score the bore upon withdrawal. A Z-depth must be included.
|is a chip breaker canned drill cycle, similar to the G83 canned cycle for peck drilling. Its purpose is to break long, stringy chips. Its action is to drill in at feedrate a small distance, back out a distance of 0.010 inch to break the chip, then continue drilling another peck increment, back off 0.010", drill another peck increment, etc., until the final Z-depth is achieved. A total Z-depth dimension and peck increment must be included.
|is another canned cycle for boring holes with a single-point boring tool. Its action is similar to G82, except that it feeds out rather than rapids out. It is designed for boring to a shoulder. A Z-depth must be included.
|G-Codes for Setting Position Frame of Reference
|sets the controller for positioning in terms of absolute coordinate location relative to the origin.
|sets the controller for incremental positioning relative to the current cutting tool point location.
|resets the X-, Y-, and/or Z-axis registers to any number the programmer specifies. In effect it shifts the location of the origin. It is very useful for programming bolt circle hole locations and contour profiling by simplifying trigonometric calculations.
|G-Codes for Modifying Operational Characteristics
|is a nonmodal deceleration override command used on certain Bridgeport CNC mills to permit a cutting tool to move directly--without decelerating, stopping, and accelerating--from a linear or circular path in one block to a circular or linear path in the following block, provided the paths are tangent or require no sudden change of direction and the feedrates are approximately the same.
|Next: Cutting Tool Motion Commands
Back to Contents Page
Updated Jan. 9, 2002
Copyright © 1988-2002 by George Stanton and Bill Hemphill
All Rights Reserved