174x Filetype PDF File size 0.48 MB Source: www.onboces.org
Chapter 3 Programming Concepts Chapter Objectives After studying this chapter, the student should have knowledge of the following: Format of a CNC program How to prepare to write CNC programs Types of tool motion Uses of canned cycles Tooling 35 36 chapter 3 Programming Concepts INTRODUCTION Before you can fully understand CNC, you must first understand how a manufacturing company processes a job that will be produced on a CNC machine. The following is an example of how a company may break down the CNC process. IMPORTANT FLOW OF CNC PROCESSING 1. Obtain or develop the part drawing. 2. Decide what machine will produce the part. 3. Decide on the machining sequence. 4. Choose the tooling required. 5. Do the required math calculations for the program coordinates. 6. Calculate the speeds and feeds required for the tooling and part material. 7. Write the NC program. 8. Prepare setup sheets and tool lists. 9. Send the program to the machine. 10. Verify the program. 11. Run the program if no changes are required. PREPARING A PROGRAM A program is a sequential list of machining instructions for the CNC ma- chine to execute. These instructions are CNC code that contains all the in- formation required to machine a part, as specified by the programmer. CNC code consists of blocks (also called lines), each of which contains an individual command for a movement or specific action. As with con- ventional machines, one movement is made before the next one. This is why CNC codes are listed sequentially in numbered blocks. The following is a sample CNC milling program. Note how each block is numbered and usually contains only one specific command. Note also that the blocks are numbered in increments of 5 (this is the software de- fault on startup). Each block contains specific information for the ma- chine to execute in sequence. Workpiece Size: X4, Y3, Z1 Tool: Tool #3, 3/8" Slot Drill Tool Start position: X0, Y0, Z1.0 % (Program Start Flag) :1002 (Program #1002) N5 G90 G20 G40 G17 (Block #5, Absolute in Inches) N10 M06 T3 (Tool Change to Tool #3) N15 M03 S1250 (Spindle on CW at 1250 RPM) N20 G00 X1.0 Y1.0 (Rapid over to X1.0, Y1.0) N25 Z0.1 (Rapid down to Z0.1) N30 G01 Z-0.125 F5 (Feed down to Z-0.125 at 5ipm) cnc codes 37 N35 X3.0 Y2.0 F10.0 (Feed diagonally to X3.0, Y2.0 at 10ipm) N40 G00 Z1.0 (Rapid up to Z1.0) N45 X0 Y0 (Rapid over to X0, Y0) N50 M05 (Spindle Off) N55 M30 (Program End) CNC CODES There are two major types of CNC codes, or letter addresses, in any pro- IMPORTANT gram. The major CNC codes are called G-codes and M-codes. G-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, roughing, and profiling cycles. M-codes are miscellaneous functions, which include actions necessary for machining but not those that are actual tool movements (for example, auxiliary functions). These include actions such as spindle on and off, tool changes, coolant on and off, program stops, and related functions. Other letter addresses are variables used in the G- and M-codes to make words. Most G-codes contain a variable, defined by the program- mer, for each specific function. Each designation used in CNC program- ming is called a letter address. The letters used for programming are as follows: N Block Number: Specifies the start of a block G Preparatory function, as previously explained X X Axis Coordinate Y Y Axis Coordinate Z Z Axis Coordinate I X Axis location of Arc center J Y Axis location of Arc center K Z Axis location of Arc center S Sets the spindle speed F Assigns a feedrate T Specifies tool to be used M Miscellaneous function, as previously explained U Incremental coordinate for X axis V Incremental coordinate for Y axis W Incremental coordinate for Z axis The process of writing CNC programs is primarily the same as going REMEMBER through the steps involved with conventional machining. First, you must decide which units will be used—metric or inch—and which coordinate system will be used—absolute or incremental. Next, a tool must be called up and the spindle turned on. Finally, the tool must move rapidly to a point close to the part to start the actual machining. 38 chapter 3 Programming Concepts These steps are identical in both conventional and CNC machining. The two methods differ only in that in CNC machining the steps are pro- grammed into each CNC file. Without adequate preparation, a beginner is virtually “doomed” from the start. To avoid this fate, remember that before you write your program you must develop a sequence of operations. Do all the necessary math cal- culations; then choose your tooling, units, and coordinate system. IMPORTANT THREE MAJOR PHASES OF A CNC PROGRAM The following shows the three major phases of a CNC program. % :1001 N5 G90 G20 N10 M06 T2 N15 M03 S1200 N20 G00 X1.00 Y1.00 N25 Z0.125 N30 G01 Z-0.125 F5.0 N35 G01 X2.0 Y2.0 N40 G00 Z1.0 N45 X0 Y0 N50 M05 N55 M30 1: PROGRAM SETUP The program setup contains all the instructions that prepare the REMEMBER machine for operation. The three phases of a CNC pro- % Program start flag gram are: :1001 Four-digit program number (1) Program setup N5 G90 G20 Use absolute units and inch programming (2) Material removal N10 M06 T2 Stop for tool change, use Tool #2 (3) System shutdown N15 M03 S1200 Turn the spindle on CW to 1200 rpm The program setup phase is virtually identical in every program. It always begins with the program start flag (% sign). Line 2 always has a program number (up to four digits, 0–9999; some controllers, however, may have five or six digits). The program number must be preceded by a “:” or an “O” (the letter O). Line 3 is the first that is actually numbered. Note how it begins with N5 (N for number, 5 for block number 5). You can use any numeric sequence incrementing upward. Throughout this manual we use increments of 5 in our examples. Incrementing in this way enables you to insert up to four new lines between lines when you are editing the program. Some pro- grammers use increments of 1 or 10. The software included with this work- book allows automatic numbering in increments specified by the user. Block 5 tells the controller that all distances (X, Y, and Z coordinates) are absolute, that is, measured from the origin. It also tells the controller that all coordinates are measured in inch units. The setup phase may also include commands such as coolant on, cut- ter compensation cancel, or stop for tool change. Note that different ma- chine tool manufacturers may have specific codes required for specific program setups.
no reviews yet
Please Login to review.