cnc programming. cnc (computer numerical control) is the general term used for a system which...

74
CNC Programming

Upload: roger-howard

Post on 23-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

CNC Programming

Page 2: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

CNC Programming

• CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions processed by a computer.

Page 3: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

CNC Manufacturing Process

Page 4: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

CNC Manufacturing Process

Page 5: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Example CNC Manufacturing Process

• A part program is written, using G and M codes. This describes the sequence of operations that the machine must perform in order to manufacture the component.

• The part program is loaded into the machines computer, called the controller. At this stage, the program can still be edited or simulated using the machine controller keypad/input device.

• The machine controller processes the part program and sends signals to the machine components directing the machine through the required sequence of operations necessary to manufacture the component.

Page 6: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Composition of a Part Program

• A Part Program is a list of coded instructions which describes how the design component, or part, will be manufactured. These coded instructions are called data – a series of letters and numbers.

• The part program can be further broken down into separate lines of data, each line describing a particular set of machining operations. These lines, which run in sequence, are called blocks.

Page 7: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Composition of a Part Program

• A block of data contains words, sometimes called codes. Each word refers to a specific cutting/movement command or machine function. The programming language recognized by the CNC, the machine controller, is an I.S.O. code, which includes the G and M code groups. Each program word is composed from a letter called the address, along with a number.

• E.g. NØ2Ø G91 G28 XØ YØ ZØ ; NØ3Ø M6 T1 ; NØ4Ø G43 H1 ; NØ5Ø M3 S3ØØØ

Page 8: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Composition of a Part Program

NØ8Ø GØ1 Z-Ø.5 F4Ø BLOCK EXAMPLE - NØ8Ø GØ1 Z-Ø.5 F4Ø ;

WORD EXAMPLE - GØ1

ADDRESS EXAMPLE - G

Page 9: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Main Program Structure

• The Main Program is the controlling program, i.e., the program first read, or accessed, when the entire part program sequence is run. This controlling program can then call a number of smaller programs into operation. These smaller programs, called Sub Programs, are generally used to perform repeat tasks, before returning control back to the main program.

Page 10: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

AddressesAddress Refers to

N refers to the block number.

G refers to the G code (Preparatory function).

X refers to the absolute/incremental distance travelled by the slide tool in the X axis direction.

Y refers to the absolute/incremental distance travelled by the slide tool in the Y axis direction.

Z refers to the absolute/incremental distance travelled by the slide tool in the Z axis direction.

F refers to the feed rate.

M refers to the M code (Miscellaneous function).

S refers to the spindle speed.

T refers to the tooling management.Each

Page 11: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Addresses

• Each block, or program line, contain addresses which appear in this order :

N , G , X , Y , Z , F , M , S , T ;

• This order should be maintained throughout every block in the program, although individual blocks may not necessarily contain all these addresses.

Page 12: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Main Program Structure

Page 13: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Sub Program Structure

Page 14: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Sub Program Commands• A sub program must be saved to memory using a four digit number.

• To call a sub program the M98 code is used followed by PØØØØ (the number of the sub program required).For example,M98 P2ØØØThis command is read call program number 2ØØØ.

• A sub program call command (M98 PØØØØ) can be specified along with a move command in the same block.For example,GØ1 X42.5 M98 P1ØØØ;

Page 15: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Sub Program Commands• At the end of a sub program, the M99 code is entered. This returns

control to the main program. The M99 code will return control to the next block after the M98 sub program call block in the main program.

• If the code M99 PØØØØ is entered, control will pass to the main program at a block with the N number equal to that of the P number stated after the M99 code.

• For example, M99 PØ16Ø• This command is read return to the main program at block

number NØ16Ø.

Page 16: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Sub Program Repeat Command

• A call command can be set to call a sub program repeatedly. This call can specify upto 999 repetitions of a sub program.

M98 PØØØ ØØØØ

• For example,• M98 P1ØØØØ1• This command is read call the sub program number ØØØ1 ten

times.

Call Command Number of times

the subprogram is to be repeated

Sub Program Number

Page 17: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Program Block Numbering

• It is recommended that all blocks are numbered using a four digit number which rises between each block in steps of 1Ø. This allows the program to be edited at a later date, i.e, new blocks can be inserted or deleted as required.

• For example : N ØØ1Ø ....

N ØØ2Ø ....N ØØ3Ø ....N ØØ4Ø ....etc....

Page 18: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Block Configuration

Page 19: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

G Codes (Preparatory Functions)

• Preparatory functions, called G codes, are used to determine the geometry of tool movements and operating state of the machine controller; functions such as linear cutting movements, drilling operations and specifying the units of measurement.

• A G code is defined using the G address letter and a two digit number as follows:

G ØØ

AddressTwo Digit Number

Page 20: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Tool Movement

• A) Tool Movement along a Straight Line:

Program command format:GØ1 Y _ _ _ _ ; (P1 - P2)X _ _ _ _ Y _ _ _ _ ; (P2 - P3)X _ _ _ _ ; (P3 - P4)

Page 21: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Tool Movement

• B) Tool Movement along an Arc:

Program command format:GØ3 X _ _ _ _ Y _ _ _ _ R _ _ _ _ ; (P1 - P2)

The function of moving the tool along straight lines and arcs is called the Interpolation. Symbols of the programmed commands GØ1, GØ2 and GØ3 are called the Preparatory functions and specify the type of interpolation conducted in the control unit.

Page 22: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Feed Function

• The movement of the tool at a specified speed for cutting is called the Feed rate.

• The feed rate is defined using the F address letter followed by a numerical value.

• Using the G2Ø code, the feed rate is defined in Inches per minute.

• Using the G21 code, the feed rate is defined in Millimeters per minute.

Page 23: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M Codes (Miscellaneous Functions)

• Miscellaneous functions, called M codes, are used by the CNC to command on/off signals to the machine functions. i.e, MØ3 - spindle forward (CW), MØ5 – spindle stop, etc.....

• An M code is defined using the M address letter and a two digit number as follows:

M ØØ

AddressTwo Digit Number

Page 24: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Spindle Speed Function (Cutting Speed)

• The rotational speed of the tool, with respect to the work piece being cut, is called the spindle (or cutting) speed.

• The spindle speed is defined using the S address letter, followed by a numerical value, signifying the spindle RPM (revolutions per minute).

Page 25: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Tool Function• Tool profiles can be changed during a program using the tool function

command. Each tool profile is assigned a number, which in the case of an ATC (Automatic Tool Changer) will also coincide with one of the free bays on its carousel magazine.

• The tool number is defined using the address letter T, followed by a number assigned to the tool profile. To command a tool change, the MØ6 code would precede the number of the "new" tool required.

• For example,MØ6 TØ1This command is read perform a tool change to tool number Ø1.

Page 26: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Coordinates System

• Absolute Coordinates:The addresses X, Y and Z within a program, when G90 (Absolute co-ordinates) is active, relate to a coordinate position from the work piece datum (the zero position).

Page 27: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Coordinates System(Cont’d)

• Example :

Page 28: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Coordinates System(Cont’d)

• Incremental Coordinates:The addresses X, Y and Z within a program, when G91 (Incremental co-ordinates) is active, relate to the individual axis movements required to reach the new position, from the last position reached by the tool.

Page 29: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Coordinates System(Cont’d)

• Example :

Page 30: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Exercise

Page 31: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Answer

Page 32: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

G CodesPreparatory

Functions

Page 33: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Introduction

• Preparatory functions, called G codes, are used to determine the geometry of tool movements and operating state of the machine controller; functions such as linear cutting movements, drilling operations and specifying the units of measurement.

• A G code is defined using the G address letter and a two digit number as follows:

G ØØ

AddressTwo Digit Number

Page 34: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Modal and Non-Modal G Codes

• Modal (Retained) G Codes:– A modal G code will remain active until another

G code from the same group is programmed into a block, or it is cancelled.

– For Example:• GØ1 and GØØ are modal G codes from group 1:– GØ1 X _ _ _ _ ;– Y _ _ _ _ ;– X _ _ _ _ ;– GØØZ _ _ _ _ ;

GØ1 is effective in this range.

GØØ replaces the GØ1 command.

Page 35: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Modal and Non-Modal G Codes (Cont’d)

• Non-modal (one-shot) G codes:

– A non-modal G code must be programmed into block when it is required, i.e, it is only effective in the block in which it is specified.

– Example:• G09 , Exact Stop Check

Page 36: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØØ Rapid Positioning / Traverse

• The GØØ code executes a non cutting movement, at a rapid feed rate, to a specific co-ordinate position in the working area (operating under absolute coordinate movement) or when a certain distance from a previously stated position (under incremental coordinate movement) is programmed.

• A GØØ command is written in the following format:

GØØ X _ _ _ _ Y_ _ _ _ Z _ _ _ _ ;

Rapid Positioning / Traverse Code

X, Y and Z Coordinate Values

Page 37: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ1 Liner Interpolation

• The GØ1 code executes a cutting movement following a straight line, at a set feed rate.

GØ1 X _ _ _ _ Y_ _ _ _ Z _ _ _ _ ;

Liner Interpolation Code

X, Y and Z Coordinate Values

Page 38: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ2 , GØ3 Circular Interpolation

• The GØ2 code executes a cutting movement following a clockwise circular path, at a set feed rate.

• The GØ3 code executes a cutting movement following a counterclockwise circular path, at a set feed rate.

• The definitions of clockwise (GØ2) and counterclockwise (GØ3) are fixed according to the system of co-ordinates in the diagram below.

Page 39: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ2 , GØ3 Circular Interpolation (Cont’d)

• When programming arcs using absolute values (G9Ø), the X and Y values describe the end point of the arc, in relation to the datum position of the work piece. The arc end point is sometimes referred to as the target position.

• When programming arcs using incremental values (G91), the X and Y values relate to the distance moved along the X and Y axes, from the start point of the arc to the end point of the arc. The sign of the X and Y axis moves (+/-) will depend on the movement of the machine slides in relation to their start position.

Page 40: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ2 , GØ3 Circular Interpolation (Cont’d)

I and J

To program an arc when only the arc centre is given (the radius is unknown) use the address letters I and J.

I relates to the address X and is the incremental value and direction (+/-) from the start point of the arc in the X axis to the arc centre .

J relates to the address Y and is the incremental value and direction (+/-) from the start point of the arc in the Y axis to the arc centre .

Page 41: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ2 , GØ3 Circular Interpolation (Cont’d)

• The format to program a circular interpolation in Cartesian co-ordinates is written as follows :

• There are four ways to program a clockwise circular path using the GØ2 code:

G9Ø GØ2 X _ _ _ _ Y _ _ _ _ R _ _ _ F _ _ _ ;G9Ø GØ2 X _ _ _ _ Y _ _ _ _ I _ _ _ J _ _ _ F _ _ _ ;G91 GØ2 X _ _ _ _ Y _ _ _ _ R _ _ _ _ F _ _ _ _ ;G91 GØ2 X _ _ _ _ Y _ _ _ _ I _ _ _ J _ _ _ F _ _ _ ;

Page 42: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ2 , GØ3 Circular Interpolation (Cont’d)

• Example:

Page 43: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ2 , GØ3 Circular Interpolation (Cont’d)

• Absolute Mode:

GØ1 X1ØØ Y4Ø F125 ;GØ3 X8Ø Y6Ø I-2Ø ;GØ1 X6Ø ;GØ2 X4Ø Y4Ø I-2Ø ;

or,

GØ1 X1ØØ Y4Ø F125 ;GØ3 X8Ø Y6Ø R2Ø ;GØ1 X6Ø ;GØ2 X4Ø Y4Ø R2Ø ;

Page 44: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ2 , GØ3 Circular Interpolation (Cont’d)

• Incremental Mode:

GØ3 X-2Ø Y2Ø I-2Ø ;GØ1 X-2Ø ;GØ2 X-2Ø Y-2Ø I-2Ø ;

or,

GØ3 X-2Ø Y2Ø R2Ø ;GØ1 X-2Ø ;GØ2 X-2Ø Y-2Ø R2Ø ;

Page 45: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ2 , GØ3 Circular Interpolation (Cont’d)

• When using the address R _ _ _ _ , two types of arcs can be considered. One arc is less than 18Ø degrees, whilst the other arc is greater than 18Ø degrees. When an arc exceeding 18Ø degrees is commanded, the radius value (R _ _ _ _) must be specified as a negative signed (-) value.

Page 46: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ2 , GØ3 Circular Interpolation (Cont’d)

• Example:• The above tool path for an arc less

than 18Ø degrees (circle A) can be programmed as follows (In absolute mode, G9Ø):

• GØ2 X8Ø Y4Ø R5Ø F125 ;

• The above tool path for an arc greater than 18Ø

• degrees (circle B) can be programmed as follows (In absolute mode, G9Ø):

• GØ2 X8Ø Y4Ø R-5Ø F125 ;

Page 47: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Exercise

Page 48: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions
Page 49: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions
Page 50: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

GØ4 Dwell

• The G04 command is a Dwell command that halts all axis

movement for a specified time, while the spindle

continuous revolving at the specified rpm.

• A Dwell is used largely in drilling operations, which allows

for the clearance of chips

• This command requires a specified duration, denoted by

the letter P, and followed by the time in seconds• Example

N30 G04 P2(Dwell for 2 seconds)

Page 51: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Machine Tool Planes• A typical CNC machining center has three axes. Any two axes form a plane. A

machine plane may be defined by looking at the machine from standard operating position.

• For a vertical machining center, there are three standard views.

The top view (XY Plane) is selected by G17.

The front view (XZ plane) is selected by G18.

The right side vide (YZ plane) is selected by G19.

Page 52: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Machine Tool Planes (Cont’d)• For machining applications using the circular interpolation mode, with G02

or G03 commands, cutter radius offset with G41 or G42 commands and fixed cycles mode with G81 to G89 commands. The plane selection is very critical.

• For all rapid motions (programmed with G00) and all linear motions (programmed with G01), the plane selection command is not needed.

• Any plane selection change is programmed as desired, prior to actual tool path change. Plane can be changed as often as necessary in a program, but only one plane can be active at any time.

• Selection of one plane cancels any other plane, so the G17/G18/G19 commands cancel each other.

Page 53: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

G17 XY Plane• G17 commands sets the system to default to the XY plane as the main

machining plane for specifying circular interpolation moves and/or cutter compensation.

• Here the Z-axis is secondary and works perpendicular to the XY plane

N_ G17

Page 54: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

G18 XZ Plane• G18 command sets the system to the XZ plane as the main machining plane

for specifying circular interpolation moves and/or cutter compensation.

• This command changes the default machining plane to the XZ plane, where the Y axis is secondary, and works perpendicular to the XZ plane.

• In this plane, it is possible to cut convex and concave arcs using G02 and G03 circular interpolation commands.

N_ G18

Page 55: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

G19 YZ Plane• G19 command sets the system to the YZ plane as the main machining plane

for specifying circular interpolation moves and/or cutter compensation.

• This command changes the default machining plane to the YZ plane, where the X axis is secondary, and works perpendicular to the YZ plane.

• In this plane, it is possible to cut convex and concave arcs using G02 and G03 circular interpolation commands.

N_ G19

Page 56: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

G 2Ø, G 21 Imperial / Metric Data Input

• The machine controller can be programmed in either Imperial (inch) unit input (G2Ø) or Metric (millimetre) unit input (G21). The standard format for a CNC part program is to write the G2Ø or G21 code in the first block of the program.

G Code Type Units Lowest input Value

G2Ø Imperial Inch Ø.ØØØ1 inch

G21 Metric Millimetre Ø.ØØ1 mm

Page 57: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

G28Reference Point Return

• The reference point is a fixed position on the machine, to which the tool can be moved.

• This point is also used as the Home position, the point used by the machine to set the limits of movement for the X, Y and Z slides.

• A G28 code instructs the tool to automatically move to this reference point.

• A G28 command is written in the following format :– G9Ø G28 X _ _ _ _ Y _ _ _ _ Z _ _ _ _ ;– G91 G28 X _ _ _ _ Y _ _ _ _ Z _ _ _ _ ;

• where X, Y and Z can be used to indicate an intermediate point, through which the tool will pass, before continuing to the reference point.

Page 58: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

G28Reference Point Return (Cont’d)

The above tool path can be programmed as follows (Inabsolute mode, G9Ø):

G9Ø G28 X6Ø Z6Ø ;

The above tool path can be programmed as follows (Inincremental mode, G91):

G91 G28 XØ Z4Ø ;

Page 59: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

G28Reference Point Return (Cont’d)

• In the diagram below, the tool is in a position (P1) where no collision is possible. The intermediate point, in this case, is not required, so the block can be written as follows (In incremental mode, G91):

– G91 G28 XØ YØ ZØ ;

• The intermediate point co-ordinates are still stated, but all their values are set to zero, indicating no axis movement. Therefore, the tool will move from point P1 to the reference point, P3, along a non-vector type path.

Page 60: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M-Codes

Page 61: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M - Codes

• M-codes are miscellaneous functions that include actions necessary for machining but not those that are actual tool movements. That is, they are auxiliary functions

• Only one M code may be programmed per block of a program. All M codes are effective or cause an action to occur at the end of the block.

Page 62: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M00 Program Stop

• The M00 code is used to stop a program. It also stops the spindle and turns off the coolant and stops interpretation look ahead processing. The program pointer will advance to the next block and stop.

• A cycle start will continue program operation from the next block.

N_ M00

Page 63: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M03 Spindle On ClockwiseN_ M03

• The M03 code will start the spindle moving is a clockwise direction at whatever speed was previously set.

M04 Spindle On CounterclockwiseN_ M04

• The M04 code will start the spindle moving is a counterclockwise direction at whatever speed was previously set.

Page 64: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M05 Spindle Stop

N_ M05

• The M05 command turns the spindle off. Although other M-cods turn off all functions (for example, M00 and M01), this command is dedicated to shutting the spindle off directly.

• The M05 command appears at the end of a program.

Example%:1010N5 G90 G20N10 M06 T12……………………………………………….N65 M05 (Spindle stop)

Page 65: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M06 Tool Change

N_ M06 T_

• The M06 code is used to initiate a tool change. The previously selected tool (T_) is put into the spindle. If the spindle was running, it will be stopped.

• The Z-axis will automatically move up to the machine zero position and the selected tool will be put into the spindle. The Z-axis is left at machine zero.

• The T_ must be in the same block or in a previous block. The coolant pump will be turned off during a tool change.

Example%:1010N5 G90 G20N10 M06 T12 (Tool change to tool #12)……………………………………………….N65 M05

Page 66: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M07/M08 Coolant OnN_ M07 N_ M08OR

• The M07 and M08 commands switch on the coolant flow.

M09 Coolant OffN_ M09

• The M09 command shuts off the coolant flow. The coolant should be shut off prior to tool changes or when you are rapiding the tool over long distances.

Page 67: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M30 Program End , Reset to StartN_ M30

• The M30 code is used to stop a program. It also stops the spindle and turns off the coolant. The program pointer will be reset to the first block of the program and stop.

Example%:1012N5 G90 G20………………………….N65 X0 Y0N85 M05N90 M30 (program end; reset to start)

Page 68: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

M98 Call Subprogram

N_ M98 P_

• The M98 function is used to call a subroutine or subprogram. Execution is halted in the main program and started on the program referenced by The letter P_ address value.

• For example,N15 M98 P1003 would call program:1003

M99 Return from Subprogram

N_ M99

• The M99 function is used to end or terminate the subprogram and return to the main calling program.

• Execution is continued at the line immediately following the subprogram call. It is used only at the end of the subprogram.

Page 69: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Block Slip/ N_

• If turned on, upon execution of a CNC program and encountering a block skip “/”, the program will ignore and CNC code on that block.

Example%:1012N5 G90 G20/N10 M06 T03/N20 G00 X0 Y0……………………………………..N85 M05N90 M30

Page 70: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

CommentsN_ (Comment statement)

• Comments help the CNC machine operator to set up and run a job. • Comments are defined by the use of round brackets. Anything between

them is ignored by the controller.• Remember that comments are just aids to help in reading and

understanding a program. Their text is totally ignored even it contains valid CNC code.

ExampleN 10 G00 Z0.5 (Rapid to Z0.5)

Page 71: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

Example

Page 72: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

% (program start flag):1087 (program number)N5 G90 G20 G40 (Absolute, Inches, and compensation canceled)N10 M06 T04 (Tool change to toll #4)N15 M03 S2000 (Spindle on clockwise at 2000 rpm)N20 G00 X2 Y-0.375 M08 (Rapid to X2, Y-0.375), coolant 2 on)N25 Z-0.25 (Rapid down to Z-0.25)N30 G01 Y0 F15 (Feed move to point #1 at 15 ipm)N35 X0.5 Y0.5 (Feed move to point #2)N40 Y3.0 (Feed move to point #3)N45 G02 X2 I0.75 J0 (Circular feed move to point #4)N50 G01 X3.5 (Feed move to point #5)N55 G01 Y0.5 (Feed move to point #6)N60 G02 X3 Y0 I-0.5 J0 (Circular feed move to point #7)N65 G01 X2 (Feed move to point #1)N70 G00 Z1 (Rapid to Z1)N75 X0 M09 (Rapid to X0, coolant off)N80 M05 (Spindle off)N85 M30 (End of program)

Page 73: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions

i. Incremental and Radiusii. Absolute and I,j

Page 74: CNC Programming. CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions