(Part A) Machinerys Handbook 31st Edition Pages 1-1484

CNC PROGRAMMING CODES Machinery's Handbook, 31st Edition

1359

Table 3. M-codes

M-Code

Description

M-Code

Description

M00 Program stop

M09 Coolant OFF M19 Spindle orientation M30 Program end

M01 Optional program stop M03 Spindle rotation normal (clockwise) M04 Spindle rotation reverse (counterclockwise)

M60 Automatic Pallet Change (APC) M98 Subprogram call M99 Subprogram end

M05 Spindle stop

M06 Automatic Tool Change (ATC)

M08 Coolant ON Units of Measurement (G20, G21).— Dimension words in CNC programming are data that contain a location, distance, radius or feed rate. In all cases, such data is dependent on the active units of measurement. For CNC work, either metric or US customary units can be selected by the program or by manual setting. US customary units can be set by G20 (G70 for older controls) command, metric units by G21 (G71 for older controls) command, and each command cancels the other. US customary mode is specified in inches, metric mode in millimeters. In some cases, feet/min or m/min are also used. Dimensions measured along an axis can be programmed up to four decimal places in inches, and three decimal places in millimeters. Minimum increment (i.e., amount of motion) possible is 0.0001 inch or 0.001 mm. Maximum programmable motion amount is typically 9999.9999 inches or 99999.999 mm. Note that there is no actual unit conversion involved, just a shift in decimal point position. Absolute and Incremental Programming (G90, G91).— A motion dimension along X, Y, Z axes (as well as any parallel or rotary axis) can be programmed in two ways—as an absolute location measured from part zero (origin) or as an incremental distance and direction measured from the current tool position. The absolute method of programming is selected by the G90 command, the incremental method by the G91 command. One command cancels the other. The benefit of the absolute programming method is that one change of a point location requires only one change in the program. The same change in incremental program will require two changes. The main benefit of incremental programming method is that it can be used for a toolpath repetition, typically in the form of subprograms or macros. Spindle Function (S-Address).— The spindle function programmed with the S-address causes the machine spindle to rotate at a defined rate in revolutions per minute (r/min). Its programmable range is set by the machine manufacturer in increments of one revolution. The major difference between machining centers and some lathe operations defines the meaning of the S-address used in the program: 1) Milling—direct spindle speed in r/min (all operations) 2) Turning, Boring, Facing, and Grooving—cutting speed in ft/min or m/min 3) Threading and Centerline Operations—direct spindle speed in r/min In all three application groups, spindle rotation direction must also be specified, using M03 or M04 miscellaneous functions. Example: For milling, the programming is straightforward: S800 M03—normal spindle rotation (CW) at 800 revolutions per minute S750 M04—reverse spindle rotation (CCW) at 750 revolutions per minute CNC Lathes: For CNC lathes, the situation is somewhat different, because the part itself is rotating and cutting diameters change constantly, particularly during turning and boring operations. To select the required spindle speed mode, two G-codes are available: G96—constant cutting speed—programmed in ft/min or m/min G97—constant spindle speed—programmed in r/min Example: G96 S300 M03 is 300 ft /min in G20 mode, or 300 m/min in G21 mode. G97 S1200 M03 is 1200 r/min, regardless of the measuring units selected.

Copyright 2020, Industrial Press, Inc.

ebooks.industrialpress.com

Made with FlippingBook - Share PDF online