98
Denford Limited Birds Royd Brighouse West Yorkshire England HD6 1NB Tel: +44 (0) 1484 712264 Fax: +44 (0) 1484 722160 Email: [email protected] G and M Programming for CNC Milling Machines COMPUTERISED MACHINES AND SYSTEMS

G and M Programming for Mills Manual

  • Upload
    harshit

  • View
    27

  • Download
    3

Embed Size (px)

DESCRIPTION

CNC booklet- ISO standardsCNC (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.A Part Program is a list of coded instructions which describes how the designed component, or part, will be manufactured.These coded instructions are called data -a series of letters and numbers. The part pro- gram includes all the geometrical and technological data to perform the required machine functions and movements to manufacture the part.The part program can be further broken down into separate lines of data, each line de- scribing a particular set of machining operations. These lines, which run in sequence, are called blocks.A block of data contains words, sometimes called codes. Each word refers to a specific cutting/movement command or machine function. The programming language recognised 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.

Citation preview

Page 1: G and M Programming for Mills Manual

G AND M PROGRAMMING FOR CNC MILLING MACHINES - 1

Denford LimitedBirds RoydBrighouseWest YorkshireEnglandHD6 1NBTel: +44 (0) 1484 712264Fax: +44 (0) 1484 722160Email: [email protected]

G and MProgrammingfor CNCMilling Machines

COMPUTERISED MACHINES AND SYSTEMS

Notes
This file is the Adobe Acrobat version of the Denford G and M Programming for CNC Milling Machines manual. File Optimisation: On-screen display and printing. Graphics: resampled to 600 dpi. Language: European English. Paper size: A4 (210mm x 297mm). Denford Customer Services. Tel: +44 (0) 1484 722733 e-mail: customer_services @denford.co.uk
Page 2: G and M Programming for Mills Manual

2 - G AND M PROGRAMMING FOR CNC MILLING MACHINES

NOTES.

Page 3: G and M Programming for Mills Manual

G AND M PROGRAMMING FOR CNC MILLING MACHINES - 3

Table of Contents

Introduction..................................................6What is CNC? ...............................................7

CONTENTS. TITLE PAGE NO.

BASIC PROGRAMMING.Composition of a Part Program........................9Main Program Structure .................................10Sub Program Structure ..................................12Sub Program Commands - General Notes .........13Sub Program Repeat Command .......................14Billet Definition .............................................15Program Numbering and Saving ......................16Program Block Numbering ..............................17Block Configuration .......................................18G Codes (Preparatory Functions) .....................18Tool Movement .............................................19Feed Function ...............................................21M Codes (Miscellaneous Functions) .................21Spindle Speed Function (Cutting Speed) ...........22Tool Function ................................................23Tool Compensation (Tool Offset) ......................24Absolute and Incremental Co-ordinates ............25Optional Block Skip .......................................26Tutorials and Comments .................................26

Page 4: G and M Programming for Mills Manual

4 - G AND M PROGRAMMING FOR CNC MILLING MACHINES

CONTENTS. TITLE PAGE NO.

G CODES - PREPARATORY FUNCTIONS.G Codes - Introduction ...................................27List of G Codes supported byDenford CNC Controls ...................................29Gÿÿ (Rapid Positioning/Traverse) .....................30Gÿ1 (Linear Interpolation) ..............................32Gÿ2 & Gÿ3 (Circular Interpolation) .................34Gÿ4 (Dwell) .................................................40G2ÿ & G21 (Imperial /Metric Data Input) ..........41G28 (Reference Point Return) .........................42G4ÿ, G41 & G42 (Cutter Compensation) ..........45G73-G89 (Canned Cycles) ..............................49G73 (High SpeedPeck Drilling) ........................54G74 (Counter Tapping) ...................................55G76 (Fine Boring) ..........................................56G8ÿ (Canned Cycle, Cancel) ...........................57G81 (Drilling - Spot Boring) .............................58G82 (Drilling - Counter Boring) ........................59G83 (Deep Hole Peck Drilling) .........................60G84 (Tapping) ...............................................61G85 (Boring) .................................................62G86 (Boring) .................................................63G87 (Back Boring) .........................................64G89 (Boring) .................................................65G Codes - Program Example Using Canned Cycles ...66G9ÿ (Absolute Zero Command) ......................67G91 (Incremental Command) ..........................67G94 (Feed per Minute) ...................................67G95 (Feed per Revolution) ..............................68G98 (Return to Initial Level) ............................68G99 (Return to R Point Level) ..........................68G17ÿ-G173 (Circular/Rectangular Pocket) ........69G17ÿ & G171 (Circular Pocket Example A) .......70G17ÿ & G171 (Circular Pocket Example B) .......72G17ÿ & G171 (Circular Pocket Example C) .......74G172 & G173 (Rectangular Pocket Example A) ...76G172 & G173 (Rectangular Pocket Example B) ...79G172 & G173 (Rectangular Pocket Example C) ...81

Page 5: G and M Programming for Mills Manual

G AND M PROGRAMMING FOR CNC MILLING MACHINES - 5

CONTENTS. TITLE PAGE NO.

M CODES - MISCELLANEOUS FUNCTIONS.M Codes - Introduction...................................83List of M Codes Supported byDenford CNC Controls ...................................84Mÿÿ (Program Stop) .....................................86Mÿ1 (Optional Stop) ......................................86Mÿ2 (Program Reset) ....................................86Mÿ3 (Spindle Forward) ..................................87Mÿ4 (Spindle Reverse) ...................................87Mÿ5 (Spindle Stop) .......................................87Mÿ6 (Automatic Tool Change) ........................88Mÿ8 (Coolant On) .........................................88Mÿ9 (Coolant Off) .........................................88M1ÿ (Vice Open) ..........................................89M11 (Vice Close) ...........................................89M13 (Spindle Forward and Coolant On) ............89M14 (Spindle Reverse and Coolant On) .............90M2ÿ (ATC Arm In) .........................................90M19 (Spindle Orientation) ..............................90M21 (ATC Arm Out) .......................................91M22 (ATC Arm Down) ....................................91M23 (ATC Arm Up) ........................................91M24 (ATC Drawbar Unclamp) .........................92M27 (Reset Carousel to Pocket One) ................92M25 (ATC Drawbar Clamp) .............................92M3ÿ (Program Reset and Rewind) ...................93M32 (Carousel CW) .......................................93M33 (Carousel CCW) .....................................93M38 (Door Open) ..........................................94M39 (Door Close) ..........................................94M62, M63, M64, M65, M66, M67,M76 & M77 (Auxiliary Output Functions) .........95M7ÿ (Mirror in X On) .....................................96M71 (Mirror in Y On)......................................96M8ÿ (Mirror in X Off) ....................................96M81 (Mirror in Y Off) .....................................97M98 (Sub Program Call) .................................97M99 (Sub Program End and Return) .................97

Page 6: G and M Programming for Mills Manual

6 - G AND M PROGRAMMING FOR CNC MILLING MACHINES

INTRODUCTION. The Denford CNC (Computer Numerical Control) unitfitted to Denfords range of machine tools is a FANUCcompatible system which uses ISO code format.

This manual covers the stages involved in producingthe coded instructions, used by the CNC unit to makethe component. These coded instructions are calledthe part program.

Each part program contains a number of different codes,the most important being the collection of G and Mcodes. Essentially, these form the basic language usedto describe how a component will be manufactured,the order in which to carry out machining tasks, whento change tools, how far to cut into the material etc.....

The front sections of this manual cover the basics ofpart programming, including guidelines for generallayout and commands. Each section buildsprogressively, using plain, easy to follow text, to coverthe most common aspects of programming. At the endof this stage, the operator should be confident enoughto tackle basic part programming.

Naturally, this manual cannot "teach" the operatoreverything there is to know about programming. Thesubject is simply too vast to include it all. The contentof this manual does, however, form a good basis fromwhich to start learning and hopefully inspiresconfidence in using more technically structureddocuments.

The G Codes and M Codes sections containinformation which are more specific to certaincommands and functions - these sections are intendedmore as a reference guide, once the operator isconfident with the basics of programming.

Page 7: G and M Programming for Mills Manual

G AND M PROGRAMMING FOR CNC MILLING MACHINES - 7

CNC (Computer Numerical Control) is the general termused for a system which controls the functions of amachine tool using coded instructions processed by acomputer.

EXAMPLE CNC MANUFACTURING PROCESS.

The diagram on page 8 shows the main stages involvedin producing a component on a CNC system.

1) A part program is written, using G and M codes.This describes the sequence of operations that themachine must perform in order to manufacture thecomponent.

This program can be produced off-line, ie, away fromthe machine, either manually or with the aid of a CAD/CAM system.

2) The part program is loaded into the machinescomputer, called the controller. At this stage, theprogram can still be edited or simulated using themachine controller keypad/input device.

3) The machine controller processes the part programand sends signals to the machine componentsdirecting the machine through the required sequenceof operations necessary to manufacture thecomponent.

The application of CNC to a manual machine allows itsoperation to become fully automated.

Combining this with the use of a part programenhances the ability of the machine to perform repeattasks with high degrees of accuracy.

WHAT IS CNC?

Page 8: G and M Programming for Mills Manual

8 - G AND M PROGRAMMING FOR CNC MILLING MACHINES

COMPUTER

PROGRAMMING

(CAD/CAM).

G & MCODES.

MACHINE ELECTRICAL CONTROL UNIT.

DENFORD CNC MILLING MACHINE.

DIAGRAM - EXAMPLE CNC MANUFACTURING PROCESS.

HUMAN

PROGRAMMING

(MDI - MANUAL DATA INPUT).

CONTROL

SIGNALS.

MACHINE CONTROL KEYPAD.

Page 9: G and M Programming for Mills Manual

BASIC PROGRAMMING - 9

COMPOSITIONOF A PARTPROGRAM.

A Part Program is a list of coded instructionswhich describes how the designed component,or part, will be manufactured.

These coded instructions are called data - aseries of letters and numbers. The part pro-gram includes all the geometrical and tech-nological data to perform the required machinefunctions and movements to manufacturethe part.

The part program can be further broken downinto separate lines of data, each line de-scribing a particular set of machining opera-tions. These lines, which run in sequence, arecalled blocks.

A block of data contains words, sometimescalled codes. Each word refers to a specificcutting/movement command or machine func-tion. The programming language recog-nised by the CNC, the machine controller,is an I.S.O. code, which includes the G and Mcode groups.

Each program word is composed from a let-ter, called the address, along with a number.

PART PROGRAM EXAMPLE -

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

WORD EXAMPLE - Gÿ1

ADDRESS EXAMPLE - G

(Mill CAM Designer

- star.MCD)

(2/1ÿ/1997)

(Triac PC (metric))

(Post fanucm:1.2ÿ

24 June 1994)

Oÿÿ5ÿ ;

Nÿ1ÿ G21 ;

[BILLET X24ÿ Y17ÿ Z1ÿ

[EDGEMOVE Xÿ Yÿ

[TOOLDEF T1 D2

Nÿ2ÿ G91 G28 Xÿ Yÿ Zÿ ;

Nÿ3ÿ M6 T1 ;

Nÿ4ÿ G43 H1 ;

Nÿ5ÿ M3 S3ÿÿÿ ;

Nÿ6ÿ G9ÿ Gÿÿ X9ÿ Y12ÿ ;

Nÿ7ÿ Z2 ;

Nÿ8ÿ Gÿ1 Z-ÿ.5 F4ÿ ;

Nÿ9ÿ X1ÿ5 Y16ÿ F6ÿ ;

N1ÿÿ X12ÿ Y12ÿ ;

N11ÿ X165 ;

N12ÿ X13ÿ Y95 ;

N13ÿ X145 Y5ÿ ;

N14ÿ X1ÿ5 Y8ÿ ;

N15ÿ X65 Y5ÿ ;

N16ÿ X8ÿ Y95 ;

N17ÿ X45 Y12ÿ ;

N18ÿ X9ÿ ;

N19ÿ Gÿÿ Z2 ;

N2ÿÿ M5 ;

N21ÿ G91 G28 Xÿ Yÿ Zÿ ;

N22ÿ M3ÿ ;

Page 10: G and M Programming for Mills Manual

10 - BASIC PROGRAMMING

MAIN PROGRAM

STRUCTURE.The part program can contain a number of separateprograms, which together describe all the operationsrequired to manufacture the part.

The Main Program is the controlling program, ie, theprogram first read, or accessed, when the entire partprogram sequence is run. This controlling program canthen call a number of smaller programs into operation.These smaller programs, called Sub Programs, aregenerally used to perform repeat tasks, beforereturning control back to the main program.

Normally, the controller operates according to oneprogram. In this case the main program is also the partprogram.

Main Programs are written using I.S.O. address codeslisted below.

ADDRESSES -N refers to the block number.

G refers to the G code (Preparatory function).

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

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

Z refers to the absolute/incremental distancetravelled 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 block, or program line, contains addresses whichappear in this order :

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

This order should be maintained throughout every blockin the program, although individual blocks may notnecessarily contain all these addresses.

Page 11: G and M Programming for Mills Manual

BASIC PROGRAMMING - 11

MAIN PROGRAM

STRUCTURE.The organisation of blocks of data within the programfollows a layout. Again, it is recommended that theprogrammer keeps to this program layout.

Program number.

CAD/CAM softwarepackage information.

Units definition(Metric or Imperial)and billet size forsimulation.

Main programinformation.

Program end.

The above listing shows an example program usingthe Denford programming system.

For the program to operate correctly on a genuineFANUC control, the CAD/CAM software informationand billet size definitions must be removed from thelisting.

The main program can be generatedusing Denfords MillCAM DesignerCAD/CAM software package, savedonto disk and transferred to theCNC.

Alternatively, the main program canbe manually entered into the CNCmemory when the controller is setin Edit Mode.

Machine Simulation of G and M codeprogram.

(Mill CAM Designer- star.MCD)(2/1ÿ/1997)(Triac PC (metric))(Post fanucm:1.2ÿ24 June 1994)Oÿÿ5ÿ ;Nÿ1ÿ G21 ;[BILLET X24ÿ Y17ÿ Z1ÿ[EDGEMOVE Xÿ Yÿ[TOOLDEF T1 D2Nÿ2ÿ G91 G28 Xÿ Yÿ Zÿ ;Nÿ3ÿ M6 T1 ;Nÿ4ÿ G43 H1 ;Nÿ5ÿ M3 S3ÿÿÿ ;Nÿ6ÿ G9ÿ Gÿÿ X9ÿ Y12ÿ ;Nÿ7ÿ Z2 ;Nÿ8ÿ Gÿ1 Z-ÿ.5 F4ÿ ;Nÿ9ÿ X1ÿ5 Y16ÿ F6ÿ ;N1ÿÿ X12ÿ Y12ÿ ;N11ÿ X165 ;N12ÿ X13ÿ Y95 ;N13ÿ X145 Y5ÿ ;N14ÿ X1ÿ5 Y8ÿ ;N15ÿ X65 Y5ÿ ;N16ÿ X8ÿ Y95 ;N17ÿ X45 Y12ÿ ;N18ÿ X9ÿ ;N19ÿ Gÿÿ Z2 ;N2ÿÿ M5 ;N21ÿ G91 G28 Xÿ Yÿ Zÿ ;N22ÿ M3ÿ ;

Page 12: G and M Programming for Mills Manual

12 - BASIC PROGRAMMING

SUB PROGRAM

STRUCTURE.

Main Program.

Oÿÿÿ1

Nÿÿ1ÿ G21;

[BILLET X.... Y.... Z....

Nÿÿ2ÿ ...... ;

Nÿÿ3ÿ ...... ;

Nÿÿ4ÿ ...... ;

Nÿÿ5ÿ ...... ;

Nÿÿ6ÿ ...... ;

Nÿÿ7ÿ ...... ;

Nÿÿ8ÿ M98 P1ÿÿÿ;

Nÿÿ9ÿ ...... ;

Nÿ1ÿÿ ...... ;

Nÿ11ÿ ...... ;

Nÿ12ÿ ...... ;

Nÿ13ÿ ...... ;

Nÿ14ÿ ...... ;

Nÿ15ÿ M3ÿ;

Sub Program - 1.

O1ÿÿÿ

Nÿÿ1ÿ ...... ;

Nÿÿ2ÿ ...... ;

Nÿÿ3ÿ ...... ;

Nÿÿ4ÿ ...... ;

Nÿÿ5ÿ ...... ;

Nÿÿ6ÿ ...... ;

Nÿÿ7ÿ ...... ;

Nÿÿ8ÿ ...... ;

Nÿÿ9ÿ ...... ;

Nÿ1ÿÿ ...... ;

Nÿ11ÿ M98 P2ÿÿÿ;

Nÿ12ÿ ...... ;

Nÿ13ÿ ...... ;

Nÿ14ÿ ...... ;

Nÿ15ÿ ...... ;

Nÿ16ÿ M99;

Sub Program - 2.

O2ÿÿÿ

Nÿÿ1ÿ ...... ;

Nÿÿ2ÿ ...... ;

Nÿÿ3ÿ ...... ;

Nÿÿ4ÿ ...... ;

Nÿÿ5ÿ ...... ;

Nÿÿ6ÿ ...... ;

Nÿÿ7ÿ ...... ;

Nÿÿ8ÿ ...... ;

Nÿÿ9ÿ ...... ;

Nÿ1ÿÿ ...... ;

Nÿ11ÿ ...... ;

Nÿ12ÿ ...... ;

Nÿ13ÿ ...... ;

Nÿ14ÿ ...... ;

Nÿ15ÿ ...... ;

Nÿ16ÿ M99;

ONE-LOOP NESTING. TWO-LOOP NESTING.

A program which contains fixed sequences orfrequently repeated patterns may be entered intomemory as a Sub Program, in order to simplify themain program.

A sub program is entered into the machine controllermemory in Edit Mode, in the same manner as the mainprogram.

Differences between a sub and main program :

1) A sub program does not have a billet size definitionat the top of the program listing.

2) A sub program is ended by the M99 code.

The sub program can be called into operation whenthe machine is set to run in Auto Mode. Sub programscan also call other sub programs into operation.

When the main program calls one sub program intooperation, the process is called a one-loop subprogram call. It is possible to program a maximum four-loop sub program call within the main program. Shownbelow is an illustration of a two-loop sub program call.

Page 13: G and M Programming for Mills Manual

BASIC PROGRAMMING - 13

SUB PROGRAM

COMMANDS -GENERAL NOTES.

NOTE 1.A sub program must be saved to memory using a fourdigit number.

NOTE 2.If cutter compensation is required on a tool and theco-ordinates for the tool are within the sub program,the cutter compensation must be applied and cancelledwithin the sub program.

NOTE 3.To call a sub program the M98 code is used followedby Pÿÿÿÿ (the number of the sub program required).

For example,

M98 P2ÿÿÿ

This command is read call program number 2ÿÿÿ.

NOTE 4.A sub program call command (M98 Pÿÿÿÿ) can bespecified along with a move command in the sameblock.

For example,

Gÿ1 X42.5 M98 P1ÿÿÿ;

NOTE 5.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 blockafter the M98 sub program call block in the mainprogram.

If the code M99 Pÿÿÿÿ is entered, control will passto the main program at a block with the N numberequal to that of the P number stated after the M99code.

For example,

M99 Pÿ16ÿ

This command is read return to the main program atblock number Nÿ16ÿ.

Page 14: G and M Programming for Mills Manual

14 - BASIC PROGRAMMING

SUB PROGRAM

REPEAT

COMMAND.

A call command can be set to call a sub programrepeatedly. This call can specify upto 999 repetitionsof a sub program.

A sub program repeat command has the followingformat :

M98 Pÿÿÿ ÿÿÿÿ

When the repetition is omitted, the sub program willbe called once only.

For example,

M98 P1ÿÿÿÿ1

This command is read call the sub program numberÿÿÿ1 ten times.

Number of timesthe sub programis to be repeated.

Sub programnumber.

Callcommand.

Page 15: G and M Programming for Mills Manual

BASIC PROGRAMMING - 15

BILLET

DEFINITION.The Billet Definition is a feature which is only used inthe Denford programming system.

It defines the size of the workpiece billet for use in thesimulation sections of the Denford machine software.The billet definition command has no outcome on theactual machining of the part.

The billet definition command is written at the start ofthe main program. The previous block usually statesthe units of measurement to be applied to the billetdimensions, ie, G21 (Metric data input) or G2ÿ(Imperial data input).

For example,

Nÿÿ1ÿ G21;

[BILLET X1ÿÿ Y15ÿ Z2ÿ;

These two commands are read.

- program line number 1ÿ states that all units are to bemeasured in Metric,

- the billet is a rectangular piece of material, measuring1ÿÿmm x 2ÿÿmm, with a thickness of 2ÿmm.

NOTE 1.A program that has been written on a Denford control(or using Denford CAD/CAM post processor software)will not operate directly on a genuine FANUC machine.The simulation sections of the program areincompatible with the FANUC control.

For the program to run successfully, lines referring tothe CAD/CAM software (at the beginning of theprogram) and the billet definition block must bedeleted.

Page 16: G and M Programming for Mills Manual

16 - BASIC PROGRAMMING

PROGRAM

NUMBERING

AND SAVING.

The Denford system of program numbering relies onthe programmer saving the program to disk orcomputer hard drive at the time of writing.

When saving a program using the Denford DesktopTutor keypad, the program number can range from 1to 99999999.

Writing the program on an offline system with a qwertykeyboard allows the programmer to save the programusing letters and/or numbers.

NOTE 1.Sub program numbers must be saved between theranges ÿÿÿ1 to 9999, ie, using a four digit number. Itis recommended that all programs saved have filenamesalso between these numbers.

NOTE 2.Before saving a program to disk or hard drive, checkthat the program name you wish to use has not beenused on another file. If the program is saved using aname identical to an old program file, the old programfile will be overwritten.

NOTE 3.Programs that need to be used at a later date ongenuine FANUC controls must have their programnumber stated on the first program block. The formatfor inserting a FANUC compatible program number lineis as follows :

O ÿÿÿÿ

Address code O. Four digit program number.

Page 17: G and M Programming for Mills Manual

BASIC PROGRAMMING - 17

A program is composed of several commands, eachcommand instructing the machine to carry out aparticular operation. Each command is a separate lineof data within the program, called a Block.

One block is separated from another block using anend of block code, ie, effectively signifying the end ofa program line. The Denford programming system usesa semicolon ( ; ) as the end of block code.

A four digit sequence number can be specified (ÿÿÿ1- 9999) following the address code N, at the start ofeach block. The order of these block numbers isarbitrary and need not be consecutive. Block numberscan be specified for every program line, or just onprogram lines requiring them.

NOTE 1.The block number must be written at the start of aprogram line when used.

NOTE 2.It is recommended that all blocks are numbered usinga four digit number which rises between each block insteps of 1ÿ. This allows the program to be edited at alater date, ie, new blocks can be inserted or deleted asrequired.

For example :

N ÿÿ1ÿ ....

N ÿÿ2ÿ ....

N ÿÿ3ÿ ....

N ÿÿ4ÿ ....

etc....

NOTE 3.Even when block numbering is not a priority, it isuseful to insert block numbers at important points inthe program, such as tool change commands. This willhelp if a program search is used in the future.

PROGRAM BLOCK

NUMBERING.

Page 18: G and M Programming for Mills Manual

18 - BASIC PROGRAMMING

BLOCK

CONFIGURATION.The sequence in which address codes appear in eachblock should remain consistent throughout the program.It is recommended that the order of these address codesfollows the example shown below :

Nÿÿÿÿ Gÿÿ Xÿÿ.ÿ Yÿÿ.ÿ Zÿÿ.ÿ Fÿÿÿÿ Mÿÿ Sÿÿÿÿ Tÿÿ ;

Interpolationfunction.

Feedratefunction.

Miscellaneousfunction.

Spindlefunction.

Toolfunction.

Blocksequencenumber.

Preparatoryfunction.

NOTE 1.Each block may not necessarily contain all these items.

End ofblocksignal.

G CODES

(PREPARATORY

FUNCTIONS).

Preparatory functions, called G codes, are used todetermine the geometry of tool movements andoperating state of the machine controller; functionssuch as linear cutting movements, drilling operationsand specifying the units of measurement.

They are normally programmed at the start of a block.

A G code is defined using the G address letter and atwo digit number as follows,

G ÿÿ

Address. Two digit number.

Page 19: G and M Programming for Mills Manual

BASIC PROGRAMMING - 19

TOOL

MOVEMENT.The tool moves along straight lines and arcs formingthe workpiece shape.

A) TOOL MOVEMENT ALONG A STRAIGHT LINE.Program command format:

Gÿ1 Y _ _ _ _ ; (P1 - P2)

X _ _ _ _ Y _ _ _ _ ; (P2 - P3)

X _ _ _ _ ; (P3 - P4)

TOOL MOVEMENT ALONG

A STRAIGHT LINE.

+ Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

Page 20: G and M Programming for Mills Manual

20 - BASIC PROGRAMMING

TOOL

MOVEMENT.A) TOOL MOVEMENT ALONG AN ARC.Program command format:

Gÿ3 X _ _ _ _ Y _ _ _ _ R _ _ _ _ ; (P1 - P2)

TOOL MOVEMENT ALONG

AN ARC.

The function of moving the tool along straight linesand arcs is called the Interpolation. Symbols of theprogrammed commands Gÿ1, Gÿ2 and Gÿ3 are calledthe Preparatory functions and specify the type ofinterpolation conducted in the control unit.

NOTE 1.On an actual machine, the table moves in relation tothe cutter. To make the command diagrams easier tounderstand, this manual assumes the tool moves withrespect to the workpiece.

+ Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

Page 21: G and M Programming for Mills Manual

BASIC PROGRAMMING - 21

FEED

FUNCTION.The movement of the tool at a specified speed forcutting is called the Feedrate.

The feedrate is defined using the F address lettterfollowed by a numerical value.

Using the G2ÿ code, the feedrate is defined in Inchesper minute.

Using the G21 code, the feedrate is defined inMillimetres per minute.

M CODES

(MISCELLANEOUS

FUNCTIONS).

Miscellaneous functions, called M codes, are used bythe CNC to command on/off signals to the machinefunctions. ie, Mÿ3 - spindle forward (CW), Mÿ5 - spin-dle stop, etc.....

The functions allocated to lower M code numbers areconstant in most CNC controls, although the higher Mcode number functions can vary from one make ofcontroller to the next.

An M code is defined using the M address letter and atwo digit number as follows,

M ÿÿ

Address. Two digit number.

Page 22: G and M Programming for Mills Manual

22 - BASIC PROGRAMMING

SPINDLE SPEED

FUNCTION

(CUTTING SPEED).

The rotational speed of the tool, with respect to theworkpiece 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 spindleRPM (revolutions per minute).

The spindle speed value specified must fall betweenthe machine tool RPM range for the command to beeffective.

NOTE 1.When a move command and an S code are specifiedin the same block, a simultaneous execution of thecommands is performed.

NOTE 2.Only one S code is allowed in each program block.

Page 23: G and M Programming for Mills Manual

BASIC PROGRAMMING - 23

TOOL

FUNCTION.

Tool profiles can be changed during a program usingthe tool function command. Each tool profile is assigneda number, which in the case of an ATC (AutomaticTool Changer) will also coincide with one of the freebays on its carousel magazine.

The tool number is defined using the address letter T,followed by a number assigned to the tool profile. Tocommand a tool change, the Mÿ6 code would precedethe number of the "new" tool required.

For example,

Mÿ6 Tÿ1

This command is read perform a tool change to toolnumber ÿ1.

TOOL NUMBER 1

2

34

5

6

7 8

ATC CAROUSEL MAGAZINE

NOTE 1.The Mÿ6 code (automatic tool change) must im-mediately precede the T code within the program block.

NOTE 2.Only one T code is allowed in each program block.

NOTE 3.If the machine control reads an Mÿ6 T _ _ commandwhen running in Automatic Mode, the three axes willdrive to the tool change position and the spindle willstop. At this point, the tool change will be performed,if an ATC is fitted. This will always happen, ir-respective of the tool position when the tool changecommand is read from the program.

Page 24: G and M Programming for Mills Manual

24 - BASIC PROGRAMMING

TOOL

COMPENSATION

(TOOL OFFSET).

Generally, several different tool profiles are requiredto machine a workpiece, all of different diameters andlengths.

It would be very difficult to write a program that allowedfor this difference in size between all the various tools.To account for this, the difference in diameter andlength is measured, in advance, for all the tools thatwill be used. Essentially, this means that the cuttingpaths for all the tools now coincide. The values areentered into the offset file.

This tool offset is also called tool compensation.

NOTE 1.When a T code is read by the CNC, it will load theoffset length for that particular tool. The code G41 orG42 (Tool Compensation Left or Right) must be pro-grammed for the radius offset to used.

Page 25: G and M Programming for Mills Manual

BASIC PROGRAMMING - 25

ABSOLUTE AND

INCREMENTAL

CO-ORDINATES.

The addresses X, Y and Z within a program, whenG90 (Absolute co-ordinates) is active, relate to a co-ordinate position from the workpiece datum (the zeroposition).

The addresses X, Y and Z within a program, whenG91 (Incremental co-ordinates) is active, relate to theindividual axis movements required to reach the newposition, from the last position reached by the tool.

The example move illustrated above can be written intwo ways:

G90 Absolute co-ordinates selected

Gÿ1 Y60 F150 ;

G03 X60 Y100 R40 ;

G91 Incremental co-ordinates selected

G01 Y60 F150 ;

G03 X-40 Y40 R40 ;

ABSOLUTE AND INCREMENTAL

CO-ORDINATES.

METRIC UNITS

+ Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

Page 26: G and M Programming for Mills Manual

26 - BASIC PROGRAMMING

TUTORIALS

AND COMMENTS.If the program is written off-line with a qwertykeyboard, information relating to the program can beinserted within the program.

Tutorial information appear in the Tutorial dialog boxof the machine controlling software (ie, the tutorialmessage "Now performing pocket cutting cycle" couldbe written to appear when the pocket cutting operationstarts in the program).

Comments information only appear in the text of theprogram itself (ie, the comment "Tool 5 is 8mm slotcutting tool" could be inserted in the program for useas reference only).

OPTIONAL

BLOCK SKIP.When a forward slash mark ( / ) is followed by a blocknumber (at the beginning of a block) and the blockskip switch on the machine operator panel is set to"on", the block will be ignored in memory operation.When the block switch is set to "off", then the blocksindicated by the "/" marks will be considered as valid.

For example,

N3ÿ X4ÿ ;

/ N4ÿ Y5ÿ ;

/ N5ÿ X7ÿ ;

/ N6ÿ Y9ÿ ;

N7ÿ .....

If the block skip switch is set to "on" in the aboveprogram example, then blocks indicated by the "/" markare skipped.

NOTE 1.A "/" mark must be specified at the start of the block.If it is placed elsewhere in the block, the informationfrom the "/" mark to the ";" mark (the end of blockmark) will be ignored, whilst the information beforethe "/" mark will be effective.

Page 27: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 27

G CODES

(PREPARATORY

FUNCTIONS) -INTRODUCTION.

Preparatory functions, called G codes, are used todetermine the geometry of tool movements andoperating state of the machine controller; functionssuch as linear cutting movements, drilling operationsand specifying the units of measurement.

They are normally programmed at the start of a block.

A G code is made from the G address letter and a twodigit number as follows,

G ÿÿ

MODAL AND NON-MODAL G CODES.Additionally, G codes are split into two categories -

1) Modal (retained) G codes.

A modal G code, once programmed into a block,will affect any subsequent blocks of the programwithout having to be restated.

Additionally, modal G codes are further split intogroups according to their task and function. Amodal G code will remain active until another Gcode from the same group is programmed into ablock, or it is cancelled.

For example,

Gÿ1 and Gÿÿ are modal G codes from group 1:Gÿ1 X _ _ _ _ ;

Y _ _ _ _ ;X _ _ _ _ ;

GÿÿZ _ _ _ _ ;

2) Non-modal (one-shot) G codes.

A non-modal G code must be programmed intoevery block when it is required, ie, it is only ef-fective in the block in which it is specified.

Address. Two digit number.

Gÿ1 is effectivein this range.

Gÿÿ replaces theGÿ1 command.

Page 28: G and M Programming for Mills Manual

28 - G CODES - PREPARATORY FUNCTIONS

G CODES

(PREPARATORY

FUNCTIONS) -INTRODUCTION

NOTES.

NOTE 1.Remember there are two types of G code.A modal G code is retained in memory - it is effectiveuntil another G code from the same modal group iscommanded.A non-modal G code is one-shot - it is effective onlywithin the block in which it is specified.

NOTE 2.It is not necessary to enter a modal G code inrepetitive blocks within a program.For example :If all movements are Gÿ1 (linear cutting command)then Gÿ1 is entered on the first block and omittedfrom all subsequent blocks. This G code will remainactive until an interpolation change is commanded(using Gÿÿ, Gÿ2 or Gÿ3).

NOTE 3.The machine controller has the ability to interpret amaximum of four G codes in one single block of data.However, these G codes must be from separate modalgroups. When two or more G codes from the samegroup are specified in the same block, the CNC willonly make the last stated G code from that modal groupeffective.

NOTES FOR GCODES LISTING

SHOWN RIGHT.

NOTE 1.G codes marked with an * are set/reactivated as de-fault values at machine power up and when the ma-chine is reset or the emergency stop button is acti-vated.

NOTE 2.G codes from group ÿ are non-modal (they must beprogrammed into every program block when required).All other G codes are modal (they remain active throughsubsequent program blocks, until replaced or cancelledby a G code from their particular group).

Page 29: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 29

LIST OF G CODES SUPPORTED BY

DENFORD CNC CONTROLS.Note - Not all G codes apply to each machine.

G Code. Group. Function.

Gÿÿ 1 Positioning (Rapid Traverse)Gÿ1 1 Linear Interpolation (Cutting Feed)Gÿ2 1 Circular Interpolation CWGÿ3 1 Circular Interpolation CCWGÿ4 ÿ Dwell, Exact StopG2ÿ 6 Imperial Data Input (Inches)G21 6 Metric Data Input (Millimetres)G28 ÿ Reference Point ReturnG4ÿ 7 Cutter Compensation CancelG41 7 Cutter Compensation LeftG42 7 Cutter Compensation RightG73 9 High Speed Peck Drilling CycleG74 9 Counter Tapping CycleG76 9 Fine Boring Cycle(not recommended on Denford Machines)G8ÿ* 9 Canned Cycle CancelG81 9 Drilling Cycle, Spot BoringG82 9 Drilling Cycle, Counter BoringG83 9 Deep Hole Peck Drilling CycleG84 9 Tapping CycleG85 9 Boring CycleG86 9 Boring CycleG87 9 Back Boring Cycle(not recommended on Denford Machines)G89 9 Boring CycleG9ÿ* 3 Absolute Zero CommandG91 3 Incremental CommandG94* 5 Feed per MinuteG95 5 Feed per RevolutionG98* 1ÿ Return to Initial Level in Canned CycleG99 1ÿ Return to R Point Level in Canned CycleG17ÿ ÿ Circular Pocket Canned CycleG171 ÿ Circular Pocket Canned CycleG172 ÿ Rectangular Pocket Canned CycleG173 ÿ Rectangular Pocket Canned Cycle

Code listing full and correct at the time of printing.

Page 30: G and M Programming for Mills Manual

30 - G CODES - PREPARATORY FUNCTIONS

The Gÿÿ code executes a non cutting movement, at arapid feedrate, to a specific co-ordinate position in theworking area (operating under absolute co-ordinate movement) or when a certain distance from apreviously stated position (under incremental co-ordinate movement) is programmed.

A Gÿÿ command is written in the following format:

Gÿÿ X _ _ _ _ Y_ _ _ _ Z _ _ _ _ ;

G CODES -

Gÿÿ(RAPID

POSITIONING/TRAVERSE).

Rapid Positioning/Traverse code.

X, Y and Zco-ordinate values.

NOTE 1.The rate of movement is set by the manufacturer ofthe machine tool. The rate of movement can bereduced from 1ÿÿ% to ÿ%, but only in increments of1ÿ%, by using the feed override controls (see spe-cific machine operating manual).

NOTE 2.The Gÿÿ code freezes the tool radius compensation,codes G 41 and G42. If G41 or G42 are active when aGÿÿ command is programmed, the tool radius com-pensation will not function again until a Gÿ1, Gÿ2 orGÿ3 command is programmed.

NOTE 3.The Gÿÿ code is modal and is therefore incompatiblewith Gÿ1, Gÿ2 and Gÿ3 codes in the same block.

NOTE 4.The Gÿÿ code can be written into a program in twoways:Gÿÿ or Gÿ.

The axis co-ordinate moves following a Gÿÿcommand can be programmed as either:(i) absolute values (relative to a set datum point)

following setting of the G9ÿ code, or,(ii) incremental values (relative to the last stated

co-ordinate in the program) following setting of theG91 code.

Page 31: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 31

NOTE 5.On instruction to perform the Gÿÿ command, the threeslides (the X, Y and Z axes) move completelyindependant of each other at a maximum feedrate,along a non-vector (sometimes called a non-linear) typepath.

In the above example, the Gÿÿ command has in-structed the X and Y slides to begin moving, both at amaximum feedrate. When both slides begin movingthe tool will appear to traverse diagonally, a com-posite movement of the two axes moving together.When one axis reaches its finishing co-ordinate, theother axis will continue to move until it reaches itsown finishing co-ordinate. This gives the impressionthat the tool "changes" direction.

G CODES -

Gÿÿ(RAPID

POSITIONING/TRAVERSE).

Gÿÿ - NON-LINEAR

INTERPOLATION. + Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

Page 32: G and M Programming for Mills Manual

32 - G CODES - PREPARATORY FUNCTIONS

G CODES -

Gÿ1(LINEAR

INTERPOLATION).

The Gÿ1 code executes a cutting movementfollowing a straight line, at a set feedrate.

A Gÿ1 command is written in the following format:

Gÿ1 X _ _ _ _ Y_ _ _ _ Z _ _ _ _ ;

The feedrate value programmed into the Gÿ1command is the actual feedrate along the proposedtool path, not the feedrate of each axis/slide.

On single axis moves (ie, the tool moves exactlyparallel to the X, Y or Z axis direction), the slide willfeed at the rate stated in the Gÿ1 command.

On two or three axis moves (ie, the tool is moving in astraight diagonal line), all the slides have to operateexactly the same length of time, in order to produce asingle diagonal (vector) move. The machine controllerwill calculate the separate feedrates for the X, Y and Zslides, enabling the actual vector feedrate to equal thatstated in the Gÿ1 command.

The axis co-ordinate moves following a Gÿ1 commandcan be programmed as either:(i) absolute values (relative to a set datum point)

following setting of the G9ÿ code, or,(ii) incremental values (relative to the last stated co-

ordinate in the program) following setting of theG91 code.

Linear Interpolationcode.

X, Y and Zco-ordinate values.

Page 33: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 33

Example of programming a Gÿ1 linear interpolation:G9ÿ Gÿ1 X1ÿÿ Y5ÿ F15ÿ ;

G CODES -

Gÿ1(LINEAR

INTERPOLATION).

NOTE 1.In the example shown above, G9ÿ, Gÿ1 and the F_ _ _ _ feedrate are modal and can be continued ontothe next block (without having to be restated) if re-quired.

NOTE 2.The programmed feedrate F _ _ _ _ can be varied inAutomatic Mode from ÿ% to 15ÿ% by using the feedoverride controls (see specific machine operatingmanual). 1ÿÿ% is the programmed feedrate.

NOTE 3.When there is no feedrate programmed within the partprogram, the CNC will set a feedrate of 1ÿmillimetres per minute in G21 Metric Data Mode, orÿ.4 inches per minute in G2ÿ Imperial Data Mode.

NOTE 4.The Gÿ1 code is modal and is therefore incompatiblewith Gÿÿ, Gÿ2 and Gÿ3 codes in the same block.

NOTE 5.The Gÿ1 code can be written into a program in twoways:Gÿ1 or G1.

Gÿ1 - LINEAR

INTERPOLATION. + Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

Page 34: G and M Programming for Mills Manual

34 - G CODES - PREPARATORY FUNCTIONS

The Gÿ2 code executes a cutting movementfollowing a clockwise circular path, at a set feedrate.

The Gÿ3 code executes a cutting movementfollowing a counterclockwise circular path, at a setfeedrate.

The definitions of clockwise (Gÿ2) andcounterclockwise (Gÿ3) are fixed according to thesystem of co-ordinates in the diagram below.

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 workpiece. Thearc end point is sometimes referred to as the targetposition.

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

RIGHT HAND CARTESIAN

CO-ORDINATE SYSTEM.

G CODES -

Gÿ2Gÿ3(CIRCULAR

INTERPOLATION).

+X

+Y

Gÿ3

Gÿ2

Page 35: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 35

G CODES -

Gÿ2Gÿ3(CIRCULAR

INTERPOLATION).

I AND JTo program an arc when only the arc centre is given(the radius is unknown) use the address letters I andJ.

I relates to the address X and is the incremental valueand direction (+/-) from the start point of the arc inthe X axis to the arc centre (see diagram below).

J relates to the address Y and is the incremental valueand direction (+/-) from the start point of the arc inthe Y axis to the arc centre (see diagram below).

+ Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

Gÿ2/Gÿ3 - CIRCULAR

INTERPOLATION USING I AND J.

Page 36: G and M Programming for Mills Manual

36 - G CODES - PREPARATORY FUNCTIONS

G CODES -

Gÿ2Gÿ3(CIRCULAR

INTERPOLATION).

The format to program a circular interpolation inCartesian co-ordinates is written as follows :

There are four ways to program a clockwise circularpath 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 _ _ _ ;

There are four ways to program an anticlockwisecircular path using the Gÿ3 code:G9ÿ Gÿ3 X _ _ _ _ Y _ _ _ _ R _ _ _ F _ _ _ ;G9ÿ Gÿ3 X _ _ _ _ Y _ _ _ _ I _ _ _ J _ _ _ F _ _ _ ;G91 Gÿ3 X _ _ _ _ Y _ _ _ _ R _ _ _ _ F _ _ _ _ ;G91 Gÿ3 X _ _ _ _ Y _ _ _ _ I _ _ _ J _ _ _ F _ _ _ ;

where,

Gÿ2 defines the clockwise direction circularinterpolation.

Gÿ3 defines the counterclockwise direction circularinterpolation.

G9ÿ X _ _ _ _ Y _ _ _ _ defines the arc end point in thework co-ordinate system.

G91 X _ _ _ _ Y _ _ _ _ defines the signed distance ofthe arc end point from the arc start point.

I _ _ _ J _ _ _ defines the signed distance of the arcstart point from the centre point of the arc.

R _ _ _ defines the length of the arc radius.

F _ _ _ defines the feedrate along the arc.

Page 37: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 37

G CODES -

Gÿ2Gÿ3(CIRCULAR

INTERPOLATION).

For example:

The above tool path can be programmed as follows (Inabsolute mode, G9ÿ):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ÿ ;

The above tool path can be programmed as follows (Inincremental mode, G91):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ÿ ;

+ Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

Gÿ2/Gÿ3 - CIRCULAR

INTERPOLATION EXAMPLE.

Page 38: G and M Programming for Mills Manual

38 - G CODES - PREPARATORY FUNCTIONS

G CODES -

Gÿ2Gÿ3(CIRCULAR

INTERPOLATION).

When using the address R _ _ _ _ , two types of arcscan be considered. One arc is less than 18ÿ degrees,whilst the other arc is greater than 18ÿ degrees. Whenan arc exceeding 18ÿ degrees is commanded, theradius value (R _ _ _ _) must be specified as a negativesigned (-) value.

For example:

The above tool path for an arc less than 18ÿ degrees(circle A) can be programmed as follows (In absolutemode, 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 (Inabsolute mode, G9ÿ):Gÿ2 X8ÿ Y4ÿ R-5ÿ F125 ;

+ Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

Gÿ2/Gÿ3 - CIRCULAR

INTERPOLATION ARC

DEFINITON.

Page 39: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 39

NOTE 1.When programming arcs using the address R (arcradius), the value of R must be equal to, or greaterthan half the longest distance travelled by either axis.

NOTE 2.Iÿ and Jÿ can be omitted from program lines.

NOTE 3.When X or Y are omitted from program lines, the arcend point is located at the same position as the arcstart point and the arc centre is commanded by I or J,an arc of 36ÿ degrees (ie, a complete circle) is as-sumed. When R is used, an arc of ÿ degrees is as-sumed and the cutter does not move.

NOTE 4.When I, J and R addresses are specifiedsimultaneously in the same program line, the addressR takes precedence and the other addresses areignored.

NOTE 5.A Gÿ2 code can be written into a program in twoways.Gÿ2 or G2.A Gÿ3 code can be written into a program in twoways.Gÿ3 or G3.

G CODES -

Gÿ2Gÿ3(CIRCULAR

INTERPOLATION).

Page 40: G and M Programming for Mills Manual

40 - G CODES - PREPARATORY FUNCTIONS

G CODES -

Gÿ4(DWELL).

The Gÿ4 code is used to enter a set time delay intothe program (called a "dwell").

A Gÿ4 command is written in the following format:

Gÿ4 X _ _ _ _ ;

or Gÿ4 P _ _ _ _ ;

where the dwell value is programmed using theaddress letters X (time in seconds) or P (time in 1/1ÿÿÿ seconds), followed by a number indicating thisdwell value.

For example :Gÿ4 X1.5 ;

This command is read perform a dwell of 1.5 secondsduration.Gÿ4 P25ÿÿ ;

This command is read perform a dwell of 2.5 secondsduration.

NOTE 1.A decimal point cannot be used with the address P.

NOTE 2.The dwell is performed at the start of the block inwhich it is programmed.

NOTE 3.The dwell begins when the commanded feedrate ofthe previous block reaches zero.

NOTE 4.The maximum value of a dwell time is 999 seconds.

NOTE 5.Gÿ4 is a non-modal G code. It is only active in theblock in which it is programmed.

NOTE 6.A Gÿ4 code can be written into a program in twoways.Gÿ4 or G4.

Page 41: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 41

G CODES -

G2ÿG21(IMPERIAL

/METRIC

DATA INPUT).

The machine controller can be programmed in eitherImperial (inch) unit input (G2ÿ) or Metric (millimetre)unit input (G21). The standard format for a CNC partprogram is to write the G2ÿ or G21 code in the firstblock of the program.

G code. Type. Units. Lowest input value.

G2ÿ Imperial Inch ÿ.ÿÿÿ1 inchG21 Metric Millimetre ÿ.ÿÿ1 mm

The unit systems of the following items are changeddepending on whether G2ÿ or G21 is set.

1) Positioning commands (X, Y and Z).

2) Incremental movement distances.

3) Feedrates commanded by the F code.

4) Offset values.

NOTE 1.The status of G2ÿ or G21 in the machine controller isdependant on the option that is saved to the disc.

NOTE 2.A G2ÿ code must not be changed for a G21 code (orvice versa) during the program.

NOTE 3.When switching between G2ÿ and G21, the offsetsmust be set according to the units of measurementbeing used.

NOTE 4.G 2ÿ and G21 are both modal G codes within thesame modal group.

Page 42: G and M Programming for Mills Manual

42 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G28(REFERENCE

POINT RETURN).

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

On machines fitted with Denford milling software, thispoint is also used as the Home position, the point usedby the machine to set the limits of movement for theX, Y and Z slides.

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

A G28 command is written in the following format :

G9ÿ G28 X _ _ _ _ Y _ _ _ _ Z _ _ _ _ ;

or G91 G28 X _ _ _ _ Y _ _ _ _ Z _ _ _ _ ;

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

This intermediate point allows the tool to beprogrammed to follow a more "predictable" path,keeping it sufficiently clear from any part of themachine or billet it could hit when moving to thereference point.

The move to any intermediate point and the referencepoint are performed at a rapid traverse rate, using anon-vector (non-linear) type path, ie, the tool mayappear to "change" direction due to the non-vectortype positioning being used.

Page 43: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 43

G CODES -

G28(REFERENCE

POINT RETURN).

To avoid this collision, the tool is sent on a path whichincludes the additional, or intermediate, point P2. Theintermediate point is used to allow the tool to movecompletely clear from the billet, before continuing ontothe reference point, P3, shown below.

NOTE 1.The diagram below shows how the tool could collidewith the billet when manoeuvring towards thereference point. This is a result of the non-vectoredmovements forcing the tool to follow a path which"cuts" through the edge of the billet.

G28 - AVOIDING COLLISION BY USING AN

INTERMEDIATE POSITION.

The above toolpath can be programmed as follows (Inabsolute mode, G9ÿ):G9ÿ G28 X6ÿ Z6ÿ ;

The above toolpath can be programmed as follows (Inincremental mode, G91):G91 G28 Xÿ Z4ÿ ;

G28 - POTENTIAL COLLISION THROUGH NOT

USING AN INTERMEDIATE POSITION.

+ Z

AXI

S.

+ X AXIS.

NOTE - GRAPHIC

SHOWS ELEVATION

OF BILLET, NOTPLAN.

+ Z

AXI

S.

+ X AXIS.

NOTE - GRAPHIC

SHOWS ELEVATION

OF BILLET, NOTPLAN.

Page 44: G and M Programming for Mills Manual

44 - G CODES - PREPARATORY FUNCTIONS

NOTE 2.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 bewritten as follows (In incremental mode, G91):G91 G28 Xÿ Yÿ Zÿ ;

The intermediate point co-ordinates are still stated, butall their values are set to zero, indicating no axismovement. Therefore, the tool will move from pointP1 to the reference point, P3, along a non-vector typepath.

G CODES -

G28(REFERENCE

POINT RETURN). USING G28 WITH NO INTERMEDIATE

POSITION SAFELY.

NOTE 3.G28 is a non-modal G code. It is only active in theblock in which it is programmed.

+ Z

AXI

S.

+ X AXIS.

NOTE - GRAPHIC

SHOWS ELEVATION

OF BILLET, NOTPLAN.

Page 45: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 45

G CODES -

G4ÿG41G42(CUTTER

COMPENSATION).

The collection of G4ÿ, G41 and G42 codes allow themachine controller to produce very accurate arcs andtapers on the billet, by compensating for the toolradius.

Complex workpiece shapes are therefore programmedwith cutter compensation mode active. The radius ofthe tool (the offset amount) is measured, thenentered into the offset file in the machine controller.Once set, the tool path can be offset by this value,regardless of the program.

WORK POSITION AND MOVEMENT COMMAND.When tool nose radius compensation is required in aCNC program, the position of the billet in respect tothe tool must be specified using the table below.

THE TOOL IS POSITIONED ON THE

RIGHT HAND SIDE OF THE PART,AS SEEN FOLLOWING THE

DIRECTION OF MOVEMENT, FROM

BEHIND THE TOOL.

THE TOOL IS POSITIONED ON THE

LEFT HAND SIDE OF THE PART, AS

SEEN FOLLOWING THE DIRECTION

OF MOVEMENT, FROM BEHIND THE

TOOL.

G41 - LEFT HAND

G42 - RIGHT HAND

G CODE DIRECTION TOOL PATH

G4ÿ CANCEL MOVEMENT ALONG PROGRAMMED PATH

G41 LEFT HAND MOVEMENT ON THE LEFT HAND SIDE OF THE PROGRAMMED PATH

G42 RIGHT HAND MOVEMENT ON THE RIGHT HAND SIDE OF THE PROGRAMMED PATH

The two diagrams below illustrate the direction ofcompensation codes G41 and G42, in relation to youreye level.

Page 46: G and M Programming for Mills Manual

46 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G4ÿG41G42(CUTTER

COMPENSATION).

CUTTER COMPENSATION START-UP (G41 - G42).The operation instructing a machine to switch tocutter compensation mode is called the start-up block,or ramping on block. The start-up block is used to al-low the tool time to change from moving along theprogrammed path line to following either side of theprogrammed path line.

The start-up block should satisfy the following points:

1) A G41 or G42 code must be contained in the block,or specified in the previous block.

2) A Gÿ1 X, Y, or X and Y move is specified in theblock and the distance of the linear move must begreater than the tool radius.

3) The tool radius value, "R", entered into the tooloffsets table must not be ÿÿ.

NOTE 1.A Gÿ2 or Gÿ3 circular interpolation command cannotbe specified in the start-up block.

NOTE 2.In cutter compensation start-up, two blocks are readinto the machine controller. The first block is performedand the second block is entered and held in memory.In subsequent compensation moves, two blocks areread in advance, so the machine controller has theblock currently being performed and the next twoblocks in memory.This is because cutter compensation always needs toknow what happens in the move following the onebeing currently performed. The machine controller canplan ahead to calculate the correct end position forthe current move, that will also be the correct startposition allowing for cutter compensation, for the nextmove.

NOTE 3.The codes G4ÿ, G41 and G42 are modal, belonging tothe same modal family. They are incompatible witheach other on the same block.

Page 47: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 47

G CODES -

G4ÿG41G42(CUTTER

COMPENSATION).

CANCELLATION OF CUTTER COMPENSATION

(G4ÿ).The G4ÿ code is used to cancel cutter compensation.

A G4ÿ command can only be performed in a block inwhich a linear move (ie, Gÿÿ, Gÿ1, G28) isprogrammed.

NOTE 1.Following the machining of an internal pocket, it isrecommended that the Z axis is withdrawn by usingthe Gÿ1 command, to a position clear of theworkpiece, before the cutter compensation mode iscancelled.

NOTE 2.The machine controller enters compensation cancelmode automatically when :1) the machine power is first switched on.2) the reset button on the CRT/MDI controller panel

is pressed.3) a program is forced to end by performing an Mÿ2

or M3ÿ command.

Page 48: G and M Programming for Mills Manual

48 - G CODES - PREPARATORY FUNCTIONS

O ÿÿ1ÿ

Nÿÿ1ÿ Gÿÿ X-15 Y-15 ;

Nÿÿ2ÿ G41 Xÿ Yÿ F1ÿÿ ; (Start-Up Move)

Nÿÿ3ÿ Y4ÿ ;

Nÿÿ4ÿ X3ÿ Y8ÿ ;

Nÿÿ5ÿ X6ÿ ;

Nÿÿ6ÿ Gÿ2 X1ÿÿ Y4ÿ R4ÿ ;

Nÿÿ7ÿ Gÿ1 Y3ÿ ;

Nÿÿ8ÿ Gÿ3 X7ÿ Yÿ R3ÿ ;

Nÿÿ9ÿ Xÿ ;

Nÿ1ÿÿ X-15 Y-15 ; (Cancellation Move)

G CODES -

G4ÿG41G42(CUTTER

COMPENSATION).

The following part program for a finishing pass showsthe recommended method for start-up andcancellation of cutter compensation :

+ Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

EXAMPLE - USING

CUTTER COMPENSATION

MODE.

Page 49: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 49

G CODES -

G73-G89(CANNED

CYCLES).

A canned cycle simplifies the program by replacingcomplex machining sequences, programmed by severalblocks of information, with just one or two blocks.

Generally, a canned cycle consists of a sequence ofsix operations, as shown below:

Operation 1 - Positioning of the X and Y axes.

Operation 2 - Rapid traverse in the Z axis to the "R"point.

Operation 3 - Hole machining procedure.

Operation 4 - Operation at bottom of hole.

Operation 5 - Retraction to R point.

Operation 6 - Rapid traverse in the Z axis to the Initiallevel.

Hole positioning is performed in the X and Y axis holemachining is performed in the Z axis.

+ Z

AXI

S DIR

ECTI

ON.

Page 50: G and M Programming for Mills Manual

50 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G73-G89(CANNED

CYCLES).

There are three command modes for canned cycles,as follows:

1) Data Format (G9ÿ and G91).

2) Return Point Level (G98 and G99).

3) Cycle Mode (G73 to G89).

DATA FORMAT COMMAND MODES.The data format used in canned cycles is specified bythe codes G9ÿ and G91, as shown below:

G9ÿ - ABSOLUTE DATA FORMAT.

G91 - INCREMENTAL DATA FORMAT.

+ Z

AXI

S DIR

ECTI

ON.

+ Z

AXI

S DIR

ECTI

ON.

Page 51: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 51

G CODES -

G73-G89(CANNED

CYCLES).

G98 - INITIAL POINT

LEVEL RETURN.G99 - R POINT

LEVEL RETURN.

RETURN POINT LEVEL COMMAND MODES.The return point position of the tool (ie, to the InitialLevel, or the R Level) is specified by the codes G98and G99, as shown below:

The Initial level refers to the absolute value of the Zaxis, at the time of change from the positioning modetop the canned cycle mode.

+ Z

AXI

S DIR

ECTI

ON.

+ Z

AXI

S DIR

ECTI

ON.

Page 52: G and M Programming for Mills Manual

52 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G73-G89(CANNED

CYCLES).

The format for machining data in a canned cycle iswritten as follows:

where,

G.... is defined as the canned cycle.

X.... Y.... is defined as the hole position, in absolute orincremental value.

Z.... is defined as the distance from the R point to thebottom of the hole in incremental mode, or the posi-tion of the hole bottom in absolute mode.

R.... is defined as the distance from the initial level tothe R point level in incremental mode, or the positionof the Z datum in relation to the R point level in abso-lute mode.

P.... is defined as the dwell time to be performed atthe bottom of the hole (see the Gÿ4 code for moredetails).

Q.... is defined as the cut-in distance value or shiftvalue (Note - this is always specified as anincremental value).

K.... is defined as the number of repeats, for a seriesof holes. When not specified, K=1.

F.... is defined as the feedrate for machining.

NOTE 1.The addresses P and Q are omitted within some cannedcycles.

NOTE 2.Once the drilling data has been specified and read intothe machine controller, it is retained until it is eitherchanged, or the canned cycle cancelled. All the re-quired data must be specified when the canned cycleis started and only the data to be changed has to bespecified during the cycle.

(G9ÿ) (G98) or or(G91) (G99)

G.... X.... Y.... Z.... R.... P.... Q.... K.... F.... ;

Page 53: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 53

G CODES -

G73-G89(CANNED

CYCLES).

The following example shows a canned cycle fordrilling 4 holes, where the third hole is to be machined1ÿmm deeper:G9ÿ G99 G81 X1ÿ Y1ÿ Z-15 R2 F1ÿÿ ;

X2ÿ ; (X axis move)

X3ÿ Z-25 ; (X and Z change)

X4ÿ Z-15 ; (X and Z change)

G8ÿ ; (Cancel)

The following example shows a repeat canned cycle:G91 G99 G81 X1ÿ Y6 Z-1ÿ R-8 K4 F1ÿÿ ;

+ Y

AXI

S DIR

ECTI

ON.

+ X AXIS DIRECTION.

Page 54: G and M Programming for Mills Manual

54 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G73(HIGH SPEED

PECK DRILLING).

A G73 (High Speed Peck Drilling) command is writtenin the following format:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G73 X.... Y.... Z.... Q.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

When machining, the drill is positioned at the co-ordi-nate point of the first hole, for the X and Y axes and atthe initial level, for the Z axis. The G73 command isthen read into the machine controller and the cyclebegins. The drill will rapid traverse to the R point leveland begin to feed in, until a cut-in distance of Q isattained. At this point, the drill will retract a small dis-tance (set within the machine controller). A cut-in dis-tance of Q at the same feedrate will begin again, fol-lowed by a similar retraction. These movements willcontinue until the total Z depth has been reached. Thedrill will rapid traverse out to the Initial level, if a G98code is programmed within the cycle, or to the R pointlevel, if a G99 code is programmed within the cycle.At this point the next block is read into the machinecontroller. If this block contains an X, Y or X and Y co-ordinate the drill will position itself at that point andthe high speed peck drilling cycle will begin again.

Page 55: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 55

G CODES -

G74(COUNTER

TAPPING).

A G74 (Counter/Left Hand Tapping) command iswritten in the following format:

please refer to page 52 for the variable definitions.

NOTE 1.F (Feed) = RPM x Pitch.

(G9ÿ) (G98) or or(G91) (G99)

G74 X.... Y.... Z.... P.... R.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the Initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth.

Op 4) Dwell P (time for spindle stop and start CWdirection).

Op 5) Feed to R point level.

Op 6) Dwell P (time for spindle stop and start CCWdirection).

If the G98 code is programmed within the cycle, thenext move will be a rapid traverse to the Initial level. Ifthe G99 code is programmed within the cycle, therewill be no movement.

Page 56: G and M Programming for Mills Manual

56 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G76(FINE BORING).

A G76 (Fine Boring) command is written in the fol-lowing format:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G76 X.... Y.... Z.... R.... P.... Q.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the Initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth.

Op 4) Dwell P (time for spindle stop and move Q value).

Op 5) Feed to R point level.

Op 6) Move back Q value.

The above moves vary depending on the setting of thecodes G98 and G99.

NOTE 1.THIS CYCLE CAN ONLY BE USED ON A MACHINEFITTED WITH A SPINDLE CAPABLE OF ORIENTATION.BECAUSE THE TOOL MOVES WITHIN THE HOLEAFTER SPINDLE STOP TO FACE THE OPPOSITEDIRECTION.

Page 57: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 57

G CODES -

G8ÿ(CANNED CYCLE,CANCEL).

Some of the addresses used within a canned cycle aremodal (Z, P, Q and R), so their respective values areretained in the machine controller memory after thecycle has finished. The canned cycle must be can-celled, automatically removing these modal values,before the next canned cycle can be programmed intothe machine controller.

This is achieved by programming a G8ÿ code,following the last block of the canned cycle within thepart program.

NOTE 1.The G8ÿ code is active when:1) the machine power is first switched on.2) the reset button on the CRT/MDI controller panel

is pressed.3) the Emergency Stop button is pressed.

Page 58: G and M Programming for Mills Manual

58 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G81(DRILLING -SPOT BORING).

A G81 (Drilling - Spot Boring) command is written inthe following format:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G81 X.... Y.... Z.... R.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the Initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth.

Op 4) Rapid traverse to Initial level (G98) or R pointlevel (G99).

Page 59: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 59

G CODES -

G82(DRILLING -COUNTER

BORING).

A G82 (Drilling - Counter Boring) command is writtenin the following format:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G82 X.... Y.... Z.... P.... R.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the Initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth.

Op 4) Dwell for value P.

Op 5) Rapid traverse to Initial level (G98) or R pointlevel (G99).

Page 60: G and M Programming for Mills Manual

60 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G83(DEEP HOLE

PECK DRILLING).

A G83 (Deep Hole Peck Drilling) command is writtenin the following format:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G83 X.... Y.... Z.... Q.... R.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed in to the value of Q.

Op 4) Rapid traverse out to R point. Rapid traverse backto within 1mm of depth of Q cut. Operationmoves 2 and 4 are repeated until Z depth isreached.

Op 5) Rapid traverse to Initial level (G98) or R pointlevel (G99).

Page 61: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 61

G CODES -

G84(TAPPING).

A G84 (Tapping) command is written in the followingformat:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G84 X.... Y.... Z.... R.... P.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth.

Op 4) Dwell P (time for spindle stop and start CCWdirection).

Op 5) Feed to R point level.

Op 6) Dwell P (time for spindle stop and start CWdirection).

If the G98 code is programmed within the cycle, thenext move will be a rapid traverse to the Initial level. Ifthe G99 code is programmed within the cycle, therewill be no movement.

NOTE 1.F (Feed) = RPM x Pitch.

Page 62: G and M Programming for Mills Manual

62 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G85(BORING).

A G85 (Boring) command is written in the followingformat:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G85 X.... Y.... Z.... R.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed in to the Z depth.

Op 4) Feed back to R point level.

If the G98 code is programmed within the cycle, thenext move will be a rapid traverse to the Initial level. Ifthe G99 code is programmed within the cycle, therewill be no movement.

Page 63: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 63

G CODES -

G86(BORING).

A G86 (Boring) command is written in the followingformat:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G86 X.... Y.... Z.... R.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth and spindle stop.

Op 4) Rapid traverse to the initial level and spindle CWfor G98, or rapid traverse to R point level andspindle CW for G99.

Page 64: G and M Programming for Mills Manual

64 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G87(BACK

BORING).

A G87 (Back Boring) command is written in the fol-lowing format:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G87 X.... Y.... Z.... P..... Q.... R.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:Op 1) Rapid position to X, Y and Z (the initial level).Op 2) Spindle stop and orientation. Move the value of Q.Op 3) Rapid traverse to R point level.Op 4) Spindle CW and move back the value of Q.Op 5) Feed in to Z depth (positive direction) and dwell P.Op 6) Spindle stop and orientate.Op 7) Move the value of Q.Op 8) Rapid traverse to R point level.Op 9) Move back the value of Q and spindle CW.

NOTE 1.THIS CYCLE CAN ONLY BE USED ON A MACHINEFITTED WITH A SPINDLE CAPABLE OF ORIENTATION.BECAUSE THE TOOL MOVES WITHIN THE HOLEAFTER SPINDLE STOP TO FACE THE OPPOSITEDIRECTION.

NOTE 2.A G99 return to R point level is not possible within thiscycle.

Page 65: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 65

G CODES -

G89(BORING).

A G89 (Boring) command is written in the followingformat:

please refer to page 52 for the variable definitions.

(G9ÿ) (G98) or or(G91) (G99)

G86 X.... Y.... Z.... P.... R.... F.... ;

+ Z

AXI

S DIR

ECTI

ON.

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth and dwell for value P.

Op 4) Feed out to R point and rapid traverse to initiallevel for G98, or feed out to R point for G99.

Page 66: G and M Programming for Mills Manual

66 - G CODES - PREPARATORY FUNCTIONS

G CODES -PROGRAM

EXAMPLE

USING CANNED

CYCLES.

Nÿÿ4ÿ Mÿ6 Tÿ1 ;

Nÿÿ5ÿ G9ÿ Gÿÿ X1ÿ Y3ÿ Z12 S1ÿÿÿ Mÿ3 ;

Nÿÿ6ÿ G99 G81 X1ÿ Y3ÿ Z-17 R2 F75 ;

Nÿÿ7ÿ Y1ÿ ;

Nÿÿ8ÿ X3ÿ ;

Nÿÿ9ÿ G98 Y3ÿ ;

Nÿ1ÿÿ G99 X9ÿ ;

Nÿ11ÿ Y1ÿ ;

Nÿ12ÿ X11ÿ ;

Nÿ13ÿ G98 Y3ÿ ;

Nÿ14ÿ G91 G8ÿ G28 Xÿ Yÿ Zÿ Mÿ5 ;

Nÿ15ÿ Mÿ6 Tÿ2 ;

Nÿ16ÿ G9ÿ Gÿÿ X6ÿ Y28 Z12 S75ÿ Mÿ3 ;

Nÿ17ÿ G99 G83 X6ÿ Y28 Z-17 Q6 R2 F6ÿ ;

Nÿ18ÿ G98 Y12 ;

Nÿ19ÿ G91 G8ÿ G28 Xÿ Yÿ Zÿ Mÿ5 ;

Nÿ2ÿÿ M3ÿ ;

Tool change.

Tool position to initial level.

Hole 1 retract R point.

Hole 2 retract R point.

Hole 3 retract R point.

Hole 4 retract initial level.

Hole 5 retract R point.

Hole 6 retract R point.

Hole 7 retract R point.

Hole 8 retract initial level.

Home position spindle stop.

Tool change.

Tool position initial level.

Hole 9 retract R point.

Hole 1ÿ retract initial level.

Home position spindle stop.

Program stop.

Page 67: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 67

G CODES -

G9ÿ(ABSOLUTE

ZERO COMMAND).

When G9ÿ is active, all co-ordinates are relative tothe workpiece datum (the zero position).

NOTE 1.The G9ÿ code is active when:1) the machine power is first switched on.2) the reset button on the CRT/MDI controller panel

is pressed.3) the Emergency Stop button is pressed.

G CODES -

G91(INCREMENTAL

COMMAND).

When G91 is active, all movement command valuesare distance moved (including the +/- sign) from lastknown programmed position.

G CODES -

G94(FEED PER

MINUTE).

When G94 is active, all feedrates stated within theprogram are defined in either millimetres per minutewhen operating in G21 Metric Mode, or inches perminute when operating in G2ÿ Imperial Mode.

For example:

(G2ÿ) F6 = 6 in/min.

(G21) F15ÿ = 15ÿ mm/min.

Page 68: G and M Programming for Mills Manual

68 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G95(FEED PER

REVOLUTION).

When G95 is active, all feedrates stated within theprogram are defined in either millimetres perrevolution when operating in G21 Metric Mode, orinches per revolution when operating in G2ÿ ImperialMode.

NOTE 1.THE G95 CODE IS ONLY AVAILABLE WHEN THEMACHINE IS FITTED WITH A SPINDLE ENCODER. SEEYOUR MACHINE SPECIFICATION.

G CODES -

G98(RETURN TO

INITIAL LEVEL).

A G98 code, when used within a canned cycle, willreturn the drill or boring bar back to the initial levelafter machining a hole.

G CODES -

G99(RETURN TO RPOINT LEVEL).

A G99 code, when used within a canned cycle, willreturn the drill or boring bar back to the R point levelafter machining a hole.

Page 69: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 69

The following canned cycles, when programmedcorrectly, will machine either a circular pocket to anydiameter and depth, or a rectangular pocket to anyside length and depth.

Both canned cycles require two blocks of informationeach, with each block having its own G code:

G17ÿG171

G172G173

G CODES -

G17ÿ-G173(CIRCULAR/RECTANGULAR

POCKET CANNED

CYCLES).

The following pages show six programs for thesecanned cycles....

Programs ÿÿÿ2, ÿÿÿ3 and ÿÿÿ4 are for circularpockets.

Programs ÿÿÿ5, ÿÿÿ6 and ÿÿÿ7 are forrectangular pockets.

Circular pocket.

Rectangular pocket.

NOTE 1.Great care must be taken when using these cannedcycles, since each canned cycle can be written threedifferent ways.This is achieved according to the values assignedfollowing the addresses P, I and J in canned cycleG17ÿ-171 and the values assigned following theaddresses P, I and K in canned cycle G172-173. Byadding these values, the cutter will move in adifferent path when machining.

Page 70: G and M Programming for Mills Manual

70 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G17ÿG171(CIRCULAR POCKET

CANNED

CYCLE EXAMPLE A).

[BILLET X75 Y9ÿ Z3ÿ ; .............................................

[EDGEMOVE X-37.5 Y-45 ; ..........................................

[TOOLDEF T1 D6 Zÿ ; ................................................

O ÿÿÿ2 ; .................................................................

Nÿÿ4ÿ G91 G28 Xÿ Yÿ Zÿ ; .....................................

Nÿÿ5ÿ Mÿ6 Tÿ1 ; ...................................................

Nÿÿ6ÿ G9ÿ Gÿÿ Xÿ Yÿ Z1ÿ S3ÿÿÿ Mÿ3 ; ................

Nÿÿ7ÿ Gÿ1 Zÿ F3ÿÿ ; .............................................

Nÿÿ8ÿ G17ÿ Rÿ Pÿ Q3 Xÿ Yÿ Z-6 Iÿ Jÿ K-24 ; ..........

Nÿÿ9ÿ G171 P75 S3ÿÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ ; ...

Nÿ1ÿÿ Gÿÿ Z25 Mÿ5 ; ............................................

Nÿ11ÿ G91 G28 Xÿ Yÿ Zÿ ; .....................................

Nÿ12ÿ M3ÿ ; ..........................................................

Billet size.

Position of datum from thebottom LH corner of billet.

Tool no. dia. and position.

Program no.

Metric, reference point.

Tool no.

Absolute, rapid, tool 1ÿmmabove surface, spindle speedand start.

Tool to surface of job, feed set.

Circular pocket canned cycle.

Circular pocket canned cycle.

Rapid, tool to 25mm abovesurface, spindle stop.

Incremental, return toreference point.

Program reset.

PROGRAM NUMBER ÿÿÿ2 - ROUGHING PROGRAM - CIRCULAR POCKET - G17ÿ AND G171.

NOTE 1.The absolute zero datum position is set in the offsetfile.

Page 71: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 71

G CODES -

G17ÿG171(CIRCULAR POCKET

CANNED

CYCLE EXAMPLE A).

For G17ÿ block,R defines the position of the tool to start cycle ie. ÿ

(surface of job).P defines when P is zero(ÿ) the cycle is a roughing

cycle.Q defines the peck increment, in program number

ÿÿÿ2, 2 pecks each of 3mm.X defines the pocket centre in X axis (ÿ).Y defines the pocket centre in Y axis (ÿ).Z defines the pocket base (-6mm) from job surface.I defines the side finish allowance (ÿ as this is a

roughing cycle only).J defines the base finish allowance (ÿ as this is a

roughing cycle only).K defines the radius of pocket (-24) negative value -

cut in CCW direction).

For G171 block,P defines the cut width percentage.S defines the roughing spindle speed (S3ÿÿÿ).R defines the roughing Feed in Z (75).F defines the roughing feed XY (25ÿ).B defines the finishing spindle speed (35ÿÿ, not

applicable as roughing only).J defines the finishing feed (2ÿÿ, not applicable as

roughing only).

When setting offsets the value R must be included, Rbeing the radius of the cutter.

The direction of the cutter path is controlled by K, anegative (K-24) value for K means the cutter path is ina CCW direction and if the K value is positive (K+24)the cutterpath is in a CW direction. The Q value isalways positive (Q+3).

When the tool has finished cutting the tool retracts1mm in the Z axis, moves to the centre of the circularpocket at rapid traverse, retracts again in the Z axis .

Program number ÿÿÿ2 is for a two cut roughing cycle.

Nÿÿ8ÿ G17ÿ Rÿ Pÿ Q3 Xÿ Yÿ Z-6 Iÿ Jÿ K-24 ;

Nÿÿ9ÿ G171 P75 S3ÿÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ ;

Definitions for the terms used in the G17ÿ and G171circular pocket canned cycle from program numberÿÿÿ2 follows:

Page 72: G and M Programming for Mills Manual

72 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G17ÿG171(CIRCULAR POCKET

CANNED

CYCLE EXAMPLE B).

PROGRAM NUMBER ÿÿÿ3 - ROUGHING AND FINISHING

PROGRAM - CIRCULAR POCKET - G17ÿ AND G171.The difference between program numbers ÿÿÿ2 andÿÿÿ3 is that program ÿÿÿ3 leaves a finishingallowance on the diameter of the pocket and on thebase.[BILLET X75 Y9ÿ Z3ÿ ;

[EDGEMOVE X-37.5 Y-45 ;

[TOOLDEF T1 D6 Zÿ ;

Oÿÿÿ3 ;

Nÿÿ4ÿ G91 G21 G28 Xÿ Yÿ Zÿ ;

Nÿÿ5ÿ Mÿ6 Tÿ1 ;

Nÿÿ6ÿ G9ÿ Gÿÿ Xÿ Yÿ Z1ÿ S3ÿÿÿ Mÿ3 ;

Nÿÿ7ÿ Gÿ1 Zÿ F3ÿÿ ;

Nÿÿ8ÿ G17ÿ Rÿ Pÿ Q3 Xÿ Yÿ Z-6 Iÿ.5 Jÿ.1 K-24 ;

Nÿÿ9ÿ G171 P75 S3ÿÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ ;

Nÿ1ÿÿ Gÿÿ Z25 Mÿ5 ;

Nÿ11ÿ G91 G28 Xÿ Yÿ Zÿ ;

Nÿ12ÿ M3ÿ ;

Page 73: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 73

G CODES -

G17ÿG171(CIRCULAR POCKET

CANNED

CYCLE EXAMPLE B).

For G17ÿ block,R defines the position of the tool to start cycle ie. ÿ

(surface of job).P defines when P is zero(ÿ) the cycle is a roughing

cycle.Q defines the peck increment, in program number

ÿÿÿ3, 2 pecks each of 3mm.X defines the pocket centre in X axis (ÿ).Y defines the pocket centre in Y axis (ÿ).Z defines the pocket base (-6mm) from job surface.I defines the side finish allowance (leaves a finishing

allowance of ÿ.5).J defines the base finish allowance (leaves a

finishing allowance of ÿ.1).K defines the radius of pocket (-24) negative value -

cut in CCW direction).

For G171 block,P defines the cut width percentage.S defines the roughing spindle speed (S3ÿÿÿ).R defines the roughing Feed in Z (75).F defines the roughing feed XY (25ÿ).B defines the finishing spindle speed (35ÿÿ).J defines the finishing feed (2ÿÿ).

Nÿÿ8ÿ G17ÿ Rÿ Pÿ Q3 Xÿ Yÿ Z-6 Iÿ.5 Jÿ.1 K-24 ;

Nÿÿ9ÿ G171 P75 S3ÿÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ ;

Definitions for the terms used in the G17ÿ and G171circular pocket canned cycle from program numberÿÿÿ3 follows:

Page 74: G and M Programming for Mills Manual

74 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G17ÿG171(CIRCULAR POCKET

CANNED

CYCLE EXAMPLE C).

PROGRAM NUMBER ÿÿÿ4 - ONE STEP FINISHING CYCLE

PROGRAM - CIRCULAR POCKET - G17ÿ AND G171.The difference between program numbers ÿÿÿ3 andÿÿÿ4 is that in program ÿÿÿ4 the tool moves di-rectly to the finish depth and executes a final fin-ishing pass only.[BILLET X75 Y9ÿ Z3ÿ ;

[EDGEMOVE X-37.5 Y-45 ;

[TOOLDEF T1 D6 Zÿ ;

Oÿÿÿ4 ;

Nÿÿ4ÿ G91 G21 G28 Xÿ Yÿ Zÿ ;

Nÿÿ4ÿ Mÿ6 Tÿ1 ;

Nÿÿ4ÿ G9ÿ Gÿÿ Xÿ Yÿ Z1ÿ S3ÿÿÿ Mÿ3 ;

Nÿÿ4ÿ Gÿ1 Zÿ F3ÿÿ ;

Nÿÿ4ÿ G17ÿ Rÿ P1 Q3 Xÿ Yÿ Z-6 Iÿ.5 Jÿ.1 K-24 ;

Nÿÿ4ÿ G171 P75 S3ÿÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ ;

Nÿÿ4ÿ Gÿÿ Z25 Mÿ5 ;

Nÿÿ4ÿ G91 G28 Xÿ Yÿ Zÿ ;

Nÿÿ4ÿ M3ÿ ;

Page 75: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 75

G CODES -

G17ÿG171(CIRCULAR POCKET

CANNED

CYCLE EXAMPLE C).

For G17ÿ block,R defines the position of the tool to start cycle ie. ÿ

(surface of job).P defines when P is 1 (P1) the cycle is a finishing

cycle only.Q is ignored when P=1.X defines the pocket centre in X axis (ÿ).Y defines the pocket centre in Y axis (ÿ).Z defines the pocket base (-6mm) from job surface.I is ignored when P=1.J is ignored when P=1.K defines the radius of pocket (-24) negative value -

cut in CCW direction).

For G171 block,P defines the cut width percentage.S defines the roughing spindle speed (S3ÿÿÿ). An S

value must be entered but is ignored on the fin-ishing cycle.

R defines the roughing Feed in Z (75). An R value mustbe entered but is ignored on the finishing cycle.

F defines the roughing feed XY (25ÿ). An F value mustbe entered but is ignored on the finishing cycle.

B defines the finishing spindle speed.J defines the finishing feed.

Nÿÿ4ÿ G17ÿ Rÿ P1 Q3 Xÿ Yÿ Z-6 Iÿ.5 Jÿ.1 K-24 ;

Nÿÿ4ÿ G171 P75 S3ÿÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ ;

Definitions for the terms used in the G17ÿ and G171circular pocket canned cycle from program numberÿÿÿ4 follows:

NOTE 1.Although characters are ignored by the program whenrun, in certain modes the characters must be pro-grammed and given a value so that the sequential con-trol of the program is maintained and errors avoided.

Page 76: G and M Programming for Mills Manual

76 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G172G173(RECTANGULAR

POCKET CANNED

CYCLE EXAMPLE A).

[BILLET X75 Y9ÿ Z3ÿ ; ...................................................

[EDGEMOVE X-37.5 Y-45 ; ................................................

[TOOLDEF T1 D6 Zÿ ; ......................................................

O ÿÿÿ5 ; .......................................................................

Nÿÿ4ÿ G91 G21 G28 Xÿ Yÿ Zÿ ; ....................................

Nÿÿ5ÿ Mÿ6 Tÿ1 ; .........................................................

Nÿÿ6ÿ Gÿÿ Xÿ Yÿ Z1ÿ S3ÿÿÿ Mÿ3 ; .............................

Nÿÿ7ÿ Gÿ1 Zÿ F3ÿÿ ; ...................................................

Nÿÿ8ÿ G172 I-5ÿ Kÿ Pÿ Q3 Rÿ X-25 Y-25 Z-6 ; ...............

Nÿÿ9ÿ G173 Iÿ Kÿ P75 T1 S3ÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ Z5 ;

Nÿ1ÿÿ Gÿÿ Z25 Mÿ5 ; ..................................................

Nÿ11ÿ G91 G28 Xÿ Yÿ Zÿ ; ...........................................

Nÿ12ÿ M3ÿ ; ................................................................

Billet size.

Position of datum from thebottom LH corner of billet.

Tool no. dia. and position.

Program no.

Metric, reference point.

Tool no.

Absolute, rapid, tool 1ÿmmabove surface, spindlespeed and start.

Tool to surface of job, feedset.

Rectangular pocket cycle.

Rectangular pocket cycle.

Rapid, tool to 25mm abovesurface, spindle stop.

Incremental, return toreference point.

Program reset.

PROGRAM NUMBER ÿÿÿ5 - ROUGHING PROGRAM - RECTANGULAR POCKET - G172 AND G173.

NOTE 1.The absolute zero datum position is set in the offsetfile.

Page 77: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 77

G CODES -

G172G173(RECTANGULAR

POCKET CANNED

CYCLE EXAMPLE A).

For G172 block,I defines the pocket X length (-5ÿ).J defines the pocket Y length (-5ÿ)K defines the radius of corner roundness (not

applicable to Denford software).P defines that ÿ = roughing cycle.Q defines the pocket Z increment (peck increments in

above cycle 2-3mm pecks).R defines the Absolute Z 'R' point.X defines the pocket corner X (Absolute position

relative to the X datum position).Y defines the pocket corner Y (Absolute position

relative to the Y datum position).Z defines the absolute Z base of pocket (-6, ie, a depth

of 6mm).

For G173 block,I defines the pocket side finish (ÿ as this is a

roughing cycle).K defines the pocket base finish (ÿ as this is a rough-

ing cycle).P defines the cut width percentage (75% of tool dia.).T defines the pocket tool (tool 1).S defines the spindle speed for roughing (3ÿÿÿrpm).R defines the roughing feed for Z (75).F defines the roughing feed X and Y (25ÿ).B defines the finishing spindle speed (35ÿÿ rpm).J defines the finishing feed (2ÿÿ).Z defines the safety Z (5mm above 'R' point).

Program number ÿÿÿ5 is for a two cut roughingcycle.

Nÿÿ8ÿ G172 I-5ÿ Kÿ Pÿ Q3 Rÿ X-25 Y-25 Z-6 ;

Nÿÿ9ÿ G173 Iÿ Kÿ P75 T1 S3ÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ Z5 ;

Definitions for the terms used in the G172 and G173rectangular pocket canned cycle from program numberÿÿÿ5 follows:

Page 78: G and M Programming for Mills Manual

78 - G CODES - PREPARATORY FUNCTIONS

For G172 block:

- The I and J are signed according to the direction oftravel +/positive being CW and -/negative beingCCW.

- K must be programmed as ÿ (zero). For Denfordsoftware, the corner radius is the cutter radius.

- X and Y relate to an absolute zero on theworkpiece, ie, the centre of the workpiece. Inprogram number ÿÿÿ5, the zero is set in thecentre of the workpiece so the distance to thebottom LH corner is Y -25 and X -25, as shownbelow.

G CODES -

G172G173(RECTANGULAR

POCKET CANNED

CYCLE EXAMPLE A).

For G173 block:

- If I and K are set to zero (ÿ), the program will per-form the two roughing cuts only (as in the circularpocket canned cycle).

- The tool number (T1) must be programmed.

Page 79: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 79

PROGRAM NUMBER ÿÿÿ6 - ROUGHING AND FINISHING

PROGRAM - RECTANGULAR POCKET - G172 AND G173.

[BILLET X75 Y9ÿ Z3ÿ ;

[EDGEMOVE X-37.5 Y-45 ;

[TOOLDEF T1 D6 Zÿ ;

Oÿÿÿ6 ;

Nÿÿ4ÿ G91 G21 G28 Xÿ Yÿ Zÿ ;

Nÿÿ5ÿ Mÿ6 Tÿ1 ;

Nÿÿ6ÿ G9ÿ Gÿÿ Xÿ Yÿ Z1ÿ S3ÿÿÿ Mÿ3 ;

Nÿÿ7ÿ Gÿ1 Zÿ F3ÿÿ ;

Nÿÿ8ÿ G172 I-5ÿ J-5ÿ Kÿ Pÿ Q3 Rÿ X-25 Y-25 Z-6 ;

Nÿÿ9ÿ G173 Iÿ.5 Kÿ.1 P75 T1 S3ÿÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ Z5 ;

Nÿ1ÿÿ Gÿÿ Z25 Mÿ5 ;

Nÿ11ÿ G91 G28 Xÿ Yÿ Zÿ ;

Nÿ12ÿ M3ÿ ;

G CODES -

G172G173(RECTANGULAR

POCKET CANNED

CYCLE EXAMPLE B).

Page 80: G and M Programming for Mills Manual

80 - G CODES - PREPARATORY FUNCTIONS

For G172 block,I defines the pocket X length (-5ÿ).J defines the pocket Y length (-5ÿ)K defines the radius of corner roundness (not

applicable to Denford software).P defines that ÿ = roughing cycle.Q defines the pocket Z increment (peck increments in

above cycle 2-3mm pecks).R defines the Absolute Z 'R' point.X defines the pocket corner X (Absolute position

relative to the X datum position).Y defines the pocket corner Y (Absolute position

relative to the Y datum position).Z defines the absolute Z base of pocket (-6, ie, a depth

of 6mm).

For G173 block,I defines the pocket side finish (ÿ.5 finishing al-

lowance) on the finishing pass.K defines the pocket base finish (ÿ.1 finishing

allowance) on the finishing pass.P defines the cut width percentage (75% of tool dia.).T defines the pocket tool (tool 1).S defines the spindle speed for roughing (3ÿÿÿrpm).R defines the roughing feed for Z (75).F defines the roughing feed X and Y (25ÿ).B defines the finishing spindle speed (35ÿÿ rpm).J defines the finishing feed (2ÿÿ).Z defines the safety Z (5mm above 'R' point).

When values are stated for the I and K elements, theprogram will perform a finishing pass after com-pletion of the final roughing cut.

Definitions for the terms used in the G172 and G173rectangular pocket canned cycle from program numberÿÿÿ6 follows:

G CODES -

G172G173(RECTANGULAR

POCKET CANNED

CYCLE EXAMPLE B).

Nÿÿ8ÿ G172 I-5ÿ J-5ÿ Kÿ Pÿ Q3 Rÿ X-25 Y-25 Z-6 ;

Nÿÿ9ÿ G173 Iÿ.5 Kÿ.1 P75 T1 S3ÿÿÿ R75 F25ÿ B35ÿÿ J2ÿÿ Z5 ;

Page 81: G and M Programming for Mills Manual

G CODES - PREPARATORY FUNCTIONS - 81

PROGRAM NUMBER ÿÿÿ7 - ONE STEP FINISHING CYCLE

PROGRAM - RECTANGULAR POCKET - G172 AND G173.

[BILLET X75 Y90 Z30 ;

[EDGEMOVE X-37.5 Y-45 ;

[TOOLDEF T1 D6 Z0 ;

O0007 ;

Nÿÿ4ÿ G91 G21 G28 X0 Y0 Z0 ;

Nÿÿ4ÿ M06 T01 ;

Nÿÿ4ÿ G90 G00 X0 Y0 Z10 S3000 M03 ;

Nÿÿ4ÿ G01 Z0 F300 ;

Nÿÿ4ÿ G172 I-50 J-50 K0 P1 Q3 R0 X-25 Y-25 Z-6 ;

Nÿÿ4ÿ G173 I0.5 K0.1 P75 T1 S3000 R75 F250 B3500 J200 Z5 ;

Nÿÿ4ÿ G00 Z25 M05 ;

Nÿÿ4ÿ G91 G28 X0 Y0 Z0 ;

Nÿÿ4ÿ M30 ;

G CODES -

G172G173(RECTANGULAR

POCKET CANNED

CYCLE EXAMPLE C).

Page 82: G and M Programming for Mills Manual

82 - G CODES - PREPARATORY FUNCTIONS

G CODES -

G172G173(RECTANGULAR

POCKET CANNED

CYCLE EXAMPLE C).

For G172 block,I defines the pocket X length (-5ÿ).J defines the pocket Y length (-5ÿ)K defines the radius of corner roundness (not

applicable to Denford software).P defines that 1 = finishing cycle only.Q defines the pocket Z increment (peck increments in

above cycle 2-3mm pecks). This is ignored for aone step finishing cycle.

R defines the Absolute Z 'R' point.X defines the pocket corner X (pocket length).Y defines the pocket corner Y (pocket width).Z defines the absolute Z base of pocket (-6, ie, a depth

of 6mm).

For G173 block,I defines the pocket side finish allowance. This is ig-

nored for a one step finishing cycle.K defines the pocket base finish allowance. This is

ignored for a one step finishing cycle.P defines the cut width percentage (75% of tool dia.).T defines the pocket tool (tool 1).S defines the spindle speed for roughing. An S value

must be entered but is ignored on the finishing cycle.R defines the roughing feed for Z. An R value must be

entered but is ignored on the finishing cycle.F defines the roughing feed X and Y. An F value must

be entered but is ignored on the finishing cycle.B defines the finishing spindle speed (35ÿÿ rpm).J defines the finishing feed (2ÿÿ).Z defines the safety Z (5mm above 'R' point).

Definitions for the terms used in the G172 and G173rectangular pocket canned cycle from program numberÿÿÿ7 follows:

Nÿÿ4ÿ G172 I-50 J-50 K0 P1 Q3 R0 X-25 Y-25 Z-6 ;

Nÿÿ4ÿ G173 I0.5 K0.1 P75 T1 S3000 R75 F250 B3500 J200 Z5 ;

NOTE 1.Although characters are ignored by the program whenrun, in certain modes the characters must be pro-grammed and given a value so that the sequential con-trol of the program is maintained and errors avoided.

Page 83: G and M Programming for Mills Manual

M CODES - MISCELLANEOUS FUNCTIONS - 83

M CODES

(MISCELLANEOUS

FUNCTIONS) -INTRODUCTION.

Miscellaneous functions, called M codes, are used bythe CNC to command on/off signals to the machinefunctions. ie, Mÿ3 - spindle forward (CW), Mÿ5 -spindle stop, etc.....

The functions allocated to lower M code numbers areconstant in most CNC controls, although the higherM code number functions can vary from one make ofcontroller to the next.

An M code is defined using the M address letter and atwo digit number as follows,

M ÿÿ

Address. Two digit number.

Page 84: G and M Programming for Mills Manual

84 - M CODES - MISCELLANEOUS FUNCTIONS

LIST OF

M CODES

SUPPORTED BY

DENFORD CNCCONTROLS.

Note - Not all M codes apply to each machine.

M code. Function.

Mÿÿ* Program Stop

Mÿ1* Optional Stop

Mÿ2* Program Reset

Mÿ3 Spindle Forward (clockwise)

Mÿ4 Spindle Reverse (counter clockwise)

Mÿ5* Spindle Stop

Mÿ6 Automatic Tool Change

Mÿ8 Coolant On

Mÿ9* Coolant Off

M1ÿ Vice/Work Clamp Open

M11 Vice/Work Clamp Close

M13 Spindle Forward and Coolant On

M14 Spindle Reverse and Coolant On

M19 Spindle Orientation

M2ÿ ATC Arm In

M21 ATC Arm Out

M22 ATC Arm Down

M23 ATC Arm Up

M24 ATC Drawbar Unclamp

M25 ATC Drawbar Clamp

M27 Reset Carousel to Pocket One

M3ÿ* Program Reset and Rewind

M32 Carousel CW

M33 Carousel CCW

M38 Door Open

M39 Door Close

M62 Auxiliary Output 1 On

M63 Auxiliary Output 2 On

Page 85: G and M Programming for Mills Manual

M CODES - MISCELLANEOUS FUNCTIONS - 85

continued....

M code. Function.

M64 Auxiliary Output 1 Off

M65 Auxiliary Output 2 Off

M66* Wait for Auxiliary Output 1 On

M67* Wait for Auxiliary Output 2 On

M7ÿ Mirror in X On

M71 Mirror in Y On

M76 Wait for Auxiliary Output 1 Off

M77 Wait for Auxiliary Output 2 Off

M8ÿ Mirror in X Off

M81 Mirror in Y Off

M98 Sub Program Call

M99 Sub Program End and Return

Code listing full and correct at the time of printing.

NOTES FOR MCODES LISTING

SHOWN LEFT.

NOTE 1.M codes marked with an * are executed at the end ofa block, ie, after axis movement.

NOTE 2.Only one M code can be programmed within eachblock. If more than one M code is programmed, themachine controller will only perform the last stated Mcode.

NOTE 3.The M codes listed between M19 to M27 inclusiveand M32 to M33 inclusive are used for maintenanceonly. They are entered through the MDI panel on themachine tool and do not appear in a CNC partprogram.

LIST OF

M CODES

SUPPORTED BY

DENFORD CNCCONTROLS.

Page 86: G and M Programming for Mills Manual

86 - M CODES - MISCELLANEOUS FUNCTIONS

M CODES -

Mÿÿ(PROGRAM STOP).

Mÿ2* - Program Reset.

This code indicates the end of a program andperforms a general reset function on the machinecontroller, ie, the CNC reverts to its initial state. Thecode also acts as an Mÿ5.

Mÿ1* - Optional Stop.

The Mÿ1 code performs the same function as the Mÿÿcode, except the machine controller only recognisesthe signal to halt the program if the optional [STOP]input key is activated.

Mÿÿ* - Program Stop.

When the machine controller reads the code Mÿÿwithin a block, it halts the program. The [CYCLESTART] key must be pressed to allow the program tocontinue.

M CODES -

Mÿ1(OPTIONAL STOP).

M CODES -

Mÿ2(PROGRAM RESET).

Page 87: G and M Programming for Mills Manual

M CODES - MISCELLANEOUS FUNCTIONS - 87

Mÿ3 - Spindle Forward (Clockwise).

The clockwise direction of the spindle is determinedby viewing from the back of the machine headstock,along the Z axis towards the tailstock.

The spindle start command is activated at thebeginning of the block in which it is programmed, ie,before any axis movement occurs.

Mÿ4 - Spindle Reverse (Counter Clockwise).

An Mÿ4 code acts in the same way as an Mÿ3 code,only the spindle rotates in the opposite direction.

Mÿ5* - Spindle Stop.

The Mÿ5 code, to stop the spindle rotating, isactivated at the end of the block in which it isprogrammed, ie , after any axis movement.

M CODES -

Mÿ3(SPINDLE FORWARD).

M CODES -

Mÿ4(SPINDLE REVERSE).

M CODES -

Mÿ5(SPINDLE STOP).

Page 88: G and M Programming for Mills Manual

88 - M CODES - MISCELLANEOUS FUNCTIONS

Mÿ8 - Coolant On.

This code switches the coolant pump on.

Mÿ9* - Coolant Off.

This code switches the coolant pump off.

Mÿ6 - Automatic Tool Change.

This code activates the machine turret and is followedby the code T_ _ _ _, instructing it to move to thestated tool number.

For example :

Mÿ6 Tÿ3ÿ3 ;

This command is read change automatically from thecurrent tool number to tool number 3.

M CODES -

Mÿ6(AUTOMATIC

TOOL CHANGE).

M CODES -

Mÿ8(COOLANT ON).

M CODES -

Mÿ9(COOLANT OFF).

Page 89: G and M Programming for Mills Manual

M CODES - MISCELLANEOUS FUNCTIONS - 89

M CODES -

M1ÿ(VICE OPEN).

M1ÿ - Vice/Work Clamp Open.

This code will open the jaws of a power vice.

M11 - Vice/Work Clamp Close.

This code will close the jaws of a power vice.

M13 - Spindle Forward and Coolant On.

This code combines the functions of Mÿ3 and Mÿ8together. The Mÿ5 code will stop both the spindle andcoolant.

M CODES -

M11(VICE CLOSE).

M CODES -

M13(SPINDLE FORWARD

AND COOLANT ON).

Page 90: G and M Programming for Mills Manual

90 - M CODES - MISCELLANEOUS FUNCTIONS

M CODES -

M2ÿ(ATC ARM IN).

M CODES -

M14(SPINDLE REVERSE

AND COOLANT ON).

M CODES -

M19(SPINDLE

ORIENTATION).

M14 - Spindle Reverse and Coolant On.

This code performs the same function as M13 but thespindle rotates in the opposite direction.

M19 - Spindle Orientation.

This code will orientate the machine spindle - see yourmachine specification.

M2ÿ - ATC Arm In.

This code moves the Automatic Tool Changer arm in(beneath the spindle).

Page 91: G and M Programming for Mills Manual

M CODES - MISCELLANEOUS FUNCTIONS - 91

M CODES -

M21(ATC ARM OUT).

M CODES -

M22(ATC ARM

DOWN).

M21 - ATC Arm Out.

This code moves the Automatic Tool Changer armout (away from the spindle).

M22 - ATC Arm Down.

This code moves the Automatic Tool Changer in adownwards direction.

M CODES -

M23(ATC ARM UP).

M23 - ATC Arm Up.

This code moves the Automatic Tool Changer in anupwards direction.

Page 92: G and M Programming for Mills Manual

92 - M CODES - MISCELLANEOUS FUNCTIONS

M CODES -

M27(RESET CAROUSEL

TO POCKET ONE).

M27 - Reset to Carousel Pocket One.

This code is used to reset the carousel back toposition one.

M CODES -

M24(ATC DRAWBAR

UNCLAMP).

M CODES -

M25(ATC DRAWBAR

CLAMP).

M24 - ATC Drawbar Unclamp.

This code unclamps the tool collet currently held in thespindle.

M24 - ATC Drawbar Clamp.

This code clamps a tool collet in the spindle.

Page 93: G and M Programming for Mills Manual

M CODES - MISCELLANEOUS FUNCTIONS - 93

M CODES -

M3ÿ(PROGRAM RESET

AND REWIND).

M CODES -

M32(CAROUSEL CW).

M CODES -

M33(CAROUSEL CCW).

M3ÿ* - Program Stop and Rewind.

This code stops the program running, ie, it signals theend of the program. Control is then reset back to thebeginning of this program.

If the M3ÿ code is followed by a block number, theprogram will be reset back to the stated block number.

For example :

M3ÿ Pÿ14ÿ ;

This command is read stop the program running andreset it back to block number 18ÿ.

The M3ÿ code also acts as an Mÿ5 and Mÿ9.

M32 - Carousel CW.

This code is used to rotate the carousel in a clockwisedirection (viewed in plan view).

M33 - Carousel CCW.

This code is used to rotate the carousel in a counterclockwise direction (viewed in plan view).

Page 94: G and M Programming for Mills Manual

94 - M CODES - MISCELLANEOUS FUNCTIONS

M CODES -

M38(DOOR OPEN).

M CODES -

M39(DOOR CLOSE).

M38 - Door Open.

This code opens the machine door.

M39 - Door Close.

This code closes the machine door.

Page 95: G and M Programming for Mills Manual

M CODES - MISCELLANEOUS FUNCTIONS - 95

M CODES - M62 - Auxiliary Output 1 On.

M63 - Auxiliary Output 2 On.

M64 - Auxiliary Output 1 Off.

M65 - Auxiliary Output 2 Off.

M66* - Wait for Auxiliary Output 1 On.

M67* - Wait for Auxiliary Output 2 On.

M76 - Wait for Auxiliary Output 1 Off.

M77 - Wait for Auxiliary Output 2 Off.

These codes allow a signal to be sent from themachine controller to a different device, such as arobot, then wait for a return signal instructing thatthe device has completed its function.

M62M63M64M65M66M67M76M77(AUXILIARY OUTPUT

FUNCTIONS).

Page 96: G and M Programming for Mills Manual

96 - M CODES - MISCELLANEOUS FUNCTIONS

M CODES -

M7ÿ(MIRROR IN

X ON).

M CODES -

M71(MIRROR IN

Y ON).

M CODES -

M8ÿ(MIRROR IN

X OFF).

M7ÿ - Mirror in X On.

This code changes the sign of X within a programaround the datum.

For example:

Gÿ1 X25.5 ;M7ÿGÿ1 X25.5 ; (Tool would move to X-25.5).

M71 - Mirror in Y On.

This code performs the same function as G7ÿ, butaffects the Y axis.

M8ÿ - Mirror in X Off.

This code cancels the mirror image in the X axis.

Page 97: G and M Programming for Mills Manual

M CODES - MISCELLANEOUS FUNCTIONS - 97

M CODES -

M98(SUB PROGRAM

CALL).

M CODES -

M99(SUB PROGRAM

END AND

RETURN).

M98 - Sub Program Call.

This code will cause the machine controller to jumpacross from the main program to read a differentprogram in its memeory (called a sub program).

M99 - Sub Program End and Return.

On the last line of a sub program, the code M99 isentered. This reverts control back to the mainprogram.

If an M99 code is programmed at the end of a mainprogram, a continuous loop will be established.

If an M99 code is followed by a block number,P_ _ _ _ , control will return to the program line withthe same number as stated in P_ _ _ _.

M CODES -

M81(MIRROR IN YOFF).

M81 - Mirror in Y Off.

This code cancels the mirror image in the Y axis.

Page 98: G and M Programming for Mills Manual

98 - M CODES - MISCELLANEOUS FUNCTIONS