You are on page 1of 22

CNC PROGRAMMING

Manual NC programming
Part program: A

computer program to specify

- Which tool should be loaded on the machine spindle;

- What are the cutting conditions (speed, feed, coolant


ON/OFF etc) - The start point and end point of a motion segment

- how to move the tool with respect to the machine.

The Aerospace Industries Association sponsored the work that led to the first part programming language, developed in MIT in 1955. This was called: Automatically Programmed Tools (APT). APT is an English like simple programming language which basically produce the Cutter Location (CL) data. Using the cutter location data, the program can generate the actual NC codes by using a postprocessor .

Two types of specifying tool position The programmer must determine the position of the tool relative to the origin. 1 FIXED ZERO The origin is always located at the same position on the machine table. Usually the position is the south west corner (lower left hand corner) of the table and all tool locations will be defined by positive x and y coordinates.

2.FLOATING ZERO
Modern N.C machine allows the machine operator to set zero point at any position on the machine table. The programmer is the one who decides where the zero point should be located. USEFUL FOR drilling holes, milling operations etc The programmer may have selected the target point as the zero point for tool positioning. If he presses the zero button , it tells the machine where the origin is located for susequent tool movements

The position of the tool is described by using a Cartesian coordinate system as (0,0,0).

In defining the motion of the tool from one point to another, either absolute positioning mode or incremental positioning mode can be used.

1. Absolute positioning. In this mode, the desired target position of the tool for a particular move is given relative to the origin point of the program.
2. Incremental positioning. In this mode, the next target position for the tool is given relative to the current tool position.

CUTTER COMPENSATION

CNC Programming Basics


CNC instructions are called part program commands. When running, a part program is interpreted one command line at a time until all lines are completed. Commands, which are also referred to as blocks, are made up of words which each begin with a letter address and end with a numerical value.

CNC Programming Basics


Each letter address relates to a specific machine function. G and M letter addresses are two of the most common. A G letter specifies certain machine preparations such as inch or metric modes, or absolutes versus incremental modes. A M letter specifies miscellaneous machine functions and work like on/off switches for coolant flow, tool changing, or spindle rotation. Other letter addresses are used to direct a wide variety of other machine commands.

CNC programming
Important things to know:

Coordinate System
Units, incremental or absolute positioning Coordinates: X,Y,Z, RX,RY,RZ Feed rate and spindle speed Coolant Control: On/Off, Flood, Mist Tool Control: Tool and tool parameters

1. Absolute positioning. In this mode, the desired target position of the tool for a particular move is given relative to the origin point of the program.
2. Incremental positioning. In this mode, the next target position for the tool is given relative to the current tool position.

13

G & M Codes
Example CNC Program
N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30

G-codes: Preparatory Functions involve actual tool moves. M-codes: Miscellaneous Functions involve actions necessary for machining (i.e. spindle on/off, coolant on/off).

14

G Codes
G00 Rapid traverse G01 Linear interpolation G02 Circular interpolation, CW G03 Circular interpolation, CCW G04 Dwell G08 Acceleration G09 Deceleration G17 X-Y Plane G18 Z-X Plane G19 Y-Z Plane G20 Inch Units (G70) G21 Metric Units (G71)

G40 Cutter compensation cancel G41 Cutter compensation left G42 Cutter compensationright G70 Inch format G71 Metric format G74 Full-circle programming off G75 Full-circle programming on G80 Fixed-cycle cancel G81-G89 Fixed cycles G90 Absolute dimensions G91 Incremental dimensions

15

M Codes
M00 M01 M02 M03 M04 M05 M06 M08 M09 M10 M11 M30 Program stop Optional program stop Program end Spindle on clockwise Spindle on counterclockwise Spindle stop Tool change Coolant on Coolant off Clamps on Clamps off Program stop, reset to start

16

N Codes
Gives an identifying number for each block of information. It is generally good practice to increment each block number by 5 or 10 to allow additional blocks to be inserted if future changes are required.

17

X,Y, and Z Codes


X, Y, and Z codes are used to specify the coordinate axis. Number following the code defines the coordinate at the end of the move relative to an incremental or absolute reference point.

18

I,J, and K Codes


I, J, and K codes are used to specify the coordinate axis when defining the center of a circle. Number following the code defines the respective coordinate for the center of the circle.

19

F,S, and T Codes


F-code: used to specify the feed rate S-code: used to specify the spindle speed T-code: used to specify the tool identification number associated with the tool to be used in subsequent operations.

20

CNC sequence
The RS274-D is a word address format

Each line of program == 1 block Each block is composed of several instructions, or (words)

Sequence and format of words:


N3 G2 X+1.4 Y+1.4 Z+1.4 I1.4 J1.4 K1.4 F3.2 S4 T4 M2 destination coordinates dist to center of circle tool

sequence no

preparatory function

feed rate spindle speed


Other function

Application of Some Codes G01 Linear Interpolation


Format: N_ G01 X_ Y_ Z_ F_ Linear Interpolation results in a straight line feed move. Unless tool compensation is used, the coordinates are associated with the centerline of the tool.
22

You might also like