CNC-ACADEMY CNC PROGRAMMING · This CNC programming course is aimed at tool machine users, CNC...

136
CNC-ACADEMY ® CNC PROGRAMMING SECRETS REVEALED About the Author ”Ross’s success within CNC engineering related pr ofessions is positive proof that anyone who decide and follow the instructions from this E book, can do so.” Bryan Ferguson, AMB “Author holds a degree in CNC Engineering and have been proudly working with CNC programming, operating, setting and supervising CNC teams for decades. He is bringing directly real world of International CNC machining experience into his courses. This is not just another theoretic E-book, it is rather book written on basis of many years of real CNC experience from machining of metal, plastics, seal manufacturing… and managing CNC programming teams in automotive mass production environments. It makes his courses so popular. If you work around CNC machines, you will find this course very useful and will help you to get comfortable very quickly with real problems in everyday programming and practical applications. Ross’s courses are available on www.cnc-academy.com - and you are able to order or download it from the comfort of your own home or office!“CNC Machining News”

Transcript of CNC-ACADEMY CNC PROGRAMMING · This CNC programming course is aimed at tool machine users, CNC...

CNC-ACADEMY

CNC PROGRAMMING SECRETS REVEALED

About the Author

Rosss success within CNC engineering related professions is positive proof that anyone who decide and follow the instructions from this E book, can do so.

Bryan Ferguson, AMB

Author holds a degree in CNC Engineering and have been proudly working with

CNC programming, operating, setting and supervising CNC teams for decades. He

is bringing directly real world of International CNC machining experience into his

courses. This is not just another theoretic E-book, it is rather book written on

basis of many years of real CNC experience from machining of metal, plastics,

seal manufacturing and managing CNC programming teams in automotive mass

production environments. It makes his courses so popular. If you work around

CNC machines, you will find this course very useful and will help you to get

comfortable very quickly with real problems in everyday programming and

practical applications. Rosss courses are available on www.cnc-academy.com -

and you are able to order or download it from the comfort of your own home or

office!

CNC Machining News

http://www.cnc-academy.com/

2

Thank you and congratulations! Thank You for buying the CNC Programming-Secrets revealed CNC Course, and

congratulations, for taking a positive step towards your future as an CNC

Programmer, CNC Setter, CNC Operator...

The purpose of this E book is to show and teach how you can use newest CNC

technology tools to improve productivity, efficiency, and at the same time to

improve your life. We are in an Information age and when people want

information about new technology, they want it RIGHT NOW. So this is an easy

and affordable way to achieve your goals with lower costs and shorter time to

develop required skills. This is one of the most recession-proof jobs in the

industry today. Highly skilled computer numerical control personnel can expect to

earn an excellent salary.

PROGRAMMING COURSE OUTLINE: Prerequisites.....4

INTRODUCTION..4

THE BASICS OF CNC............6 What is CNC............6 History before CNC...6

How CNC works...6

Motion control & axes..7

The CNC program.....7

The CNC control..............7

What is the CAM system...7

What is DNC system...........8

Types of CNC machines.......8 1. KNOW YOUR MACHINE.........9 Having basic machining practise....................9 Learning about new CNC machine....10

Machine components and configuration................10

Some of important machine capacity facts you should know......11

Programmable functions and accessories on machine.........11 Spindle control, S function12 Automatic tool changer (ATC) on m/c or turret on turning centres, T function.......12 Coolant control....................................12 Automatic pallet changer (APC) on machining centres.12

Other accessories to the machine................12 Directions of motion (axes) and fundamental geometrical principles..13

Home position (Reference point) for each axis....13

2. FLOW OF THE CNC PROCESS..13

3. CNC PROGRAMMING ....14 Coordinate systems,.14 Plane designation,....16

Machine coordinate system,..17

Part coordinate system..19

Setting m/c coordinate system,.................20

Direction of motion (axes),.21

Workpiece coordinate system,.22

Definition of workpiece position,23

3

Polar coordinates,.24

Motion types,.25

G - codes (preparatory function),..25 M - codes (miscellaneous function),..28

Absolute command (G90),...30

Incremental command (G91),.31

Understanding of interpolation,..32

Rapid motion (G00),......................33

Linear interpolation - Feeding (G01),..33

Feed rate (F function),..33

Circular interpolation - circular motion (G02 and G03),33

Difference between R & I,J,K..35

Other interpolation types, ...37

Program zero, workpiece zero positions of zero points,..39

Z axis zero..........................40

Metric/Imperial dimensions G70, G71, G700, G710,..40

4. TOOL OFFSETS40 What are offsets,40 Why we need offsets40

Organizing offsets..41

Types of compensation,...41

Tool length compensation) - G43 (machining centres),.42

Tool offset measuring sample..44

How to consider tool length compensation.45

Cutter radius compensation G40-G42 (machining centres), .46

Reasons for cutter radius compensation,.46

How to program cutter radius compensation, example,.47

Setting tool offsets49

Dimensional tool (wear) offsets,51

Tool nose radius compensation,.51

Other types of compensation...52

5. LANGUAGE ELEMENTS OF PROGRAMMING LANGUAGE..53 Address, Data, Word, Block, Sequence, Program ,..53 Types of programs.54

6. PROGRAM FORMATING...55 Reasons to format CNC programs 55 Types of program format (program start-up, tool ending, tool start-up, and

program ending),..55

Program configuration, structure and contents of an CNC program,..56

7. LETS START WRITING CNC PROGRAMS.57 Prepare the work piece drawing,..57 Steps to prepare (mark up print, machining process, calculate coordinates,

select tooling, plan setup), 57

Define machining sequences,..57

Create a machining plan,.57

Translate the work steps into the machining language,.58

Combine all individual steps in a program,..58

Simple programming examples,.60

Program sample for circular arc.61

Program sample for machining a groove,..63

CNC programs with three types of motion,..63

Typical mistakes....65

CNC program examples...66

8. SPECIAL PROGRAMMING FEATURES..83 Canned cycles,.85 G73 G89..87

4

Grinding cycles..110

Constant surface speed control...115

Probe tips...117

Geometric dimensioning an tolerancing....118

After Word...122

Prerequisites We assume students enrolling in these classes currently possess certain basic

machining practice skills, including the ability to read and interpret drawings, the

ability to interpret tolerances, the ability to use shop tools and measuring

devices, and the ability to perform arithmetic calculations.

Target group This CNC programming course is aimed at tool machine users, CNC beginners,

skilled machine operators with the appropriate expertise in drilling, milling and

turning operations. It contains all the necessary information on how to successfully make CNC programs for lathes and machining centres. Theoretic part

of the course is particularly helpful for NC beginners. Fanuc is the control of

choice in most shops in the World today we will learn their system and you will

have the best chance for a good job. That knowledge can be easily applied on

other CNC controls like Siemens, Heidenhain, Fadal

However, we have our advanced macro programming course which is intended

for technicians with in-depth, comprehensive macro programming knowledge.

Introduction

There is quite a shortage of skilled people to utilize CNC machines, more

and more skilled machinists jobs, require CNC knowledge. And the shortage

worldwide is growing. Everywhere we can hear manufacturing people claiming

that they cannot find skilled people. So you can make a good wage and develop

a rewarding career working with CNC machines. So, learn the skills you need for

a better paying job.

Here are some of the job titles of people working with CNC machine tools and job

opportunities related to CNC:

With knowing CNC you will be able to work for manufacturing companies

as:

CNC helping hands

CNC tool setters

CNC operators

CNC setup people

5

CNC programmers

CAD-CAM system programmers

CNC maintenance personnel working for companies that sell CNC machines

CNC service technicians

CNC applications engineers

CNC school instructors

CNC instructors

Everybody involved in the manufacturing environment should be well aware of

what is possible with these sophisticated machine tools. The design engineer, for

example, must possess enough knowledge of CNC to perfect dimensioning and

tolerancing techniques for workpieces to be machined on CNC machines. The tool

engineer must understand CNC in order to design fixtures and cutting tools for

use with CNC machines. Quality control people should understand the CNC

machine tools used within their company in order to plan quality control and

statistical process control accordingly. Production control personnel should be abreast of their company's CNC technology in order to make realistic production

schedules. Managers, foremen, and team leaders should understand CNC well

enough to communicate intelligently with fellow workers. And, it goes without

saying that CNC programmers, setup people, operators, and others working

directly with the CNC equipment must have an extremely good understanding of

CNC.

In this presentation, we will explore the basics to advanced features CNC,

showing you much of what is involved with using these sophisticated machine

tools. Our primary goal will be to teach you how to learn about CNC. For readers

who will eventually be working directly with CNC machine tools, we will show you

the basics of each major CNC function. Additionally, we will make suggestions as

to how you can learn more about each CNC function as it applies to your

particular CNC machine/s. At the completion of this presentation, you should

have a good understanding of how and why CNC functions as it does and know

those things you must learn more about in order to work with any style of CNC

machine tool.

For readers who are not going to be working directly with CNC equipment in the

near future, our secondary goal will be to give you a good workmanship and

knowledge of CNC technology. At the completion of this presentation, you should

be quite comfortable with the fundamentals of CNC and be able to communicate

intelligently with others in your company about your CNC machine tools.

To proceed in an organized manner, we will be using only verified concept

approach to all presentations. If you can understand basic principles, you are

well on your way to becoming proficient with CNC. While our main focus will be

for the two most popular forms of CNC machine tools (machining centres and

turning centres), these key concepts can be applied to virtually any kind of CNC

machine, making it easy to adapt to any form of CNC equipment. With so many

types of CNC machine tools in existence, it is next to impossible for this

presentation to be extremely specific about any one particular type. The key

concepts allow us to view the main features of CNC in more general terms,

stressing why things are handled the way they are even more than the specific

techniques used with any one particular CNC machine tool.

With the broad background we give, you should be able to easily zero in on any

kind of CNC machine tool you will be working with. Practise reinforces a

student's understanding of learned information. As yet a third goal, this

presentation should help instructors of CNC. The approach we show has been

proven time and time again. This method of presentation will help students to

organize CNC course information logically and easy to understand all lessons.

This course curriculum assumes a comprehensive set of parallel practice

exercises.

6

The Basics of Computer Numerical Control

WHAT IS CNC?

CNC meaning: Computer Numerical Control and has been around since the early

1970's. Prior to this, it was called NC, for Numerical Control. (At the beginning

1970's computers were introduced to these controls, hence the name change.)

While people in most walks of life have never heard of this term, CNC is widely

used in almost every form of manufacturing process in one way or another. If

you'll be working in manufacturing, it's likely that you'll be dealing with CNC on a

regular everyday basis.

History before CNC?

While there are exceptions to this statement, CNC machines typically replace (or

work together with) some existing manufacturing process/as. Take one of the

simplest manufacturing processes, drilling holes, for example.

A drill press can of course be used to machine holes. (It's likely that almost

everyone has seen some form of drill, even if you don't work in manufacturing.) A

person can place a drill in the drill chuck that is secured in the spindle of the drill

press. They can then (manually) select the desired speed for rotation (commonly

by switching belt pulleys), and activate the spindle. Then they manually pull on

the quill lever to drive the drill into the workpiece being machined.

As you can easily see, there is a lot of manual intervention required to use a drill

press to drill holes. A person is required to do something almost every step along

the way! While this manual application may be acceptable for manufacturing

companies if but a small number of holes or workpieces must be machined, as

quantities grow, so does the likelihood for fatigue due to the repetitiveness of the

operation. And do note that we've used one of the simplest machining operations

(drilling) for our example. There are more complicated machining operations that

would require a much higher skill level (and increase the potential for mistakes

resulting in scrap workpieces) of the person running the conventional machine

tool. (We commonly refer to the style of machine that CNC is replacing as the

conventional machine.)

By comparison, the CNC equivalent for a drill press (possibly a CNC machining

centre or CNC drilling & tapping centre) can be programmed to perform this

operation in a much more automatic fashion. Everything that the drill press

operator was doing manually will now be done by the CNC machine, including:

placing the drill in the spindle, activating the spindle, positioning the workpiece

under the drill, machining the hole, and turning off the spindle.

How CNC works?

We have another Course available on Internet that explains how to program,

setup, and operate CNC machines in greater detail. Additionally, we offer a series

of products aimed at helping you learn how to properly use CNC machines. Here

we're relating how CNC works in very general terms.

As you already have some experience with different machinery you can guess

that everything that an operator would be required to do with conventional

machine tools is programmable with CNC machines. Once the machine is set

up and running, a CNC machine is quite simple to keep running, and it is

an easy job for somebody who previously worked hard on conventional

machines. In fact CNC operators tend to get quite bored during lengthy

production runs because there is so little to do. With some CNC machines,

even the workpiece loading process has been automated. CNC operators are

commonly required to do other things related to the CNC operation like

measuring workpieces and making adjustments to keep the CNC machine running

good quality workpieces.)

Let's look at some of the specific programmable functions.

Motion control and axes

7

All CNC machine types and CNC controls share this commonality: They all have

two or more programmable directions of motion called axes. An axis of motion

can be linear (along a straight line) or rotary (along a circular path). One of the

first specifications that imply a CNC machine's complexity is how many axes it

has. Generally speaking, the more axes, the more complex the machine.

The axes of any CNC machine are required for the purpose of causing the motions

needed for the manufacturing process. In the drilling example, these (3) axis

would position the tool over the hole to be machined (in two axes) and machine

the hole (with the third axis). Axes are named with letters. Common linear axis

names are X, Y, and Z. Common rotary axis names are A, B, and C.

The CNC program

Think of giving any series of step-by-step instructions. A CNC program is nothing

more than another kind of instruction set. It's written in sentence-like format and

the control will execute it in sequential order, step by step.

A special series of CNC commands are used to communicate what the machine is

intended to do. CNC words begin with letter addresses (like F for feedrate, S for spindle speed, and X, Y & Z for axis motion). When placed together in a logical

method, a group of CNC words make up a command that resemble a sentence.

For any given CNC machine type, there will only be about 40-50 words used on a

regular basis. So if you compare learning to write CNC programs to learning a

foreign language having only 50 words, it shouldn't seem overly difficult to learn

CNC programming.

The CNC control

The CNC control will interpret a CNC program and activate the series of

commands in sequential order. As it reads the program, the CNC control will

activate the appropriate machine functions, cause axis motion, and in general,

follow the instructions given in the program.

Along with interpreting the CNC program, the CNC control has several other

purposes. All current model CNC controls allow programs to be modified (edited)

if mistakes are found. The CNC control allows special verification functions (like

dry run) to confirm the correctness of the CNC program. The CNC control allows

certain important operator inputs to be specified separate from the program, like

tool length values. In general, the CNC control allows all functions of the machine

to be manipulated.

CNC controls like Fanuc, Siemens, Heidenhain, Matsura, Mitsubishi, Mazak, Fadal,

Okuma basically doing the same thing.

What is a CAM system?

For simple applications (like drilling holes), the CNC program can be developed

manually. That is, a programmer will sit down to write the program armed only

with pencil, paper, and calculator. Again, for simple applications, this may be the

very best way to develop CNC programs.

As applications get more complicated, and especially when new programs are

required on a regular basis, writing programs manually becomes much more

difficult. To simplify the programming process, a computer aided manufacturing

(CAM) system can be used. A CAM system is a software program that runs on a

computer (commonly a PC) that helps the CNC programmer with the

programming process. Generally speaking, a CAM system will take over most of

lengthy programming process.

In many companies the CAM system will work with the computer aided design

(CAD) drawing developed by the company's design engineering department. This

eliminates the need for redefining the workpiece configuration to the CAM

system. The CNC programmer will simply specify the machining operations to be

performed and the CAM system will create the CNC program (much like the

manual programmer would have written) automatically.

What is a DNC system?

8

Once the program is developed (either manually or with a CAM system), it must

be loaded into the CNC control. Though the setup person could type the program

right into the control, this would be like using the CNC machine as a very

expensive typewriter. If the CNC program is developed with the help of a CAM

system, then it is already in the form of a text file. If the program is written

manually, it can be typed into any computer using a common word processor

(though most companies use a special CNC text editor for this purpose). Either

way, the program is in the form of a text file that can be transferred right into the

CNC machine. A distributive numerical control (DNC) system is used for this

purpose.

A DNC system is nothing more than a computer that is networked with one or

more CNC machines. Until only recently, rather crude serial communications

protocol (RS-232c) had to be used for transferring programs. Newer controls

have more current communications capabilities and can be networked in more

conventional ways (Ethernet, etc.). Regardless of methods, the CNC program

must of course be loaded into the CNC machine before it can be run.

Types of CNC machines

As we said before, CNC has touched almost every segment of manufacturing.

Many machining processes have been improved and enhanced through the use of

CNC. Let's look at some of the specific fields and place the emphasis on the

manufacturing processes enhanced by CNC machine usage:

In the metal removal industry:

Machining processes that have traditionally been done on conventional machine

tools that are possible (and in some cases improved) with CNC machining centres

include all kinds of milling (face milling, contour milling, slot milling, etc.), drilling,

tapping, reaming, boring, grinding and counter boring.

In similar fashion, all kinds of turning operations like facing, boring, turning,

grooving, grinding, and threading are done on CNC turning centres.

There are all kinds of special "off-shoots" of these two machine types including

CNC milling machines, CNC drill and tap centres, and CNC lathes.

Grinding operations of all kinds like outside diameter (OD) grinding and internal

diameter (ID) grinding are also being done on CNC grinders. CNC has even

opened up a new technology when it comes to grinding. Contour grinding

(grinding a contour in a similar fashion to turning), which was previously

infeasible due to technology constraints is now possible (almost commonplace)

with CNC grinders.

In the metal fabrication industry:

In manufacturing terms, fabrication commonly refers to operations that are

performed on relatively thin plates. For example take cisterns... All of the primary

components are made of steel sheets. These sheets are sheared to size, holes are

punched in appropriate places, and the sheets are bent (formed) to their final

shapes. Again, operations commonly described as fabrication operations include

shearing, flame or plasma cutting, punching, laser cutting, forming, and welding.

Truly, CNC is heavily involved in almost every facet of fabrication.

CNC back gages are commonly used with shearing machines to control the length

of the plate being sheared. CNC lasers and CNC plasma cutters are also used to

bring plates to their final shapes. CNC turret punch presses can hold a variety of

punch-and-die combinations and punch holes in all shapes and sizes through

plates. CNC press brakes are used to bend the plates into their final shapes.

In the electrical discharge machining industry:

Electrical discharge machining (EDM) is the process of removing metal through

the use of electrical sparks which burn away the metal. CNC EDM comes in two

forms, vertical EDM and Wire EDM. Vertical EDM requires the use of an electrode

(commonly machined on a CNC machining centre) that is of the shape of the

cavity to be machined into the workpiece. Picture the shape of a plastic bottle

that must be machined into a mould. Wire EDM is commonly used to make punch

and die combinations for dies sets used in the fabrication industry. EDM is one of

9

the less known CNC operations because it is so closely related to making tooling

used with other manufacturing processes.

In the woodworking industry

As in the metal removal industry, CNC machines are heavily used in woodworking

shops. Operations include routing (similar to milling) and drilling. Many

woodworking machining centres are available that can hold several tools and

perform several operations on the workpiece being machined.

Other types of CNC machines

Many forms of lettering and engraving systems use CNC technology. Water jet

machining uses a high pressure water jet stream to cut through plates of

material. CNC is even used in the manufacturing of many electrical components.

For example, there are CNC coil winders, and CNC terminal location and soldering

machines.

Basic to advanced CNC programming course (machining centre and turning

centre)

The scope for this course is limited to G code level, manual programming. While

there are other programming methods (primarily computer aided manufacturing

[CAM] system programming), most experts in the field will agree that an

understanding of manual programming is of paramount importance to any CNC

programmer. And it is best to first learn about certain CNC features (like program

zero, motion types, compensation, among many others) at G code level. Trying to

learn the numerous CNC features while also attempting to learn a complex CAM

system can be difficult and confusing - in some cases impossible!

1. KNOW YOUR MACHINE A CNC user MUST understand the makeup of the CNC machine tool being utilized.

While this may sound like a basic statement, a CNC user must be able to view the

machine from two distinctly different perspectives. Here are key concepts we will

be viewing the machine from a programmer's perspective. Much later, in this

course , we will look at the machine from an operator's viewpoint.

Having basic machining practice is essential to success with any CNC

machine

Many forms of CNC machines are designed to enhance or replace what is

currently being done with more conventional machines. The first goal of any CNC

beginner should be to understand the basic machining practice that goes into

using the CNC machine tool. The more the beginning CNC user knows about basic

machining practice, the easier it will be to adapt to CNC.

Think of it this way. If you already know basic machining practice as it relates to

the CNC machine you will be working with, you already know what it is you want

the machine to do. It will be a relatively simple matter of learning how to tell the

CNC machine what it is you want it to do (learning to program). This is why

machinists make the best CNC programmers, operators, and setup personnel.

Machinists already know what it is the machine will be doing. It will be a relatively

simple matter of adapting what they already know to the CNC machine.

For example, a beginner to CNC turning centres should understand the basic

machining practice related to turning operations like rough and finish turning,

rough and finish boring, grooving, threading, and necking. Since this form of CNC

machine can perform multiple operations in a single program (as many CNC

machines can), the beginner should also know the basics of how to process

workpieces machined by turning so a sequence of machining operations can be

developed for workpieces to be machined.

This point cannot be overstressed. Trying to learn about a particular CNC machine

without understanding the basic machining practice related to the machine would

10

be like trying to learn how to fly an airplane without understanding the basics of

aerodynamics and flight. Just as a beginning pilot will be in for a great number of

problems without understanding aerodynamics, so is the beginning CNC user

have difficulty learning how to utilize CNC equipment without an understanding of

basic machining practice.

Learning about a new CNC machine

From a programmer's stand of point, as you begin to learn about any new CNC

machine, you should concentrate on four basic areas. First, you should

understand the machine's most basic components. Second, you should become

comfortable with your machine's directions of motion (axes). Third, you should

become familiar with any accessories equipped with the machine. And fourth, you

should find out what programmable functions are included with the machine and

learn how they are programmed. Manual handling on CNC machines, handling of

control unit,

handling of tools and accessories, tool measurement

Fanuc Machining Centre Haas Turning Centre - Lathe

Machine components

While you do not have to be a machine designer to work with CNC equipment, it

is important to know how your CNC machine is constructed. Understanding your

machine's construction will help you to gauge the limits of what is possible with

your machine. Just as the race car driver should understand the basics of

suspension systems, breaking systems, and the workings of internal combustion

engines (among other things) in order to get the most out of a given car, so must

the CNC programmer understand the basic workings of the CNC machine in order

to get the most from the CNC machine tool.

For a universal style slant bed turning centre, for example, the programmer

should know the most basic machine components, including bed, way system,

headstock & spindle, turret construction, tailstock, and work holding device.

Information regarding the machine's construction including assembly drawings is

usually published right in the machine tool builder's manual. As you read the

machine tool builder's manual, here are some of the machine capacity and

construction questions to which you should find answers.

Some of important machine capacity facts you should know:

What is the machine's maximum RPM?

How many spindles ranges does the machine have (and what are the cut-off

points for each range?

What is the spindle and axis drive motor horsepower?

What is the maximum travel distance in each axis?

How many tools can the machine hold?

11

What way construction does the machine incorporates (usually square ways,

dovetail, and/or linear bearing ways)?

What is the machine's rapid rate (fastest traverse rate)?

What is the machine's fastest cutting feedrate?

These are but a few of the questions you should be asking yourself as you begin

working with any new CNC machine. Truly, the more you know about your

machine's capacity and construction, the easier it will be to get comfortable with

the machine.

Programmable functions and accessories

The programmer must also know what functions of the CNC machine are

programmable (as well as the commands related to programmable functions).

A CNC machine wouldn't be very helpful if all it could only move the workpiece in

two or more axes. Almost all CNC machines are programmable in several other

ways. The specific CNC machine type has a lot to do with its appropriate

programmable accessories. Again, any required function will be programmable on

full-blown CNC machine tools. Here are some examples for one machine type.

With low cost CNC equipment, often times many machine functions must be

manually activated. With some CNC milling machines, for example, about the

only programmable function is axis motion. Just about everything else may have

to be activated by the operator. With this type of machine, the spindle speed and

direction, coolant and tool changes may have to be activated manually by the

operator.

With full blown CNC equipment, on the other hand, almost everything is

programmable and the operator may only be required to load and remove

workpieces. Once the cycle is activated, the operator may be freed to do other

company functions.

Reference the machine tool builder's manual to find out what functions of your

machine are programmable. To give you some examples of how many

programmable functions are handled, here is a list a few of the most common

programmable functions along with their related programming words. As we

know, programmable functions will vary dramatically from one machine to the

next. The actual programming commands needed will also vary from builder to

builder. Be sure to check the M codes list (miscellaneous functions) given in the

machine tool builder's manual to find out more about what other functions may

be programmable on your particular machine. M codes are commonly used by the

machine tool builder to give the user programmable ON/OFF switches for machine

functions. In any case, you must know what you have available for activating

within your CNC programs.

For turning centres, for example, you may find that the tailstock and tailstock

quill is programmable. The chuck jaw open and close may be programmable. If

the machine has more than one spindle range, commonly the spindle range

selection is programmable. And if the machine has a bar feeder, it will be

programmable. You may even find that your machine's chip conveyor can be

turned on and off through programmed commands. All of this, of course, is

important information to the CNC programmer.

Spindle control, S function

The spindle speed can be easily specified and the spindle can be turned on in a

forward or reverse direction. It can also, of course, be turned off.

An "S" word is used to specify the spindle speed (in RPM for machining centres).

An M03 is used to turn the spindle on in a clockwise (CW, forward) manner. M04

turns the spindle on in a counter clockwise (CCW) manner. M05 turns the spindle

off. Note that turning centres also have a feature called constant surface speed

which allows spindle speed to also be specified in surface feet per minute (or

12

meters per minute). It calculates spindle speed so the surface speed is kept as

specified with a tool position change. It then supplies a voltage, corresponding to

the calculated spindle speed, to the spindle control to rotate the spindle at the

correct surface speed when the surface speed is specified after S.

Automatic tool changer ATC (machining centre) or turret (turning

centres)

T function

Most machining centres can hold many tools in a tool magazine. When required,

the required tool can be automatically placed in the spindle for machining.

The T code specifies tool . When the T code is commanded, the magazine turn

and the specified tool are indexed at stand-by (auto) position.

Tool selection command or T " word is used to tell the machine which tool station

is to be placed in the spindle. Or in case of turning centres, to turn turret and

bring right tool in working position. On most machines, an M06 tells the machine

to actually make the tool change. Tool change (on turning centres) a four digit T

" word is used to command tool changes on most turning centres. The first two

digits of the T word specify the turret station number and the second two digits

specify the offset to be used with the tool. T0101, for example specifies tool

station one with offset one.

Coolant control

Many machining operations require coolant for lubrication and cooling purposes.

Coolant can be turned on and off from within the machine cycle.

M08 is used to turn ON flood coolant. If available M07 is used to turn ON mist

coolant. M09 turns OFF the coolant.

Automatic pallet changer APC

An M60 command is commonly used to make pallet changes.

Other programmable features to look into

An M60 command is commonly used to make pallet changes.

Accessories to the machine

Other important area a beginner CNC user should address is related to other

possible additions to the basic machine tool itself. Many CNC machine tools are

equipped with accessories designed to enhance what the basic machine tool can

do. Some of these accessories may be made and supported by the machine tool

builder. These accessories should be well documented in the machine tool

builder's manual. Other accessories may be made by an after-market

manufacturer, in which case a separate manual may be involved.

Examples of CNC accessories include probing systems, tool length measuring

devices, post process gagging systems, automatic pallet changers, adaptive

control systems, bar feeders for turning centres, live tooling and C axis for

turning centres, and automation systems. Truly, the list of potential accessory

devices goes on and on.

Directions of motion (axes)

The CNC programmer MUST know the programmable motion directions (axes)

available for the CNC machine tool. The axes names will vary from one machine

tool type to the next. They are always referred to with a letter address. Common

axis names are X, Y, Z, U, V, and W for linear axes and A, C, and C for rotary

axes. However, the beginner programmer should confirm these axis designations

and directions (plus and minus) in the machine tool builder's manual since not all

machine tool builders conform to the axis names we show. As discussed in key

concept number one, whenever a programmer wishes to command movement in

one or more axes, the letter address corresponding to the moving axes as well as

the destination in each axis are specified: X3.5 for example tells the machine to

13

move the X axis to a position of 3.5 inches from the program zero point in X

(assuming the absolute mode of programming is used.

Home position (reference point) for each axis

Most CNC machines utilize a very accurate position along each axis as a starting

point or reference point for the axis. Some control manufacturers call this position

the zero return position. Others call it the grid zero position. Yet others call it the

home

position. Regardless of what it is called, the reference position is required by

many controls to give the control an accurate point of reference. CNC controls

that utilize a reference point for each axis require that the machine be manually

sent to its reference point in each axis as part of the power up procedure. Once

this is completed, the control will be in sync with the machine's position.

2. FLOW OF THE CNC PROCESS

PROGRAMING CNC MACHINE TOOL OPERATION

Diagram above shows how it is look like complete process, when we have to

machine a part on CNC machine tool. In first place programmer has to read and

understand drawings, what is required to be machined. Secondly, programmer

has to prepare and make CNC program based on that drawing. That is why we

are here, to learn how to make good economically productive CNC program. We

assume students taking this course currently possess certain basic machining

practice skills, including the ability to read drawings. Older CNC machines used

paper tapes with punched programs on them. Then tape would be translated into

CNC program by a reader and stored into CNC system.

How a programmer will compose a program we will learn later in programming

chapter. But when program is finished and ready for transfer into CNC system,

today programmers using mostly direct transfer from PC to CNC system, or do

programming directly on CNC machine computer. Of course, today we are using

different CAD-CAM systems which make all programming process easy, more

creative and faster.

Next step is to mount work piece and required tools on machine. Tools have to be

set into tool magazine (machining centres) or turret (turning centres) as program

we made require. This part of job is called Setting CNC machines, which we are

going to learn in separate course with CD video help.

Last step is most exciting, actually then we can see how our idea from CNC

program

transforming into real part, and that is when we execute the machining.

14

3. CNC PROGRAMMING

This course describes the general CNC programming regardless of the type of the

machine, standard, or kind of CNC control. Explanation is made for necessary

items on programming, such as the programming words, methods

Programming means the preparation of process sheet while looking at diagram

and drawings. CNC Programmer decides which combination of sequences,

symbols, numerals and other commands in program language he will use, and he

directly influences on productivity.

COORDINATE SYSTEMS

Programmer has to understand fundamental geometrical principles, same as

principles of NC programming. He is going to use those principles in his job all

the time.

When the position to be reached by the tool is given, the CNC moves the tool to

that position. The position to be reached by the tool is given as a coordinate value

in a coordinate system. The following three types of coordinate systems are

available:

We distinguish between the following coordinate systems:

# Machine coordinate system with machine zero point

# Work coordinate system with workpiece zero point

# Local coordinate system (This can also be current workpiece coordinate

system)

The position to be reached by the tool is commanded with a coordinate value of

one of the above coordinate systems, as required. The coordinate value consists

of one component for each program axis.

On sketch above we can see a

coordinate system. If there are three program axes (X, Y and Z), the coordinate

value is expressed as follows X Y Z

Position of a tool when X40. Y30. Z25. is commanded.

15

Axis:

Standard axis Z,Y,Z

Swivel axis A,B,C

Auxiliary axis U,V,W

There are many basic coordinate systems familiar to students of geometry and

trigonometry. These systems can represent points in two-dimensional or three-

dimensional space. Ren Descartes (1596-1650) introduced systems of

coordinates based on orthogonal (right angle) coordinates. These two and three-

dimensional systems used in analytic geometry are often referred to as Cartesian

systems. Similar systems based on angles from baselines are often referred to as

polar systems.

16

Plane designation

A plane is defined by means of two coordinate axes. The third coordinate axis is

perpendicular to this plane and determines the infeed direction of the tool (e.g.

for 2D machining).

When programming, it is necessary to specify the working plane in order that the

control can calculate the Tool offset values correctly.

The plane is also relevant to certain types of circular programming and polar

coordinates.

17

Plain designation milling:

In the CNC program working planes are

specified as follows with G17, G18, G19

Plain designation turning:

Plane Identifier In-feed direction

X/Y G17 Z

Z/X G18 Y

Y/Z G19 X

Machine Zero Point

The machine zero point is a standard point on the machine, established by

manufacturer. The machine zero point is normally decided in accordance with the

type of CNC machine and its done by machine tool builder.

A coordinate system having the zero point at the machine zero point is called

machine coordinate system.

The tool cannot always move to the machine zero point, because in some cases,

the machine zero point is set at a position to which the tool cannot move.

The machine coordinate system is established when the reference point return

(Home position) is first executed after the power is ON. Once the machine

coordinate system is established, it is not changed by Reset button, change of

work coordinate system, local coordinate system setting or other operations

unless the power is turned off.

18

The Machine Coordinate System

There are two types of coordinate systems in the world of measurement. The first is called the Machine Coordinate System. Here, the X, Y, and Z axes, refer to the

machines motions. When viewed from the front of the machine, the X axis runs from left to right, the Y axis runs

from front to back, and the Z axis runs up and down, vertically perpendicular to the other two.

Most CNC machines use a three dimensional coordinate system. In this system another axis, called Z, is added. This creates additional planes (XZ and YZ) providing a third dimension of measurement. Up and down movements can

be included using this system. All three axes (X, Y and Z) are at right angles to each other

and the point of intersection where the axes meet is called the origin (known as 0) or datum point.

Each of the axes is assigned a value depending on how far you want the machine to move in a particular direction. Setting the X, Y and Z values is the first step in writing a CNC program. Depending on the direction of each movement and the value of each movement, each movement is expressed as axes (X+, X-, Y+, Y-, Z+ or Z-).

19

Three finger rule (Doesnt apply on lathes)

The axis directions follow so-called ,,three-finger rule of the right hand. Standing

in front of machine, the middle finger of the right hand points away from the in

feed direction of the main spindle (doesnt apply on lathes). Following then

applies:

- Thumb points in the +X direction

- Index finger points in the +Y dir.

- Middle finger points in the +Z dir.

In practise, this can look quite different on different types of machines.

Machine coordinate system comprises of all the physically existing machine

axis. Referent points and tool and pallet changing points (fixed machine points)

are defined in the machine coordinate system. Where machine coordinate system

is used for programming (this is possible by using some of G codes (functions),

physical axes of the machine are addressed directly. Location of the coordinate

system relative to machine depends of machine type.

The Part Coordinate System

The second coordinate system is called the Part Coordinate System where the 3

axes relate to the datums or features of the workpiece.

Before the introduction of computer software to coordinate measurement, parts

were physically aligned parallel to the machines axes so that the Machine and

Part Coordinate Systems were parallel to one another. This was very time

consuming and not very accurate. When the part was round or contoured, rather

than square or rectangular, the measurement task was nearly impossible.

20

What is Alignment?

With today's CMM software, the CMM measures the workpiece's datums (from the

part print), establishes the Part Coordinate System, and mathematically relates it to the Machine Coordinate System.

The process of relating the two coordinate systems is called alignment (Figure

4). With a street map, we do this automatically by turning the map so that it is

parallel to street (datum) or to a compass direction (i.e., north). When we do this, we're actually locating ourselves to the "world's coordinate system".

21

Datum is a location. It is a feature on a work-piece such as a hole, surface or

slot. We measure a work-piece to determine the distance from one feature to

another

The distance between the two holes on the work-piece can be measured once the

original origin is translated to the smaller hole and the part coordinate system is

mathematically rotated 45. Now both of the holes lie along the new Y axis and

the distance can be calculated automatically.

Setting machine coordinate system The machine coordinate system is inherent to each machine. It can be set

through manual return to the reference point (home position).

A coordinate system with its origin on the machine zero point is called m/c

coordinate system. After switching ON m/c the m/c coordinate system must be

set by reference point approach prior to indicating the command G53. G53 is a G

code effective once for the selection of the m/c coordinate system.

Commands are thus only valid in the block with G53 and are exclusively

traversed in rapid motion.

NG53 XZ

22

-With command G53 cutting radius correction and tool correction are switched

off.

-G53 must be indicated in absolute dimension. With incremental dimension values

the command G53 are ignored.

Directions of motion (axes)

The CNC programmer MUST know the programmable motion directions (axes)

available for the CNC machine tool. The axes names will vary from one machine

tool type to the next. They are always referred to with a letter address. Common

axis names are X, Y, Z, U, V, and W for linear axes and A, C, and C for rotary

axes. However, in the beginning programmer should confirm these axis

designations and directions (plus and minus) in the machine tool builder's manual

since not all machine tool builders conform to the axis names we show. As

discussed before, whenever a programmer wishes to command movement in one

or more axes, the letter-address corresponding to the moving axes as well as the

destination in each axis are specified. X3.5, for example tells the machine to

move the X axis to a position of 3.5 inches from the program zero point in X

(assuming the absolute mode of programming is used.

23

Axis direction

Work-piece coordinate system

It was briefly described earlier. In order for the machine to control and operate

specified positions, these data must be made in a reference system that

corresponds to the direction of motion of the axis slides. A coordinate system with

axes X,Y and Z is used for this purpose. They are called Cartesian coordinate

systems.

The work piece zero position (W) is the origin of the work piece coordinate

system. Sometimes it is advisable or even necessary to work with negative

positional data. Positions to the left of the origine are prefixed by a negative sign

(-).Pic. below shows six different work-piece coordinate systems established,

each with separate coordinate values in CNC program.

24

Fixture Offsets (G54-G59.3) (See pic bellow)

Fixture offset are used to make a part home that is different from the absolute,

machine coordinate system. This

allows the part programmer to set up home positions for multiple parts. A typical

operation that uses fixture offsets

would be to mill multiple copies of parts on "islands" in a piece, similar to the figure bellow:

To use fixture offsets, the values of the desired home positions must be stored in

the control, prior to running a program that uses them. Once there are values

assigned, a call to G54, for instance, would add 2 to all X values in a program. A call to G58 would add 2 to X values and -2 to Y values in this example.

G53 is used to cancel out fixture offsets. So, calling G53 and then G0 X0 Y0 would send the machine back to the actual coordinates of X=0, Y=0.

G53 motion in machine coordinate system

G54 use preset work coordinate system 1

G55 use preset work coordinate system 2

G56 use preset work coordinate system 3

G57 use preset work coordinate system 4

G58 use preset work coordinate system 5

G59 use preset work coordinate system 6

G59.1 use preset work coordinate system 7

G59.2 use preset work coordinate system 8

G59.3 use preset work coordinate system 9

25

Definition of workpiece positions

To specify a position, imagine that a ruler is placed along the coordinate axes.

You can now describe every point in the coordinate system by specifying the

direction (X,Y and Z) and three numerical values. The workpiece zero always has

the coordinates X0, Y0, and Z0. (See drawings below)

Example:

For the sake of simplicity, we will only use one plane of the coordinate system in

this example, i.e. the X/Y plane. Points A to D than have the following point

coordinates:

A coordinates: X50. Y30.

B coordinates: X-20. Y70.

C coordinates: X-60. Y-60.

D coordinates: X20. Y-40.

Example with one plane on lathe (second picture):

Points A to D are defined by the following coordinates:

A coordinates: X40. Z-20.

B coordinates: X60. Z-40.

C coordinates: X60. Z-80.

D coordinates: X90. Z-90.

The main axes of a vertical machining center.

The X axis controls the table movement left or right.

The Y axis controls the table movement toward or away from

the column.

The Z axis controls the vertical (up or down) movement of

the knee or spindle.

26

In feed depth must also be described in milling operations. To program this, we

need to specify a numerical value for the third coordinate (Z in this case).

Example pic. bellow:

Points A1 to A2 are defined by the following coordinates:

A1 is defined by X20. Y20. Z-10.

A2 is defined by X50. Y70. Z-20.

27

Polar coordinates system commands

(G15, G16)

The coordinates used up to this point to specify points in the coordinate system

are called ,,Cartesian coordinates.

However. There is another way to specify coordinates, namely as ,,polar

coordinates. The end point coordinate can be input in polar coordinates (radius

and angle). The plus direction of the angle is counterclockwise of the selected

plane first axis + direction, and the minus direction is clockwise. Both radius and

angle can be commanded in either absolute or incremental command(G90, G91).

Polar coordinates make sense when a workpiece or part of a workpiece has a

radius and angle. The point from which the dimensions are taken is called the

,,pole.

Example:

The points P1 and P2 can then be described-with reference to the pole - as

follows:

P1 corresponds to radius =100 + angle=30deg

P1 corresponds to radius = 60 + angle=75deg

When the radius is specified with absolute command the zero point of local

coordinate system becomes the centre of the polar coordinate system.

Motion types

You Must Understand the Motion Types Available on Your CNC machine.

During discussion about Definition of work-piece positions

we discussed how end points for axis motion are commanded utilizing the

rectangular coordinate system. During that presentation, however, we were only

concerned with describing how the CNC machine determines the END POINT

position for each motion. To effectively command motion on most CNC machines

requires more than just specifying end points for positioning movements.

CNC control manufacturers try to make it as easy as possible to make movement

commands within the program. For those styles of motion that are commonly

needed, they give the CNC user interpolation types. We are going to learn about

it, but firstly we have to get used with G & M codes which are crucial in CNC

programming:

28

G CODES (preparatory functions) It shows the meaning of command for the concerned block. G following by the

number of 3 digits (usually 2 digits) address:

G codes are divided into following two types:

Type Meaning

One-shot G code The G code is effective only in the block in which

it is

Specified

Modal G code The G code is effective until another G code of the

same group is specified

Modal Codes

Many G codes and M codes cause the machine to change from one mode to

another, and the mode stays active until some other command changes it

implicitly or explicitly. Such commands are called "modal".

Modal codes are like a light switch. Flip it on and the lamp stays lit until someone

turns it off. For example, the coolant commands are modal. If coolant is turned

on, it stays on until it is explicitly turned off. The G codes for motion are also

modal. If a G1 (straight move) command is given on one line, it will be executed

again on the next line unless a command is given specifying a different motion (or some other command which implicitly cancels G1 is given).

"Non-modal" codes effect only the lines on which they occur. For example, G4 (dwell) is non-modal.

Modal commands are arranged in sets called "modal groups". Only one member

of a modal group may be in force at any given time. In general, a modal group

contains commands for which it is logically impossible for two members to be in

effect at the same time. Measurement in inches vs. measure in millimetres are

modal. A machine tool may be in many modes at the same time, with one mode

from each group being in effect. The modal groups used in the interpreter are

shown in Table bellow:

G and M Code Modal Groups

Group 1 = {G0, G1, G2, G3, G80, G81, G82, G83, G84, G85, G86, G87, G88, G89} -

motion

Group 2 = {G17, G18, G19} - plane selection

Group 3 = {G90, G91} - distance mode

Group 5 = {G93, G94} - spindle speed mode

Group 6 = {G20, G21} - units

Group 7 = {G40, G41, G42} - cutter diameter compensation

Group 8 = {G43, G49} - tool length offset

Group 10 = {G98, G99} - return mode in canned cycles

Group12 = {G54, G55, G56, G57, G58, G59, G59.1, G59.2, G59.3} coordinate system

selection

Group 2 = {M26, M27} - axis clamping

Group 4 = {M0, M1, M2, M30, M60} - stopping

Group 6 = {M6} - tool change

Group 7 = {M3, M4, M5} - spindle turning

Group 8 = {M7, M8, M9} - coolant

Group 9 = {M48, M49} - feed and speed override bypass

29

NC Programming as per ISO (DIN 66025) and RS274

G codes simple definition G00 Rapid traverse G01 Linear interpolation with feed-rate G02 Circular interpolation (clockwise) G03 Circular interpolation (counter clockwise) G2/G3 Helical interpolation G04 Dwell time in milliseconds G05 Spline definition G06 Spline interpolation G07 Tangential circular interpolation / Helix interpolation / Polygon interpolation / Feed-rate interpolation G08 Ramping function at block transition / Look ahead "off" G09 No ramping function at block transition / Look ahead "on" G10 Stop dynamic block pre-processing G11 Stop interpolation during block pre-processing G12 Circular interpolation (cw) with radius G13 Circular interpolation (ccw) with radius G14 Polar coordinate programming, absolute G15 Polar coordinate programming, relative G16 Definition of the pole point of the polar coordinate system G17 Selection of the X, Y plane G18 Selection of the Z, X plane G19 Selection of the Y, Z plane G20 Selection of a freely definable plane G21 Parallel axes "on" G22 Parallel axes "off" G24 Safe zone programming; lower limit values G25 Safe zone programming; upper limit values G26 Safe zone programming "off" G27 Safe zone programming "on" G33 Thread cutting with constant pitch G34 Thread cutting with dynamic pitch G35 Oscillation configuration G38 Mirror imaging "on" G39 Mirror imaging "off" G40 Path compensations "off" G41 Path compensation left of the work piece contour G42 Path compensation right of the work piece contour G43 Path compensation left of the work piece contour with altered approach G44 Path compensation right of the work piece contour with altered approach G50 Scaling G51 Part rotation; programming in degrees G52 Part rotation; programming in radians G53 Zero offset off G54 Zero offset #1 G55 Zero offset #2 G56 Zero offset #3 G57 Zero offset #4 G58 Zero offset #5 G59 Zero offset #6 G63 Feed / spindle override not active G66 Feed / spindle override active G70 Inch format active

30

G71 Metric format active G72 Interpolation with precision stop "off" G73 Interpolation with precision stop "on" G74 Move to home position G75 Curvature function activation G76 Curvature acceleration limit G78 Normalcy function "on" (rotational axis orientation) G79 Normalcy function "off" G80 Canned cycle "off" G81 Drilling to final depth canned cycle G82 Spot facing with dwell time canned cycle G83 Deep hole drilling canned cycle G84 Tapping or Thread cutting with balanced chuck canned cycle G85 Reaming canned cycle G86 Boring canned cycle G87 Reaming with measuring stop canned cycle G88 Boring with spindle stop canned cycle G89 Boring with intermediate stop canned cycle G90 Absolute programming G91 Incremental programming G92 Position preset G93 Constant tool circumference velocity "on" (grinding wheel) G94 Feed in mm / min (or inch / min) G95 Feed per revolution (mm / rev or inch / rev) G96 Constant cutting speed "on" G97 Constant cutting speed "off" G98 Positioning axis signal to PLC G99 Axis offset G100 Polar transformation "off" G101 Polar transformation "on" G102 Cylinder barrel transformation "on"; Cartesian coordinate system G103 Cylinder barrel transformation "on," with real-time-radius compensation (RRC) G104 Cylinder barrel transformation with centre line migration (CLM) and RRC G105 Polar transformation "on" with polar axis selections G106 Cylinder barrel transformation "on" polar-/cylinder-coordinates G107 Cylinder barrel transformation "on" polar-/cylinder-coordinates with RRC G108 Cylinder barrel transformation polar-/cylinder-coordinates with CLM and RRC G109 Axis transformation programming of the tool depth G110 Power control axis selection/channel 1 G111 Power control pre-selection V1, F1, T1/channel 1 (Voltage, Frequency, Time) G112 Power control pre-selection V2, F2, T2/channel 1 G113 Power control pre-selection V3, F3, T3/channel 1 G114 Power control pre-selection T4/channel 1 G115 Power control pre-selection T5/channel 1 G116 Power control pre-selection T6/pulsing output G117 Power control pre-selection T7/pulsing output G120 Axis transformation; orientation changing of the linear interpolation rotary axis G121 Axis transformation; orientation change in a plane G125 Electronic gear box; plain teeth G126 Electronic gear box; helical gearing, axial G127 Electronic gear box; helical gearing, tangential G128 Electronic gear box; helical gearing, diagonal G130 Axis transformation; programming of the type of the orientation change G131 Axis transformation; programming of the type of the orientation change G132 Axis transformation; programming of the type of the orientation change

31

G133 Zero lag thread cutting "on" G134 Zero lag thread cutting "off" G140 Axis transformation; orientation designation work piece fixed coordinates G141 Axis transformation; orientation designation active coordinates G160 ART activation G161 ART learning function for velocity factors "on" G162 ART learning function deactivation G163 ART learning function for acceleration factors G164 ART learning function for acceleration changing G165 Command filter "on" G166 Command filter "off" G170 Digital measuring signals; block transfer with hard stop G171 Digital measuring signals; block transfer without hard stop G172 Digital measuring signals; block transfer with smooth stop G175 SERCOS-identification number "write" G176 SERCOS-identification number "read" G180 Axis transformation "off" G181 Axis transformation "on" with not rotated coordinate system G182 Axis transformation "on" with rotated / displaced coordinate system G183 Axis transformation; definition of the coordinate system G184 Axis transformation; programming tool dimensions G186 Look ahead; corner acceleration; circle tolerance G188 Activation of the positioning axes G190 Diameter programming deactivation G191 Diameter programming "on" and display of the contact point G192 Diameter programming; only display contact point diameter G193 Diameter programming; only display contact point actual axes center point G200 Corner smoothing "off" G201 Corner smoothing "on" with defined radius G202 Corner smoothing "on" with defined corner tolerance G203 Corner smoothing with defined radius up to maximum tolerance G210 Power control axis selection/Channel 2 G211 Power control pre-selection V1, F1, T1/Channel 2 G212 Power control pre-selection V2, F2, T2/Channel 2 G213 Power control pre-selection V3, F3, T3/Channel 2 G214 Power control pre-selection T4/Channel 2 G215 Power control pre-selection T5/Channel 2 G216 Power control pre-selection T6/pulsing output/Channel 2 G217 Power control pre-selection T7/pulsing output/Channel 2 G220 Angled wheel transformation "off" G221 Angled wheel transformation "on" G222 Angled wheel transformation "on" but angled wheel moves before others G223 Angled wheel transformation "on" but angled wheel moves after others G265 Distance regulation axis selection G270 Turning finishing cycle G271 Stock removal in turning G272 Stock removal in facing G274 Peck finishing cycle G275 Outer diameter / internal diameter turning cycle G276 Multiple pass threading cycle G310 Power control axes selection /channel 3 G311 Power control pre-selection V1, F1, T1/channel 3 G312 Power control pre-selection V2, F2, T2/channel 3 G313 Power control pre-selection V3, F3, T3/channel 3

32

G314 Power control pre-selection T4/channel 3 G315 Power control pre-selection T5/channel 3 G316 Power control pre-selection T6/pulsing output/Channel 3 G317 Power control pre-selection T7/pulsing output/Channel 3

Note that some of the above G-codes are not standard. Specific control features, such as laser power control, enable those optional codes.

M CODES (miscellaneous functions) Programmer has to refer to the manual issued by the machine tool builder for

details of this functions used on particular machine. Generally when address M is

specified a code signal is transmitted. These signals are used to turn on/off

control on machine. Only one M command can be specified in one block. Selection

of M codes used on particular machine varies with machine tool builder.

These are most often used M codes:

M codes simple definition M00 Unconditional stop M01 Conditional stop M02 End of program M03 Spindle clockwise M04 Spindle counter-clockwise M05 Spindle stop M06 Tool change (see Note below) M07 Mist ON M08 Coolant ON M09 Coolant OFF M10 Clamp ON M11 Clamp OFF M12 NC Rotary table clamp ON M13 NC Rotary table clamp OFF M19 Spindle orientation M20 Start oscillation (configured by G35) M21 End oscillation M29 Rigid tapping M30 End of program M40 Automatic spindle gear range selection M41 Spindle gear transmission step 1 (Spindle low speed range) M42 Spindle gear transmission step 2 (Spindle high speed range -These codes are not used on models without low/high) M43 Spindle gear transmission step 3 M44 Spindle gear transmission step 4 M45 Spindle gear transmission step 5 M46 Spindle gear transmission step 6 M70 Spline definition, beginning and end curve 0 - Mirror image cancel M71 Spline definition, beginning tangential, end curve 0 (X-axis mirror image) M72 Spline definition, beginning curve 0, end tangential (Y-axis mirror image) M73 Spline definition, beginning and end tangential (4-th axis mirror image) M80 Delete rest of distance using probe function, from axis measuring input M81 Drive On application block (resynchronize axis position via PLC signal during the block), Arm forward M82 Arm down M83 Arm turn 180 deg. M84 Arm up M85 Arm retract M98 Subprogram call

33

M99 End of subprogram, rewind function M101-M108 Turn off fast output byte bit 1 (to 8) M109 Turn off all (8) bits in the fast output byte M111-M118 Turn on fast output byte bit 1 (to 8) M121-M128 Pulsate (on/off) fast output byte bit 1 (to 8) M140 Distance regulation on (configured by G265) M141 Distance regulation off M150 Delete rest of distance using probe function, for a probe input (one of 16, M151-M168) M151-M158 Digital input byte 1 bit 1 (to bit 8) is the active probe input M159 PLC cannot define the bit mask for the probe inputs M160 PLC can define the bit mask for the probe inputs (up to 16) M161-M168 Digital input byte 2 bit 1 (to bit 8) is the active probe input M170 Continue the block processing look ahead of the part program (cancel the M171) M171 Stop the block processing look ahead of the probe input part program segment (like a G10) M200 Activate the hand-wheel operation in the automatic mode (to introduce an offset in the program) M201-M208 Select the axis (by number from 1 to 8) for the hand-wheel operation M209 Activate the hand-wheel operation in the automatic mode, with PLC control of the axis selection M210 Deactivate the hand-wheel input while in the automatic mode M211 Deactivate this hand-wheel feature and also remove the hand-wheel offset (if any) M213 Spindle 2 clockwise M214 Spindle 2 counter-clockwise (CCW) M215 Spindle 2 stop M280 Switchable spindle/rotary axis, rotary axis on, first combination M281 Switchable spindle/rotary axis, rotary axis on, second combination M290 Switchable spindle/rotary axis, spindle enabled, first combination M291 Switchable spindle/rotary axis, spindle enabled, second combination Note: Other machine functions, like tool change (usually M06) or coolant control, have their M-code value specified by the PLC application not by the CNC software.

Other M-codes (up to M699) can be handled by the PLC application based on the particular machine requirements.

Absolute command (absolute coordinate value) - G90 This is done by G90 command.

In program, there are two types of commands for axial(X,Y,Z) movement, and

one of them is absolute (absolute coordinate value) command. The other one is

Incremental. In the Absolute command, coordinate value of the end position is

programmed; In the Incremental command, move distance of the position itself is

programmed. G90 and G91 are used to command absolute or incremental

command respectively.

34

Command is made at the position (absolute coordinate value) from program zero

point. There is one zero point.

N1 G90 Z50. Y30.

N2 X200.Y30.

N3 X200.Y90.

N4 X50.Y90.

N5 X0 Y0

See pic. Below:

Explanation:

N1 G90 hereafter moving command is

absolute command. Moving to P1.

N2 Moving from P1 to P2.

N3 Moving from P2 to P3.

N4 Moving from P3 to P4.

N5 Movement from P4 to program zero

point.

Absolute dimensions refer to the origin of

the active coordinate system. Programmer

has to program the point to which the tool

is to travel , e.g. in the the workpiece

coordinate system.

35

Incremental command (incremental value) G91

Is done by G91 command. (Pic Bellow) Locations are always given as the distance

and direction from the immediately preceding point. A X plus (X+) command

will cause the cutting tool to be located to the right of the last point.

1. A X minus (X-) command will cause the cutting tool to be located to the left

of the last point.

2. A Y plus (Y+) command will cause the cutting tool to be located toward the

column.

3. A Y minus (Y-) will cause the cutting tool to be located away from the

column.

4. A Z plus (Z+) command will cause the cutting tool or spindle to move up or

away from the work-piece.

5. A Z minus (Z-) moves the cutting tool down or into the work-piece.

In incremental programming, the G91 command indicates to the computer and

MCU (Machine Control Unit) that programming is in the incremental mode.

Explanation:

N1 G91 hereafter-moving command is

incremental (value) command.

Moving to P.

N2 with P1 as zero point moving to P2.

N3 with P2 as zero point moving to P3.

N4 with P3 as zero point moving to P4.

N5 with P4 as zero point moving to the start

point.

36

Understanding of interpolation

Say for example, you wish to move only one linear axis in a command.

Say you wish to move the X axis to a position one inch to the right of program

zero. In this case, the command X1. would be given (assuming the absolute

mode is instated). The machine would move along a perfectly straight line during

this movement (since only one axis is moving). Now let's say you wish to include

a Y axis movement to a position one inch above program zero in Y (with the X

movement). We'll say you are trying to machine a tapered or chamfered surface

of your work-piece in this command.

For the control to move along a perfectly straight line to get to the programmed

end point, it must perfectly synchronize the X and Y axis movements. Also, if machining is to occur during the motion, a motion rate (feed-rate) must also be

specified. This requires linear interpolation.

Rapid motion G00 (also called positioning) or rapid traverse movement

This motion type (as the name implies) is used to command motion at the

machine's fastest possible rate. It is used to minimize non-productive time during

the machining cycle. Common uses for rapid motion include positioning the tool

to and from cutting positions, moving to clear clamps and other obstructions, and

in general, any non-cutting motion during the program.

You must check in the machine tool builder's manual to determine a machine's

rapid rate. Usually this rate is extremely fast (some machines boast rapid rates of

well over 1000 IPM!), meaning the operator must be cautious when verifying

programs during rapid motion commands. Fortunately, there is a way for the

operator to override the rapid rate during program verification.

The command almost all CNC machines use to command rapid motion is G00.

Within the G00 command, the end point for the motion is given. Control

manufacturers vary with regard to what actually happens if more than one axis is

included in the rapid motion command. With most controls, the machine will

move as fast as possible in all axes commanded. In this case, one axis will

probably reach its destination point before the other/s. With this kind of rapid

command, straight line movement will NOT occur during rapid and the

programmer must be very careful if there are obstructions to avoid. With other

controls, straight line motion will occur, even during rapid motion commands.

Straight line motion G01 (also called linear interpolation or feeding)

37

This motion type allows the programmer to command perfectly straight line

movements as discussed earlier during our discussion of linear interpolation. This

motion type also allows the programmer to specify the motion rate (feed-rate) to

be used during the movement. Straight line motion can be used any time a

straight cutting movement is required, including when drilling, turning a straight

diameter, face or taper, and when milling straight surfaces. The method by which

feed-rate is programmed varies from one machine type to the next. Generally

speaking, machining centres only allow the feed-rate to be specific in per minute

format (inches or millimetres per minute). Turning centres also allow feed-rate to

be specified in per revolution format (inches or millimetres per revolution).

A G01 word is commonly used to specify straight line motion. Within the G01, the

programmer will include the desired end point in each axis.

Circular interpolation motion (also called circular interpolation)

G02 / G03

This motion type causes the machine to make movements in the form of a

circular path. As discussed earlier during our presentation of circular

interpolation, this motion type is used to generate radius during machining. All

feed-rate related points made during our discussion of straight line motion still

apply.

Two G codes are used with circular motion. G02 is commonly used to specify

clockwise CW motion, while G03 is used to specify counter clockwise CCW

motion. To evaluate which to use, you simply view the movement from the same

perspective the machine will view the motion. For example, if making a circular

motion in XY on a machining centre, simply view the motion from the spindle's

vantage point. If making a circular motion in XZ on a turning centre, simply view

the motion from above the spindle. In most cases, this is as simple as viewing the

print from above.

Additionally, circular motion requires that, by one means or another, the

programmer specifies the radius of the arc to be generated. With newer CNC

controls this is handled by a simple "R" word. The R word within the circular

command simply tells the control the radius of the arc being commanded. With

older controls, directional vectors (specified by I, J, and K) tell the control the

location of the arc's centre point. Since controls vary with regard to how

directional vectors are programmed, and since the R word is becoming more and

more popular for radius designation, our examples will show the use of the R

word. If you wish to learn more about directional vectors, you must reference

your control manufacturer's manual. G17 (XY plane) is selected when the power

is turned ON. The clockwise and counter clockwise directions are shown below:

Clockwise G02 and counter-clockwise G03 on the Xp Yp plane are defined when

the Xp Yp plane is viewed in the positiveto-negative direction of the Zp axis (Yp

or Xp axis respectively) in the Cartesian coordinate system, see pic above. The

arc centre is specified by addresses I, J, and K for the Xp, Yp and Zp axes. The

numerical value following I,J,K however is a vector component in which the arc

centre is seen from the start point, and is always specified in an Incremental

value irrespective of G90 and G91 as shown below. I, J, and K must be signed

according to the direction.

38

Arc on X-Y plane:

G17 (G02, G03) XpYp(R)IJF

Arc on Z-X plane:

G18 (G02, G03) XpZp(R)IKF

Arc on Y-Z plane:

G19 (G02, G03) YpZp(R)JKF

Date to be given Command Meaning

1. Plane selection G17 Specification of arc on XpYp plane

G18 arc on ZpXp

plane

G19 arc on YpZp

plane

2. Direction of rotation G02 Clockwise direction CW

G03 Counter clockwise direction CCW

3. End point pos. G90 mode Two of the End point position in the work coordin-

ate system

_____________________________________________

G91 mode Two of the Distance from start point to end point

Xp, Yp, and

Zp axes

4. Distance from start Two of the I, Signed distance from start point to

point to centre J, and K axes centre

_________________________________________________________________

__

Arc radius R Arc radius

5. Feed rate F Feed rate along arc.

Tool path from drawing above can be programmed as follows:

1) In absolute programming:

G92 X200. Y40. Z0

G90 G03 X140. Y100. I-60. F300

G02 X120. Y60. I-50.

Or

39

G92 X200. Y40. Z0

G90 G03 X140. Y100. R60. F300

2. In incremental programming:

G91 G03 X-60. Y60. I-60. F300

G02 X-20. Y-40. I-50.

Or

G91 G03 X-60. Y60. R60. F300

G02 X-20. Y-40. R50.

What is difference ???

R is easier to define , easier to make a mistake and get an incorrect radius.

With R the machine still do the work whether the R is correct or incorrect.

With incorrect I, J, K, the machine will stop and give an alarm message before

executing.

With R to generate a circle path of over 180 deg, then specify a negative R.

G02 G03

With 1 dia tool:

Using R:

G1 X1. Y-5.

G3 X0 Y5. R1.

Using I & J:

G1 X1. Y-5.

G3 X0 Y5. I-1. J0

Sample program (R & J):

40

G01 Y1.25 F12

X1.5 (to start point)

G02 X2.25 Y0.5 J-0.75 or R0.75

Example G02 (Not related to pic above)

%

:1003 (PROGRAM #1003)

N5 G90 G20 G17 (ABSOLUTE, AND INCH PROGRAMMING, XY Plane)

N10 M06 T2 (TOOL CHANGE TO TOOL #2)

N15 M03 S1200 (SPINDLE CW AT 1200RPM)

N20 G00 X1 Y1 (RAPID TO OVER X1,Y1)

N25 Z0.1 (RAPID DOWN TO Z0.1)

N30 G01 Z-0.1 F5 (FEED DOWN TO Z-0.1 AT 5IPM)

N35 G02 X2 Y2 I1 J0 F20 (ARC FEED CW AT RADIUS I1,J0 AT 20IPM)

N37 G00 X2 Y2 Z-0.1

N40 G01 X3.5 (FEED OVER TO X3.5)

N45 G02 X3 Y0.5 R2 (ARC FEED CW WITH RADIUS OF 2)

N50 X1 Y1 R2 ARC FEED CW WITH RADIUS OF 2)

N55 G00 Z0.1 (RAPID UP TO Z0.1)

41

N60 X2 Y1.5 (RAPID OVER TO X2 AND Y1.5)

N65 G01 Z-0.25 (FEED DOWN TO Z-0.25)

N70 G02 X2 Y1.5 I0.25 J-0.25 (FULL CIRCLE ARC FEED MOVE)

N75 G00 Z1 (RAPID UP TO Z1)

N80 X0 Y0 (RAPID OVER TO X0 AND Y0)

N85 M05 (SPINDLE OFF)

N90 M30 (PROGRAM END)

Other interpolation types

Depending on the machine's application, you may find that you have other

interpolation types available. Again, CNC control manufacturers try to make it as

easy as possible to program their controls. If an application requires a special

kind of movement, the control manufacturer can give the applicable interpolation

type. For example, many machining center users perform thread milling

operations on their machines. During thread milling, the machine must move in a

circular manner along two axes (usually X and Y) at the same time a third axis

(usually Z) moves in a linear manner. This allows the helix of the thread to be

properly machined. This motion resembles a spiralling motion (though the radius

of the spiral remains constant).

Knowing that their customers need this type of motion for thread milling, CNC

machining centre control manufacturers offer the feature helical interpolation.

With this feature, the user can easily command the motions necessary for thread

milling.

By Helical interpolation tool is moved along a helix, by specifying circular

interpolation together with movement along an axis in a plane other then that

specified for circular interpolation:

G17 {G02/G03}XpYp{IJ/R}F

G18 {G02/G03}XpZp{IK/R...}F

G19 {G02/G03}YpZp{JK/R}F

While your particular CNC machine may have more motion types (depending on

your application), let's concentrate on becoming familiar with the three most

common types of motion. These three motion types are available on almost all

forms of CNC equipment. After briefly introducing each type of motion, we'll show

an example program that stresses the use of all three.

These motion types share two things in common. First, they are all modal. This

means they remain in effect until changed. If for example, several motions of the

same kind are to be given consecutively, the corresponding G code need only be

specified in the first command. Second, the END POINT of the motion is specified

in each motion command. The current position of the machine will be taken as

the starting point.

Next picture shows Cylindrical interpolation:

42

Example of a Cylindrical interpolation program:

G00 G90 Z100