ie433 cad/cam computer aided design and computer aided manufacturing part-12 cnc turning programming...

83
IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Upload: shanon-blair

Post on 15-Jan-2016

245 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

IE433 CAD/CAMComputer Aided Design and

Computer Aided Manufacturing

Part-12CNC Turning Programming

Industrial Engineering Department

King Saud University

Page 2: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

LETTER ADDRESS LISTINGLetter addresses are variables used in G- and M-codes. Most G-codes contain a variable, defined by the programmer, for each specific function. Each letter used in CNC programming is called an address, or word. The words used for programming are as follows.F Assigns a feed-rateG Preparatory functionI X-axis location of ARC centerK Z-axis location of ARC centerM Miscellaneous functionN Block number (specifies the start of a block)P Start blockD Dwell timeQ Block endD DepthR RadiusS Sets the spindle speedT Specifies the tool to be usedA Tool angleU X stock or incremental valueW Z stock or incremental valueX X coordinateZ Z coordinate

Page 3: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G-CODESG-codes are preparatory functions, which involve actual tool moves (for example, control of the machine). These include rapid moves, feed moves, radial feed moves, dwells, and roughing and profiling cycles. Most G-codes described here are modal, meaning that they remain active until canceled by another G-code. The following codes are described in detail in the following sections: G00 Positioning in rapid ModalG01 Linear interpolation ModalG02 Circular interpolation (CW) ModalG03 Circular interpolation (CCW) ModalG04 DwellG20 Inch units ModalG21 Metric units ModalG28 Automatic zero returnG29 Return from zero return positionG32 Simple or constant threadG40 Tool nose radius compensation cancel ModalG41 Tool nose radius compensation left ModalG42 Tool nose radius compensation right Modal

Page 4: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G50 Coordinate system setting

G54-G59 Workpiece coordinate systems

G70 Finishing cycle Modal

G71 Turning cycle Modal

G72 Facing cycle Modal

G74 Peck drilling cycle Modal

G75 Grooving cycle

G76 Threading cycle

G90 Absolute programming Modal

G91 Incremental programming Modal

G96 Constant surface speed setting Modal

G97 Constant spindle speed setting Modal

G98 Linear feedrate per time Modal

G99 Feedrate per revolution Modal

Page 5: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G00 POSITIONING IN RAPIDFormat: N_ G00 X_ Z_The G00 command is used primarily to move the tool to and from a non-cutting position. It is used most often before and after a G01, G02, and G03 command. It can also be used to position the tool for a tool change. This command causes the tool to move at its fastest possible rate

Page 6: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

CNC turning fundamentals – Absolute coordinates

When plotting points using absolute coordinates, always start at the origin (X0, Z0). Then travel along the Z axis until you reach a point directly below the point that you are trying to plot. Write down the Z value and then go up until you reach your point. Write down the X value. You now have the XZ (or ZX) coordinate for that point.

Page 7: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

EXAMPLE: N15 G90 G00 X1.8 Z0.0In this example the tool positions in rapid mode from its present location to a point at X1.8, Z0

Page 8: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G00:Workpiece Size: Length 4", Diameter 2"Tool: Tool #2, Right-hand Facing ToolTool Start Position: X2, Z3% (Program Start Flag):1000 (Program number 1000)N5 G20 G40 (INCH UNITS, TNR cancel)N10 T0101 (TOOL CHANGE, Tool #1, Register #1)N15 M03 (Spindle on CW)N20 G00 X1.9 (Rapid to X1.9)N25 Z0.1 M08 (Rapid to Z0.1)N30 G01 Z-1.25 F0.012 (Feed to Z-1.25 at 0.12 IN./rev)N35 G00 X4.0 Z3.0 M09 (Rapid to X4 and Z3)N40 T0100 M05 (Tool cancel Register #1)N45 M30 (Program end)

Page 9: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G01 LINEAR INTERPOLATIONFormat: N_ G01 X_ Z_ F_The G01 command executes all movement along a straight line at a particular feedrate. These straight-line feed moves may cut in one or two axes simultaneously. This command can be used for turning, facing, and tapering. It is specified by the G01 command, followed by the endpoint of the move, and then a specified feedrate.

Page 10: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

EXAMPLE: G01 Z-2.5 F0.01In this example, the tool cuts a straight line from its present location to a point at Z–2.5 at a rate of 0.01 ipr

Page 11: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G01:Workpiece Size: Length 4", Diameter 2.5"Tool: Tool #1, Right-hand Facing ToolTool Start Position: X2, Z3%:1001N5 G20 G40N10 T0101N15 M03N20 G00 X2.375 M08N22 Z0.1N25 G01 Z-2.0 F0.015 (Feed to Z–2.0 at a feedrate of 0.015 ipr)N30 G00 X2.5N35 Z0.1N40 X2.25N45 G01 Z-1.75 (Feed to Z–1.75 at same feedrate)N50 G00 X2.375N55 Z0.1N60 X2.125N65 G01 Z-1.5 (Feed to Z–1.5 at same feedrate)N70 G00 X2.25N75 Z0.1

Page 12: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

N80 X1.875

N85 G01 Z0 (Feed to 0 at same feedrate)

N90 X2.125 Z-0.125 (Feed to (X2.125, Z–1.125) at same feedrate)

N95 G00 X4 M09

N100 Z3

N105 T0100 M05

N110 M30

Page 13: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G02 CIRCULAR INTERPOLATION (CW)Format: N_ G02 X_ Z_ I_ K_ F_or N_ G02 X_ Z_ R_ F_The G02 command executes all circular or radial cuts in a clockwise motion. It is specified by the G02 command, followed by the endpoint for the move, the radius (the distance from startpoint to the centerpoint), and a feedrate. Therefore the three requirements for cutting arcs are:1.                     The endpoint.2.                     The radius R or I for X and K for Z values that represent the incremental distance from the startpoint to the centerpoint. The R value is limited to a maximum of 90°.3.                     The feedrate.

Page 14: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

 EXAMPLE: N05 G01 X2 Z-1 F0.012N10 G02 X0 Z0 I-1 K0or N10 G02 X0 Z0 R0.5

Page 15: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G02 Work piece Size: Length 4", Diameter 2"Tool: Tool #2, Right-hand Facing ToolTool Start Position: X2, Z3%:1002N5 G20 G40N10 T0202N15 M03N20 G00 X1.7N22 Z0.1 M08N25 G01 Z-0.5 F0.012N30 G00 X2N35 Z0.1N40 X1.4N45 G01 Z-0.25N50 G00 X2.1N55 Z-1N60 G01 X2.0N65 G02 X0 Z0 I-1.0 K0 (90° CW arc feed move)N70 G00 X2.1N75 Z-1.0N80 G01 X2.0N85 G02 X2.0 Z-2 I0.5 K-0.5 (Partial CW arc feed move)N90 G00 X4.0 Z3.0 M09N95 T0200 M05N100 M30

Page 16: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G03 CIRCULAR INTERPOLATION (CCW)Format: N_ G03 X_ Z_ I_ K_ F_or N_ G03 X_ Z_ R_ F_The G03 command executes all radial cuts in a counterclockwise motion. It is specified by the G03 command, followed by the endpoint for the move, the radius (the distance from the startpoint to the centerpoint), and a feedrate.The radius is specified by defining the incremental distance from the arc’s start-point to its center-point in both the X and Z directions. These values are identified by I and K variables, respectively. The R word, the value of the radius of the arc, can also be used.

Page 17: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

EXAMPLE: N10 G01 X0 Z0 F0.012N15 G03 X2.0 Z-1.0 I0 K-1.0 In this example, the tool cuts a counterclockwise arc from its present position to (X2, Z–1) at a feedrate of 0.012 ipr

Page 18: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G03EX3:Workpiece Size: Length 4", Diameter 2"Tool: Tool #2, Right-hand Facing ToolTool Start Position: X2, Z3%:1003N5 G20 G40N10 T0202N15 M03N20 G00 X1.7N22 Z0.1 M08N25 G01 Z-0.5 F0.012N30 G00 X2.0N35 Z0.1N40 X1.4N45 G01 Z-0.25N50 G00 X1.5N55 Z0.1N60 X0N65 G01 Z0N70 G03 X2.0 Z-1.0 I0 K-1.0 (90° CCW arc feed move)N75 G01 Z-2.0N80 G03 X2.0 Z-1.0 I0.5 K0.5 (Partial CCW arc feed move)N85 G00 X4.0 Z3.0 M09N90 T0200 M05N95 M30

Page 19: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G04 DWELLFormat: N_ G04 P_The G04 command is a no modal dwell command that halts all axis movement for a specified time while the spindle continues revolving at the specified rpm. A dwell is sometimes used to allow for the clearance of chips.

Page 20: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

EXAMPLE: N10 G04 P2.0In this example, the tool pauses at its current location for a period of 2 seconds

Page 21: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G20 Inch UnitsFormat: N_ G20

G21 Metric or SI Units

Format: N_ G2

Page 22: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G28 Automatic Return to Reference Point

Format: N_ G28 X_ Z_The G28 command is commonly used prior to an automatic tool change. It allows the existing tool to be positioned to the predefined reference point automatically via an intermediate position. This ensures that when the tool turret is engaged, it is properly aligned and clears the workpiece.

Page 23: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G28 Automatic Return to Reference Point

Format: N_ G28 X_ Z_The G28 command is commonly used prior to an automatic tool change. It allows the existing tool to be positioned to the predefined reference point automatically via an intermediate position. This ensures that when the tool turret is engaged, it is properly aligned and clears the workpiece.

Page 24: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G28:Workpiece Size: Length 4", Diameter 2.5"Tool: Tool #1, Right-hand ToolTool Start Position: X2", Z3"Zero Return Position: X2", Z3"%:1028N5 G20 G40N10 T0101N12 M03 M08N15 G00 X2.25N20 Z0.1N25 G01 Z-2.0 F0.012N30 G28 X4.0 Z0.5 M09 (Rapid move to zero return position)N35 T0100 M05N40 M30

Page 25: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G29 Automatic Return from Reference PointFormat: N_ G29 X_ Z_

The G29 command can be used immediately after an automatic tool change. It allows the new tool to be returned from the predefined reference point to the specified point via an intermediate point specified by the previous G28 command.

Page 26: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G29 Automatic Return from Reference Point

Page 27: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G29EX29:Workpiece Size: Length 4", Diameter 2.5"Tools: Tool #1, Right-hand ToolTool #2, Finishing ToolTool Start Position: X2", Z3"Zero Return Position: X2", Z3"%:1029N5 G20N10 T0101N12 M03 M08N15 G00 X2.25N20 Z0.1N25 G01 Z-2.0 F0.012N30 G28 X4.0 Z0.5 M09N35 T0100 M05N40 T0202N45 M03 M08N50 G29 X2.25 Z0.1 (Return from zero return position)N55 G01 Z-2.0N60 G28 X4 Z0.5 M09N65 T0100 M05N70 M30

Page 28: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G32 Simple Thread CycleFormat: N_ G32 Z_ K_ F_

The G32 command invokes a simple or basic thread cycle.  It automatically synchronizes spindle and axis movements to achieve the desired thread pitch defined by the F word address.

Page 29: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G32 Simple Thread CycleFormat: N_ G32 X_ Z_ F_

Page 30: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G32EX32:Workpiece Size: Length 4", Diameter 2"Tool: Tool #4, Neutral Tool / Threading ToolTool Start Position: X2, Z3%:1040N5 G20 G40 (Set TNR cancel at beginning)N10 T0101N15 M03 M08N20 G00 Z0.1N25 X2.1N30 G01 X1.0 F0.012N35 G32 Z-2.0 F.05 (Machine a single-pass thread)N40 G00 X4.0N45 T0100 M05N50 M30

Page 31: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G40 TOOL NOSE RADIUS (TNR) COMPENSATION CANCEL

Format: N_ G40The G40 command cancels any compensation that was applied to the tool during a program. It also acts as a safeguard to cancel any cutter compensation applied previously. TNR compensation is used to compensate for the small radius on single-point turning and boring tools. Normally, CNC programs are written so that the tool tip follows the tool-path. This would be fine if all tools were perfect and had sharp points. However, most turning tools have a small radius on the cutting edge that makes the tools deviate slightly from the programmed path. In this case, the tool must be offset either left or right. However, tool nose radius compensation is modal, so the compensation must be canceled once it is no longer required. The G40 command does this.

Page 32: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G41 Tool Nose Radius (TNR) Compensation LeftFormat: N_ G41

The G41 command applies cutter compensation to the left hand side of the programmed tool path.  This amount is equal to the current tool's nose radius value, which is stored in the Tool Offset Register table of the controller.   This register number is referenced by the last two digits in the tool change command.  For example, a tool change command with T0202 will reference the tool nose radius value in register #2.

Page 33: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G41 Tool Nose Radius (TNR) Compensation Left

Page 34: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G41:Workpiece Size: Length 4", Diameter 2"Tools: Tool #8, Left-hand Facing ToolTool #10, 1" DrillTool #12, Center DrillTool Start Position: X2, Z3%:1041N5 G20 G40N10 T1212 M08N15 G98 M03 S2000N20 G00 X0N25 Z0.1N30 G01 Z-0.2 F2N35 G00 Z3N40 X4 T1200N45 T1010N50 G00 X0N55 Z0.1

N60 G74 Z-2 F0.5 D0 K0.25N65 G00 Z3N70 T1000 X4N75 G99 T0808N80 G41 G00 X0.8 (TNR compensation left)N85 Z0.2N90 G01 Z-1.75 F0.012N95 X0.9N100 Z-0.25N105 G03 X2 Z0 R0.5N110 G40 G00 X4 Z3 M09N115 T0800 M05N120 M30

Page 35: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G42 Tool Nose Radius Compensation RightFormat: N_ G42

The G42 command applies cutter compensation to the right hand side of the programmed tool path.  This amount is equal to the current tool's nose radius value, which is stored in the Tool Offset Register table of the controller.   This register number is referenced by the last two digits in the tool change command.  For example, a tool change command with T0808 will reference the tool nose radius value in register #8.

Page 36: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G42 Tool Nose Radius Compensation RightFormat: N_ G42

Page 37: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G50 Coordinate System SettingFormat: N_ G50 X_ Z_

The G50 command is used to specify the program zero from the current tool position. This sets the coordinate system for the current program.The coordinate system setting is similar to specifying the origin point on a mill.  The origin is not a physical spot on the machine tool, but rather a reference point to which the coordinates relate. In turning, the zero reference or origin can be specified from the right-hand center-point of the workpiece, the left of back of the workpiece, or from the face of the chuck.

Page 38: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G50 Coordinate System SettingFormat: N_ G50 X_ Z_

Page 39: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G54 – G59 Working Coordinate SystemFormat: N_ G54 through G59

The G54 – G59 commands are used to reposition the origin as per a user- defined working coordinate system. Six register sets in the controller which hold the values for the  working coordinate systems. The G54 – G59 commands are very useful when multiple workpiece fixtures are used.

Page 40: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G70 Finishing CycleFormat: N_ G70 P_ Q_

The G70 command is used immediately after a roughing cycle, such as a G71 Rough Turning, or G72 Rough Facing cycle command.  The remaining material is machined as specified by the P and Q block number values, which point to the start and finish blocks of the desired part profile contour.

Page 41: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G70 FINISHING CYCLEFormat: N_ G70 P_ Q_P Start block of segmentQ End block of segmentF Feedrate

G71 ROUGH TURNING CYCLEFormat: N_ G71_ P_ Q_ U_ W_ D_ FP Start block of segmentQ End block of segmentU Amount of stock to be left for finishing in XW Amount of stock to be left for finishing in ZD Depth of cut for each pass in thousandthsF Feedrate for finish pass

Page 42: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G71 Rough Turning CycleFormat: N_ G71_ P_ Q_ U_ W_ D_ F

The G71 command automatically generates roughing passes to turn a workpiece to a specified profile, leaving an allowance for finishing. It reads a program segment specified by the P and Q letter addresses and determines the number of passes, the depth of cut for each pass, and the number of repeat passes for the cycle.           Cutting is done parallel to the Z axis.  The U and W signs determine the direction of the cuts.

Page 43: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

EXAMPLE: N35 G71 P40 Q100 U.025 W.025 D625 F0.012 In this example, the MCU reads the data between N40 and N100 and removes material according to this profile. The cycle has a depth of cut of 1/16 in. for each pass at 0.012 ipr

Positive and negative U and W signs instruct the MCU on how to execute the rough turning cycle. This type of cycle is known as a Type A roughing cycle on most Fanuc controllers.

Page 44: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

The G71 command turns the part to the diameter specified in the program segment. The cutting moves are parallel to the Z axis. The upper half of the profile shows the G71 command and how it “steps” down to size. The lower half of the profile shows how the G70 command cleans up with a finishing pass.

Page 45: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G71:Workpiece Size: Length 4", Diameter 2"Tools: Tool #1, Right-hand Facing ToolTool #2, Right-hand Finishing ToolTool Start Position: X2, Z3%:1071N5 G90 G20N10 T0101N15 M03N20 G00 X2 Z0.1 M08N35 G71 P40 Q55 U0.05 W0.05 D625 F0.012 (Rough turning)N40 G01 X0 Z0N45 G03 X1 Z-0.5 I0 K-0.5N50 G01 Z-1.0N55 X2.1 Z-1.5N60 T0100 G00 X4 Z3N65 T0202N70 G00 X2 Z0.1N75 G70 P40 Q55 F0.006N80 G00 X4 Z3 M09N85 T0200 M05N90 M30

Page 46: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G72 ROUGH FACING CYCLEFormat: N_ G72 P_ Q_ U_ W_ D_ F_P Start blockQ End blockU Amount of stock to be left for finishing in XW Amount of stock to be left for finishing in ZD Depth of cut for finish passF Feedrate (this is optional)The G72 command automatically faces off a part to a predefined depth of cut, with preset offsets and feed rates.

Page 47: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

EXAMPLE: N20 G72 P25 Q45 U0.05 W0.05 D500 F0.012In this example, the MCU reads the commands in N25–N45 and then executes a facing operation, in accordance with the profile defined

Page 48: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G72 Rough Facing CycleFormat: N_ G72

The G72 command automatically faces off a part to a predefined profile, with preset offsets and feedrates leaving an allowance for finishing. It reads a program segment specified by the P and Q letter addresses and determines the number of passes, the depth of cut for each pass, and the number of repeat passes for the cycle. Cutting is done parallel to the X axis.  The U and W signs determine the direction of the cuts.

Page 49: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G72:Workpiece Size: Length 4", Diameter 1"Tools: Tool #1, Right-hand Facing ToolTool #2, Right-hand Finishing ToolTool Start Position: X2, Z3%:1072N5 G90 G20N10 T0101N15 M03N20 G00 X1 Z0.1 M08N25 G72 P30 Q50 U0.05 W0.05 D500 F0.012 (Rough facing)N30 G01 X0 Z0.1N35 X0.25N40 Z-0.125N45 X0.5 Z-0.25N50 G02 X1 Z-0.5 I0.25 K0N55 G00 X4 Z3 T0100N60 T0202N65 G00 X1 Z0.1N70 G70 P30 Q50 F0.006N75 G00 X4N80 Z3 M09N85 T0200 M05N90 M30

Page 50: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G74 PECK DRILLING CYCLEFormat: N_ G74 X0 Z_ K_ F_

The G74 command executes a peck drilling cycle with automatic retracts and incremental depths of cut. The G74 command is specified by several letter addresses:X0 X always 0Z Total depthK Peck depthF Feed rateEXAMPLE: N20 G74 X0 Z-1.0 K0.125 F0.015In this example, a hole is peck drilled to a total depth of 1 in., using 0.125 in. for the depth of each peck

Page 51: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G74 Peck Drilling CycleFormat: N_ G74 X0 Z_ K_ F_

The G74 command involves individual peck moves in each drilling operation. When this command is invoked, the tool positions itself as in a standard G81 drill cycle. The K value specifies the peck depth.

Page 52: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G74:Workpiece Size: Length 4", Diameter 1"Tools: Tool #12, Center DrillTool #10, 1/2" DrillTool Start Position: X2, Z3%:1074N5 G20 G98N10 T1212 M08N15 M03 S2000N20 G00 X0N25 Z0.1N30 G01 Z-0.2 F2N35 G00 Z3N40 X3 T1200N45 T1010N50 G00 X0N55 Z0.1N60 G74 X0 Z-1.5 K0.125 F0.5 (Drilling cycle)N65 G00 Z3N70 X4 M09N75 T1000 M05N80 M30

Page 53: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G75 GROOVING CYCLEFormat: N_ G75 X_ Z_ F_ D_ I_ K_X Diameter of grooveZ Z position of grooveF Incremental retractD Depth/X offsetK Z movementI X movementThe G75 command is used to machine grooves. EXAMPLE: N25 G75 X0.25 Z-0.75 F0.125 I0.125 K0.125This command defaults to the last specified feedrate. The F address is used to specify the retract distance, so the feedrate cannot be set within the grooving cycle.

Page 54: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G75 Grooving CycleFormat: N_ G75 X_ Z_ F_ D_ I_ K_

The G75 command invokes an outside diamter groove cycle. This cycle involves plunges into the workpiece from the outside of the workpiece parallel to the X axis.  The X value is the final diameter.  The Z value represents the final Z position.  The F value specifies the incremental retract after every plunge. The I and K values specify the incremental movements in the X and Z axes, respectively.

Page 55: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G75EX75:Workpiece Size: Length 4", Diameter 1"Tool: Tool #5, Grooving ToolTool Start Position: X2, Z3%:1075N5 G90 G20N10 T0505 F0.015N15 M03N20 G00 Z-0.5 M08N25 X1.2N30 G75 X0.5 Z-0.75 F0.125 D0 I0.125 K0.125 (Grooving cycle)N35 G00 X4N40 Z3 M09N45 T0500 M05N50 M30

Page 56: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G76 THREADING CYCLEFormat: N_ G76 X_ Z_ D_ K_ A_ F_The G76 command performs all threading operations in a cycle, with automatic depth change and tool path calculation. The G76 command is specified by several letter addresses:X Minor diameter of threadZ Position at end of threadD Depth of first pass in thousandths (the control uses the first depth of cut to determine the number of passes)K Depth of threadF Pitch of thread (thread pitch = 1/thread/in.)A Tool angle (If the tool angle is given, the tool will continue to cut on the leading edge of the tool; if no tool angle is given, the tool will cut on both sides.) EXAMPLE: N25 G76 X0.5 Z-1.0 D625 K0.25 A55 F0.1In this example, the tool cuts a thread, starting at its present location and ending at the specified XZ endpoint. The D value specifies each cut depth, and the K value defines the overall depth. The A value defines the tool angle, and the F value defines the pitch

Page 57: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G76 THREADING CYCLE

Page 58: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G76 Threading CycleFormat: N_ G74 X_ Z_ D_ K_ A_ F_

  The G76 command automatically performs all cutting operations required to achieve a thread.  From the programmed variables the cycle will calculate the toolpaths, based on the desired thread pitch, depth, and tool angle.X  designates the minor diameter of thread. Z  specifies the end of the thread. D designates the depth of the first pass. K specifies the depth of the thread. F specifies the desired pitch of the thread. A is tool angle.

Page 59: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Sample Program G76:Workpiece Size: Length 4", Diameter 1"Tool: Tool #6, Neutral ToolTool Start Position: X2, Z3%:1076N5 G90 G20N10 T0606 M08N15 M03N20 G00 X1N25 Z0.1N25 G76 X0.96 Z-2 D625 K0.125 A55 F0.1 (Threading cycle)N30 G00 X4N35 Z3 M09N35 T0600 M05N40 M30

Page 60: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G90 Absolute PositioningFormat: N_ G90 The G90 command defaults the system to accept all coordinates as absolute coordinates. These coordinates are measured from a fixed origin (X0, Y0, Z0) and expressed in terms of X, Y, and Z distances.

G91 Incremental PositioningFormat: N_ G91 Incremental coordinates are measured from the previous point and are expressed in terms of the relative X and Z distances from the previous point

Page 61: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

                                             

       The G96 command sets constant surface speed (CSS). When CSS is set the spindle speed will vary according to the tool position in the X direction. To maintain CSS the MCU automatically calculates the appropriate spindle speed to maintain proper relative speed between the tool and the workpiece. As the tool approaches the center of the rotating workpiece, the radius distance decreases and the spindle speed increases. The surface speed depends on the input units setting. If it is in metric units, the surface speed is set to meters per minute; if it is in inches, the surface speed is set to feet per minute. Note that the CSS is inversely proportional to the radius.

G96 Constant Surface Speed Setting

Format: N_ G96 S_

Page 62: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G97 Constant Spindle Speed SettingFormat: N_ G97 S_

The G97 command is used to cancel the G96 setting and set the spindle speed in revolutions per minute. The tool position does not affect the spindle speed.

NOTE: Always use the G97 command when programming any threading cycles.

Page 63: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G98 Linear Feedrate per TimeFormat: N_ G98

The G98 command sets the linear feedrate to units (inch or millimeter) per time (minutes). The setting depends on which type of unit is currently active. NOTE: The G98 command does not set the actual feedrate. The feedrate is defined by using the F letter address in the corresponding feed move command blocks.

Page 64: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

G99 Feedrate per RevolutionFormat: N_ G99

The G99 command sets the feedrate to units (inch or millimeter) per revolution. The setting depends on which type of unit is currently active.

All feed moves will accept units per revolution as the defining rate. It is the default setting on most CNC turning centers. It also is used to synchronize axes moves with the spindle, especially in programming threads.

Remember: Use the G99 prior to programming any threading cycle.

Page 65: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M-CODESM-codes are miscellaneous functions that include actions necessary for machining but not those that are actual tool movements (for example, auxiliary functions). They include spindle on and off, tool changes, coolant on and off, program stops, and similar, related functions. The following codes are described in detail in the following sections.M00 Program stopM01 Optional program stopM02 Program endM03 Spindle on clockwiseM04 Spindle on counterclockwiseM05 Spindle stopM07 Coolant 1 onM08 Coolant 2 onM09 Coolant offM98 Subprogram callM99 Return from subprogramM30 End of program, reset to startBlock Skip “/” used to bypass CNC blocksComments “(” and “)” used to help operator commentsNote: Two or more M-codes cannot be included on the same line.

Page 66: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M00 Program StopFormat: N_ M00

The M00 command is a temporary program stop function. When it is executed, all functions are temporarily stopped and will not restart until prompted by user input. This command is very useful in lengthy programs as a way to stop the machine in order to clear chips, take measurements, or adjust clamps, coolant hoses, and so on.

Page 67: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M01 Optional Program StopFormat: N_ M01

The M01 command is an optional stop command that also halts program execution, but only if the Optional Stop switch is set to ON. If the Optional Stop switch is set to OFF, the program will ignore any M01 commands it encounters in a program and no optional stops will be executed.

Page 68: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M02 Program EndFormat: N_ M02

The M02 command indicates the end of the main program. This command, instructs the MCU to switch off all machine operations (for example, spindle, coolant, all axes, and any auxiliaries) and terminates the program. This command appears on the last line of the program.

Page 69: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M03 Spindle on Clockwise Format: N_ M03 S_

The M03 command switches the spindle on so that it rotates clockwise. The spindle speed is designated by the letter address S followed by the spindle speed in revolutions per minute. The image shown illustrates clockwise operation.

Page 70: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M04 Spindle on CounterclockwiseFormat: N_ M04 S_

The M04 command switches the spindle on so that it rotates counterclockwise. It is programmed as with the M03 command. The spindle speed is designated by the letter address S, followed by the spindle speed in revolutions per minute.  The image shown illustrates counterclockwise operation.

Page 71: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M05 Spindle StopFormat: N_ M05

The M05 command turns off the spindle. Although other M-codes turn off all functions (for example, M00 and M01 ), this command is dedicated to shutting off the spindle. The M05 command appears most often at the end of a program, but it can also be used prior to a tool change command.

Page 72: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M07 and M08 Coolant On or M09 Coolant Off

Format: N_ M07 or N_ M08

The M07/M08 and M09 commands control coolant flow. M07/M08 turns the coolant flow on. In the simulator, the coolant status is shown in the information area. The M09 command shuts off coolant flow.

Page 73: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M10 Chuck Open or M11 Chuck Close Format: N_ M10 or N_ M11

The M10 and M11 commands control the automatic chuck. M10 opens the chuck, and M11 closes it. In the simulator, the automatic chuck status is shown in the Machine Status area. These commands are normally used in conjunction with automatic bar feeders.  The actual M codes used will vary according to machine tool manufacturer.

Page 74: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M30 Program End, Reset to StartFormat: N_ M30

The M30 command indicates the end of the program. In other words, no more program commands follow. This is a remnant of the older NC machines, which utilized paper tape and could not differentiate between one program and the next, so an End of Data command was developed. Now the M30 is used to end the program and reset it to the start.

Page 75: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M98 Subprogram callFormat: N_ M98 P_

The M98 command is used to call a subprogram.  The subprogram is referenced by the P letter address followed by the program number.  This is useful when similar operations are required for a particular program.  An example of using sub-programming is with bolt hole patterns where each hole must have several canned cycle operations performed on it.  If there are many holes to be drilled these can reside in the subprogram which is called after each canned cycle is invoked.

Page 76: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

M99 Return from SubprogramFormat: N_ M99

The M99 command is used to return from within a subprogram.  The machine control unit continues execution from the block number immediately after the M98 subprogram call.

Page 77: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Tool change function for turning Format: N_ T__ __

The tool change function for turning involves the use of the T letter address followed by a four-digit value. The first two digits specify the tool turret position to be indexed. The last two digits specify the offset register number to be referenced when tool nose radius compensation is invoked.  For example, to index to tool station #3 and call offset #3, the program block would have to contain T0303. To cancel the tool you would use a reference to register 00 with the last two digits instead. This register is usually preset to a zero value and cannot be changed by the operator.  For example, T0300 would cancel register #3. This is usually done prior to a tool change

Page 78: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

Tool change function for turning Format: N_ T__ __

Page 79: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

ExamplesEXAMPLE 1: This program introduces you to the basic G- and M-codes. When executed, it turns the workpiece from an original diameter of 1.0 in.

Workpiece Size: 1" Diameter by 2" LengthTool: Tool #1, Right-hand Turning ToolTool Start Position: X2, Z3%:1001N5 G20 G40N10 T0101 M03N15 G00 X1 Z0.25 M08N20 G01 Z-0.75 F0.015N25 G00 X1.1N30 Z0.05N35 X0.9375N40 G01 Z-0.75 F0.012N45 G00 X1N50 Z0.05N55 X0.8745N60 G01 Z-0.75N65 G00 X0.5N70 Z0.05N75 X0.8125N80 G01 Z-0.375N85 G00 X1N90 Z0.05N95 X0.75N100 G01 Z-0.375N105 G00 X2 M09N110 Z2N115 T0100 M05N120 M30

Page 80: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

EXAMPLE 2:This program introduces you to the basic circular interpolation routines.

Workpiece Size: 2" Diameter by 4" LengthTool: Tool #1, Right-hand Turning ToolTool Start Position: X2, Z3%:1002

N5 G20 G40N10 T0101N15 M03N20 G00 X1.8 Z0.05N25 M08N30 G01 Z-2.5 F0.015N35 G00 X2N40 Z0.05

N45 X1.6N50 G01 Z-2N55 G00 X1.8N60 Z0.05N65 X1.4N70 G01 Z-1.5N75 X2 Z-3N80 G00 Z0.05N85 X1.2N90 G01 Z-0.5N95 G00 X1.4N100 Z0.05N105 X1N110 G01 Z-0.5N115 G03 X1.4 Z-0.7 I0 K-0.2N120 G00 Z-0.1

N125 X1

N135 G02 X0.8 Z0 I-0.1 K0

N140 G00 X2 Z2

N145 M09

N150 T0100 M05

N155 M30

Page 81: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

EXAMPLE 3:

This program introduces you to the G71 turning cycle and G70 finishing cycle commands.  Workpiece Size: 4" Diameter by 2" LengthTool: Tool #1, Right-hand Turning ToolTool Start Position: X2, Z3%:1003N5 G90 G20 G40N10 T0101N15 M03N20 G00 X2.1 Z0.05N25 G71 P30 Q50 U0.025 W0.005 D625 F0.012N30 G01 X1 Z0N35 G03 X1.5 Z-0.25 I0 K-0.25N40 G01 X1.75 Z-2N45 G03 X2 Z-2.125 I0 K-0.125N50 G01 X2.2N55 G70 P30 Q50 F0.006N60 G00 X2 Z2N65 T0100 M05N70 M30

Page 82: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

EXAMPLE 4This example demonstrates the G72 facing cycle and the G74 drilling cycle commands.

Workpiece Size: 2" Diameter by 3" LengthTool: Tool #2, Right-hand Turning ToolTool #3, 3/8" DrillTool Start Position: X2, Z3%:1004N5 G90 G20 G40N10 T0202N15 M03N20 M08N25 G00 X2 Z0.05N30 G72 P35 Q50 U0.05 W0.005 D500 F0.012N35 G01 X1 Z0.05N40 Z-1N45 X2 Z-1.5N50 X2.2N55 G70 P35 Q50 F0.006N60 T0200 G00 X4 Z3

N65 T0303

N70 G00 X0 Z0.1

N75 G74 Z-1 F0.05 D0 K0.125

N80 G00 X4 Z3 M09

N85 T0300 M05

N90 M30

Page 83: IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-12 CNC Turning Programming Industrial Engineering Department King Saud University

End of Part 12