Banner

Issue 63
Spring 2005
Copyright 2005

In this issue:
  1. Manager's corner: The 10% Time Rule
  2. Instructor note: Teaching CNC with the key concepts approach - part five
  3. Time saver: Program offset entries whenever possible
  4. G-code primer: Outputting fixture offset settings
  5. Parameter preference: Setting up user defined G and M codes
  6. Safety Tip: Watch out for that tailstock center!

The Optional Stop is published quarterly by CNC Concepts, Inc. and is distributed free of charge to people subscribing to our (email) distribution list and to those downloading it from our website (www.cncci.com). Information is aimed at CNC users and instructors teaching live CNC classes. All techniques given in this newsletter are intended to help CNC people. However, CNC Concepts, Inc. can accept no responsibility for the use or misuse of the techniques given.

To subscribe: Simply email us (newsletter@cncci.com) and let us know you'd like to be added to our distribution list.

To unsubscribe: Respond to this email, typing REMOVE in the subject. Please accept our apologies if we have disturbed you.

Quick links to our website:

Of special interest on our website:
 

Product Spotlight: A Curriculum for CNC Instructors

Machining Center Programming, Setup, and Operation

This comprehensive curriculum comes with everything you need to teach CNC machining center usage!

Maybe you're an experienced instructor with limited CNC experience. Or maybe you're an expert CNC person with limited teaching experience. Or maybe you're somewhere in between.

Regardless of you current experiences, this curriculum will help you present the complex topic of CNC machining center usage in a logical, understandable, and progressive manner. And we provide the whole package. There are materials to help you get ready to teach, materials to help you while you're teaching, and materials to confirm student comprehension.

Best of all, all of the instructor's materials for this curriculum are shipped to you free of charge when your school places its first order for student materials!

Course lessons

This class is made up of ten key concepts that are further divided into twenty-four lessons. As the name implies, the key concepts provide a limited number of important general principles a student must understand. Lessons fill in the blanks and are progressively more complex. Each builds on previously presented information. Here is a list of lessons for this course:

  1. Machine configurations
  2. General flow of programming
  3. Visualizing program execution
  4. Understanding program zero
  5. Measuring program zero
  6. The two ways to assign program zero
  7. Introduction to programming words
  8. Preparation for programming
  9. Motion types
  10. Introduction to compensation
  11. Tool length compensation
  12. Cutter radius compensation
  13. Fixture offsets
  14. Introduction to program formatting
  15. The four kinds of program format
  16. Canned cycles
  17. Sub programming techniques
  18. Other special features of programming
  19. Rotary tables
  20. Tasks related to setup and operation
  21. The control and machine panel
  22. The three modes of operation
  23. The key operation procedures
  24. Program verification

Scope for the class

From the list of lessons, notice that we're addressing all three tasks that a person must master in order to become proficient with CNC machining center usage - programming, setup, and operation.

Programming - You'll be teaching G code level (manual) programming techniques. This is the first level of programming a person must master in order to program CNC machining centers. With this class under their belt, a student will be ready for a class on more advanced CNC programming systems - which your school may also offer. All specific programming examples are shown for the most popular control in the industry - the Fanuc control.

Setup - There are many setup-related principles presented during the programming portion of the course. A programmer must, of course, be able to describe setups. During the setup portion of the class, you'll be describing the various tasks require to make setups in the approximate order that setups are made.

Operation - By operation, we actually mean two things. First you'll be presenting general operation techniques a person must understand to run a CNC machining center. In the student manual, we provide a series of operation handbooks to help with this. But more importantly, you will be presenting techniques an operator must understand in order to complete a production run. These techniques include workpiece load and unload, cycle activation, sizing and trial machining, and tool replacement.

Your visuals for this class

PowerPoint presentations will be at the heart of your presentations. There is one slide presentation for each lesson (again 24 total). These colorful graphics will quickly get and hold your students' attention. And they are very comprehensive, including slides that build with progressively more complex information and animations that simulate machine or cutting tool motion. There are over 5,000 slides in this course!

Each PowerPoint slide presentation begins with a presentation links slide - a slide that includes hypertext links to each major topic in the lesson. This slide will allow you to quickly jump to a specific topic within the current lesson.

There is also a lesson plan slide close to the beginning of each lesson. This will allow you to introduce the major topics that will be discussed in the lesson. And there is a lesson summary slide at the end of each lesson - so you can review key topics. This allows you to use a proven method of public speaking: Tell them what you're going to tell them - tell them - then tell them what you told them.

Regardless of how well prepared you are to teach a lesson, it is possible to become confused as you transition from one topic to another. This can be embarrassing - it happens in front of your students! To eliminate this confusion, we include fly-in text boxes in transitioning slides. These text boxes will keep you on track, and in most cases, will be the first sentence you'll say to begin the new topic.

How we help you get ready to teach

We dramatically reduce the amount of preparation you must do in order teach your machining center class. We completely eliminate, of course, the need to prepare the curriculum in the first place. It will be a relatively simple matter for you to get comfortable with the teaching materials that we provide.

Getting comfortable the teaching methods - Instructor materials include a For The Instructor manual that provides an explanation of our key concepts approach to teaching, a course outline, and general information to help you get acquainted with the techniques you'll be using to teach the course.

Getting ready to teach each lesson - We provide materials to help you each step of the way. First of all, we provide audio guidance on key slides within each lesson's PowerPoint presentation. You'll find a special teacher icon on key slides (especially at transition slides). If you click this icon, an audio clip will play - explaining what you should be presenting at this point in the lesson.

Again he audio guidance is intended to help you prepare to teach each lesson. It is intended for you to hear, not your students. You won't be clicking this icon while you're teaching - only while you are getting read to teach.

We also provide a (very thick) Instructor Notes manual. This manual parallels the audio guidance provided in the slide presentations - including instructions to help you understand what must be presented at key slides. To hear the audio guidance, of course, you must have a computer available. This Instructor Notes manual provides a more portable way to prepare - you won't need a computer.

Student materials

Student materials include a course manual and a workbook. The student manual is 328 pages, and nicely parallels your presentations during class. It makes a great portable way for students to review what's been presented in class - away from the classroom - and long after the class is over. And, it makes for great homework reading assignments.

The workbook includes an exercise for each lesson (again 24 total). Exercises are much like quizzes - containing true/false and multiple choice questions. Many of the exercises include programming activities. Students will be filling in coordinate sheets, working on programs, and (eventually) writing their own programs from scratch.

The student manuals must be purchased from us. Student manuals sell for $50.00 each and workbooks sell for $14.95 each. These are our discounted prices to your school or school bookstore.

Remember, instructor materials are shipped free of charge to you when your school places its initial order for student materials. We normally ask that the initial order be for twenty sets of student manuals to qualify for free instructor materials, but we can be quite flexible in this regard.

Get started today!

Maybe you've already heard enough and want to get started. Simply phone us (847-639-8847), telling us when your school bookstore will be placing the initial order for student materials and we'll send you the instructor materials right away.

If you still have questions, feel free to contact us by phone (847-639-8874) or email.

Free Samples Disk - There is a free CD-rom disk available that includes all written instructor materials (in Adobe Acrobat format), a sample slide presentation, and samples from the student manual. Simply email us, choosing Send me the samples CD as the reason for the email.

Other curriculums available from CNC Concepts, Inc.

  • Turning center programming setup and operation
  • Setup reduction
  • Cycle time reduction
  • Maximizing CNC utilization
 
{short description of image}
Ad for machine shop calculator
{short description of image}
eBooks ad Click to get more information about this ebook Click to get more information about this ebook
Ad for CNC manuals Link to CNC turing center programming and operation manual Link to CNC machining center programming and operation manual
Machining center programming and operation CD-rom course

Manager's Corner: The 10% Time Rule

A good manager has the ability to inspire their staff. They know it's mandatory to keep people learning new things in order to keep them interested in what they're doing. Without growth, people become stagnant and complacent. And if there's no need or motivation to improve, people won't improve. It's that simple. In order to improve, people must learn new things.

I know for myself that if I'm not learning something new, I will eventually start to feel lazy. So I've tried to force myself to learn something new at all times. In my personal life, sometimes it's as simple as reading a book or watching an educational television show. I might take a class at the local community college. I often try to get involved in a new hobby that's related to a subject I'm interested in. In any case, I know my mind is happiest when I'm learning something new.

Frankly speaking, it is easy to go a little overboard with this concept. Learning new things is addictive. When I'm extremely interested in a new subject, I tend to become obsessed with what I'm studying and let everything else fall by the wayside. The lawn doesn't get mowed, the car doesn't get washed, and my normal chores don't get done. I know from past experience that I've got to limit the time I spend learning new things.

I apply the same thinking to my work. I know that if I stop learning new work-related things, my work will become stagnant. I know that in order to stay current, I've got to keep honing my skills. This might mean learning new computer software, reading trade journals, surfing the Internet to see what's become available, and anything else that helps me do my job better.

But as in my personal life, I know I must balance the time I spend learning something new with the time I spend performing my normal duties. I know I cannot become obsessed with learning or nothing else will get done. So I've come up with what I call the 10% time rule.

About 10% of my time at work will be spent learning new things. This equates to about forty-five minutes per eight-hour work day, four hours a week, 16 hours a month, or 200 hours per year. While I don't adhere to a strict schedule, I try to maintain the 10% rule over the long term.

I happen to be in a position that allows me to apply the 10% rule. Since I own my own company, I can decide what I'm working on (to a certain extent at least). As managers, you may also be in this position. And if you're not already doing so, I urge you to apply the 10% time rule for yourself. If you've never done so, I guarantee that this will help you stay fresh in your work. You may even want to increase it to 15% or 20% to start - especially if you have a lot of catching up to do.

As a manager, you also have the ability, if not the responsibility, to apply the 10% rule for your staff. Your people probably don't have the authority to apply the 10% rule for themselves. So make sure you do it for them.

Consider, for example, a CNC operator. This person's normal responsibilities will keep them busy 100% of the time - if you let it. They cannot, on their own, take time out to learn something new during working hours. You must provide the time, and just as importantly - the learning material, they need to improve.

Past articles in The Optional Stop newsletter have addressed the importance of improving the proficiency of your workers. We've said time and time again that the single-largest way to improve productivity in any area is to improve the proficiency of the people involved. The 10% time rule provides you with a way to gain the needed time to improve productivity.

Keep in mind that the new material being learned doesn't always have to apply directly to what a person is doing in their job. Again, the goal is to keep them fresh. And learning something new always helps - regardless of the topic. While you may be tempted to target improving productivity right from the start, you may actually see a better long-term improvement if you vary the topics you provide for your people.

Admittedly, the 10% time rule does take quite a commitment on the part of your company. While you may not be able to provide all of the time needed to help your people learn new work-related things, at least provide the materials. Even if you expect your people to study on their own (with materials you provide), at least the most motivated people on your staff will have the chance to apply the 10% rule in their own personal lives - on their own time.

  • See our Educator's Page for some ideas to help your people improve their CNC skills
End of article (M01)

Top of page

Instructor note: Teaching CNC with the Key Concepts approach - part five

Part five - Key concept number four: You must understand the compensation types

Here are some links that allow you to review other parts of this article:

  • Part one: Introduction to the key concepts approach
  • Part two: Key concept number one - know your machine
  • Part three: Key concept number two - preparation for programming
  • Part four: Key concept number three - Understanding the motion types

Here in part five, we're going to discuss topics related to the various compensation types. Here is a list of the general topics that we include in key concept number four:

  • Introduction to compensation
  • Sizing and trial machining
  • Fixture offsets (mc)
  • Tool length compensation (mc)
  • Cutter radius compensation (mc)
  • Geometry offsets (tc)
  • Wear offsets (tc)
  • Tool nose radius compensation (tc)

This key concept is quite lengthy. For this reason, I break it into four segments (lessons), including for machining centers, introduction to compensation, fixture offsets, tool length compensation, and cutter radius compensation.

Introduction to compensation

As with every other key concept, we start in general terms. In this case, we devote an entire lesson to introducing compensation. Just about everything in this lesson is related to the three compensation types.

The marksman analogy

I like to begin with an analogy comparing CNC compensation types to the compensation a marksman needs when firing a rifle. A marksman must compensate for the distance to the target. To do so, they must judge the distance to the target and adjust the sight of the rifle accordingly. If they make a mistake in judging distance, or if they don't allow for other variables (like wind), the first shot won't be perfect. Another sight adjustment will be necessary. The next shot will be closer to the target than the first.

Point out that this is amazingly similar to CNC compensation types. In all cases, the setup person will do their best to perfectly set them. But if they make a mistake, or if they don't allow for some other variable (like tool pressure), the first cut won't be perfect. Depending upon the tolerance to be held, they may have to make a an adjustment. The second time the tool cuts, it will machine the workpiece more accurately.

Explain offsets

Point out that all compensation types use offsets. Offsets are referenced by an offset number and contain numerical values. The actual value doesn't mean anything to the control by itself. The compensation usage (in the program) determines what each offset value represents. You can easily compare CNC offsets to the memories of an electronic calculator (they are referenced by a number, contain numerical values, and don't have any special meaning until they are referenced in a calculation).

Depending upon the control model/s involved, you may want to show the display screen/s of related offset pages. Point out that some offsets contain more than one register (like the tool length and cutter radius compensation offsets for some machining centers and the wear offsets of turning centers).

Explain some of the variables that an offset can be used to represent. With tool length compensation, for example, the offset can represent the length of a tool. With cutter radius compensation, it represents a milling cutter's radius. And with fixture offsets, offsets specify the location of the program zero point.

Finally, explain the general reason why offsets are required. There are many tooling related variables that a programmer won't know as they write the program- the exact length and radius of a milling cutter, for example. All compensation types allow the programmer to ignore exact specifications of tooling (including workholding tooling) while the program is being created. Prior to or during setup, these exact values are measured and entered into the control - into offsets. Again, this separates many setup related tasks from programming.

Introduce sizing and trial machining

Explain that CNC machines are capable of very high accuracy. They can hold very small tolerances. And if tolerances are very small, it is likely that the initial entry for certain offsets will not be precise enough to hold the tolerance. Point out that even if a setup person perfectly measures and enters a counter-boring tool's length, for example, it is no guarantee that the counter-boring tool will machine to the exact depth specified in the program. Again, the setup person could make a mistake while measuring or entering the tool's length, but even if they do not, tool pressure may cause the tool to machine a little too shallow (or deep, depending upon the type of tool being used).

Explain that when a setup person notices a very small tolerance on the blueprint - and if they are at all concerned that the cutting tool will not machine the related dimension to size on its first try, they can use a technique called trial machining to ensure that a little extra material will be left by the tool when it cuts for the first time.

While this may be a little detailed at this stage in your presentation, explain that trial machining involves six steps:

  1. Recognizing a tolerance that may not be held if trial machining is not done.
  2. Making an adjustment (usually to a tool's offset) to ensure that the tool leaves excess stock.
  3. Letting the tool cut (of course it will leave excess stock on the critical surface).
  4. Measuring the dimension to determine its current size.
  5. Readjusting (again usually an offset) based upon the measurement just taken.
  6. Rerunning the tool (this time it will machine the dimension to size).

Make sure students understand that trial machining helps them make the very first workpiece a good one. Once the machine is in production, and depending upon how many workpieces must be machined, it is possible that further adjustments may be necessary as tools wear. Generally speaking, as a tool wears, it leaves more material on the workpiece - it may even have the tendency to "push away" from the workpiece (leaving yet more stock) due to increased tool pressure. Depending upon how small the tolerance is, this workpiece growth may cause dimensions to come close to the limits of the tolerance band. If left to continue, they will run out of tolerance.

We call adjustments made to maintain size as tools wear sizing adjustments. In order to make sizing adjustments, of course, the CNC operator must be able to interpret tolerances, determine the target value for each dimension, calculate the deviation from the target value (along with its polarity), and enter this value into the appropriate offset.

Your most basic goal in this key concept, of course, it to get students to understand how the compensation features are programmed and used. But to be successful programmers, setup people, and operators, they must also understand sizing and trial machining. As you discuss each compensation type, be sure to demonstrate the implications of these two important skills.

Fixture offsets

This feature is introduced in key concept number one. And frankly speaking, you may have said enough about it in key concept number one to ignore it here in key concept number four. But be sure students know that the feature fixture offsets is a compensation type. It allows the programmer to ignore the precise placement of the workholding setup on the machine's table. A command in the program (G54 if only one workholding device is being used) tells the control where to look to find the program zero assignment values. These values are the distances from the spindle (center in X and Y and nose in Z) at the zero return position to the program zero point on the workpiece. These will normally be large negative values - and we show how to measure them in key concept number one.

While this may not be the right time to do so, you'll eventually want to discuss other points about fixture offsets:

  • Fixture offset values can be entered by programmed command (G10). This is helpful with repeated setups to keep from having to remeasure offset values every time.
  • There are at least six of them, meaning multiple program zero points can be assigned.
  • That G54 through G59 are used to invoke the various fixture offsets.
  • That there is a common fixture offset (number zero) that allow the user to shift the origin for fixture offset entry from the zero return position to another location.

Again, you may want to save these presentations until later - after students have a few programs under their belts. We recommend discussing them during key concept number six (special features of programming).

Tool length compensation

Tool length compensation allows the programmer to ignore the precise length of each tool while they are creating the program. In essence, the same program will work regardless of how long or short each tool is.

There are actually two ways to use tool length compensation. Each is programmed essentially the same. And it's pretty easy to explain how tool length compensation is programmed.

Programming considerations

Explain that tool length compensation must be instated during each tool's first approach movement in Z to the workpiece. A G43 word is used to instate tool length compensation. Include in the G43 command is an H word that specifies the offset number to be used with tool length compensation. (I like to help newcomers remember the H word by saying that H stands for the height of each tool.) Tell students to make the value of the H word equal to the tool station number. Tool number one will use offset one (H01). Tool number two will use offset two (H02). And so on. Also within the G43 command is a Z axis departure to the tool's approach position.

Here are the first few commands of a program to stress the points:

  • O0001 (Program number)
  • N005 T01 M06 (Place tool one in spindle)
  • N010 G54 G90 S500 M03 T02 (Select coordinate system, absolute mode, start spindle and get the next tool ready)
  • N015 G00 X1.0 Y1.0 (Rapid to first XY position)
  • N020 G43 H01 Z0.1 (Instate tool length compensation, rapid to Z0.1)
  • N025 M08 (Turn on coolant)
  • N030 G01 Z-0.15 F4.0 (Feed into hole)
  • N035 G00 Z0.1 M09 (Retract from hole, turn off coolant)
  • N040 G91 G28 Z0.1 M19 (Return to tool change position, orient spindle)
  • N045 M01 (Optional stop)
  • N050 T02 M06 (Place tool two in spindle)
  • N055 G54 G90 S500 M03 T02 (Select coordinate system, absolute mode, start spindle and get the next tool ready)
  • N060 G00 X1.0 Y1.0 (Rapid to first XY position)
  • N065 G43 H02 Z0.1 (Instate tool length compensation, rapid to Z0.1)
  • N070 M08 (Turn on coolant)
  • N075 G01 Z-1.2 F6.0 (Feed into hole)
  • N080 G00 Z0.1 M09 (Retract from hole, turn off coolant)
  • N085 G91 G28 Z0.1 M19 (Return to tool change position, orient spindle)
  • N090 M01 (Optional stop)
  • .
  • .
  • .

Be sure to point out that since tool length compensation is instated during each tool's first Z axis approach movement, there is no need to cancel it (though there is a command, G49, that does so).

The two ways to use tool length compensation

Again, there are two ways of using tool length compensation. The program shown above will work for both methods. With one method, the tool's length as used as the tool length compensation value (the value placed into the offset for each tool. This is the method we urge you to teach. It allows the most flexibility during setup. With the second method, the distance from the tip of each tool down to the Z axis program zero surface is the tool length compensation value.

Program zero assignment considerations

If using our recommended method (tool's length is the tool length compensation value, students must understand that the Z axis program zero assignment value (fixture offset Z value) must be set to the distance from the spindle nose as the Z axis zero return position to the program zero surface in Z. To measure this value at the machine (after the workholding setup has been made):

  1. Send the machine to the Z axis zero return position
  2. Set the Z axis position display to zero.
  3. Cautiously bring the spindle nose down to the Z0 surface.
  4. The Z axis display will show the needed fixture offset Z register value (a large negative number).
  5. Enter this value into the appropriate fixture offset Z register.

Point out that in step three, some setup people like to use a gauge block or feeler to keep from having to actually touch the spindle nose to a workpiece.

With the second method of using tool length compensation (offset is the distance from the tool tip down to program zero surface in Z), the Z axis program zero assignment value will be zero.

Offset considerations

Again, with our recommended method, the setup person (or someone) will determine the length of each tool. The tool's length is the distance from the tool tip to the spindle nose of the machine (a positive value). This value can be measured for each tool on the machine or off line. To measure tool lengths on the machine:

  1. Bring the spindle nose to a flat surface.
  2. Zero the Z axis position display.
  3. Retract the Z axis far enough and load the tool to be measured.
  4. Bring the tool tip to the flat surface.
  5. The Z axis display now shows the tool length.
  6. Enter this value into the appropriate tool length compensation offset.
  7. Repeat steps 3-6 for all other tools to be measured.

One important benefit of using our recommended method is that tool lengths can also be measured off line, while getting ready for the next (or some future) job. You don't have to use the machine as an expensive height gauge. Other benefits include:

  • Tools that must be used from setup to setup need not be remeasured
  • Tools shared from one machine to another can be measured in a central location

Trial machining considerations

Explain that tool length compensation allows a setup person to easily trial machine Z surfaces. When they see a Z surface (depth) that has a critical tolerance, they can simply increase the tool length compensation value (by a value of 0.010 inch is usually good enough). This will make the machine think that the tool is longer than it really is - keeping it away from the surface being machined. Once the tool has machined the surface, the program is stopped and the surface is measured. The offset will then be adjusted based upon the findings of the measurement. The tool will then be rerun. The next time it cuts, the surface will be within the tolerance band.

Sizing considerations

Explain that most cutting tools used on machining centers don't machine critical Z surfaces. Center drills, drills, taps and reamers, for example, seldom have critical depth tolerances. But with counter-boring tools and certain milling cutters, it's likely that depth tolerances are more critical. As tools wear, their tendency will be to shorten in length. And again, with most tools, they won't shorten enough during their lives to cause a dimension to go out of tolerance. But for those tools that machine extremely critical depth tolerances, the operator may have to reduce the tool length compensation value before the tool is completely dull.

Cutter radius compensation

Just as tool length compensation allows the programmer to ignore the precise length of each tool, so does cutter radius compensation allow them to ignore the precise size (radius) of certain milling cutters. Point out that, unlike tool length compensation that is used for every tool in every program, cutter radius compensation is only used for milling cutters - and only when milling on the periphery of the cutter, as when contour milling.

There are other subtle advantages to using cutter radius compensation. As with tool length compensation, cutter radius compensation allows sizing and trial machining. If an XY surface is not being machined to size, an offset can be adjusted. Also, cutter radius compensation makes programming easier. Without cutter radius compensation, the programmer must specify all XY coordinates for the contour to be milled based upon the cutter's centerline path - which doubles the needed calculations. With cutter radius compensation, the programmer specifies all XY coordinates on the work surface. In many cases, this means print dimensions can be used in the program.

Programming considerations

Point out right away that cutter radius compensation tends to be one of the more difficult programming features to fully master. Frankly speaking, it is a little difficult to explain this feature. I'll give you a few pointers that have helped me.

There are three steps to programming cutter radius compensation:

  1. Instate it
  2. Machine with it
  3. Cancel it

By far, the most difficult step for you to explain and for students to understand is instating cutter radius compensation. Start by pointing out that there are three G codes used with cutter radius compensation. One of G41 or G42 is used to instate cutter radius compensation. G40 is used to cancel it. I have two ways to explain whether to use G41 or G42. If students have manual milling experience, they understand the difference between climb and conventional milling. Then it's easy:

  • G41: Climb milling
  • G42: Conventional milling

This assumes that they are using a right hand milling cutter (spindle running forward, M03). To help them remember, point out that climb comes before conventional (alphabetically) and 41 comes before 42 (numerically). So if they're going to be climb milling, G41 will be used to instate cutter radius compensation. If they're going to be conventional milling, G42 will be used to instate.

If students don't understand the difference between climb and conventional milling (they probably have had other problems to this point in the class), it be more difficult to explain whether to use G41 or G42. I'll say something like: "Look in the direction the cutter will be moving during its cutting operation. You may have to rotate the print to do so. Looking in this direction, ask yourself which side of the workpiece the cutter is on. If the cutter is on the left, you'll be using G41 to instate cutter radius compensation. If the cutter is on the right, you'll use G42." And to help them remember, again, point out that left comes before right (alphabetically) and 41 comes before 42 (numerically).

Unfortunately, determining whether to use G41 or G42 is just the beginning. Point out that as with tool length compensation, an offset is used with cutter radius compensation - and that most controls use a D word to specify the offset number used with cutter radius compensation. With some controls, there are two registers for each offset - one for the tool's length and the other for its radius. With this kind of control the D word should be made the same as the tool station number (and the tool length compensation number).

But most controls have but one register per offset. With these controls, the offset number that corresponds to the tool station number is already being used to specify the tool length compensation value. So another offset must be chosen. We recommend adding a constant number (that is larger than the number of tools the machine can hold) to the tool station number to come up with the offset to be used with cutter radius compensation. If the machine can hole twenty tools, for example, add thirty to the tool station number to come up with the cutter radius compensation offset number. For tool five, for example, use offset number five to specify the tool's length and offset thirty-five to specify its radius.

There is one more thing related to instating cutter radius compensation - and it tends to be the most difficult thing for students to understand. Explain that before instating cutter radius compensation, the milling cutter must first be positioned to a position that clears the first surface to mill. I call this the prior position. The next drawing shows our example.

{short description of image}

Shown as point one in the drawing, notice that this position is still the centerline coordinate of the milling cutter. It must be at least the cutter radius away from the first surface to mill for the largest cutter you anticipate using. That is, this prior position also determines the maximum cutter size.

Say, for example, we intend to use a 1.0 inch diameter cutter for the example above. The X coordinate for point one must be at least X6.5 (this will bring the cutter perfectly flush with the surface to mill. If the setup person enters anything larger than 0.5 in the cutter radius compensation offset, an alarm will be sounded. For this reason, most programmers make the prior position a little further away from the first surface to mill. A position of X6.6 in our example would allow a 1.125 diameter cutter to be used. Actually any cutter up to 1.2 inches in diameter (0.6 radius) can be used before an alarm will sound.

To actually instate, a command including the G41 or G42 (whichever is appropriate), the D word, and a movement in X and/or Y to the first surface to mill will be given. Note that this can be done in a rapid motion (if the cutter is clear of the workpiece) or a straight line motion. Cutter radius compensation cannot be instated during a circular motion. In our case, cutter radius compensation will be instated during a motion from point one to point two.

Once cutter radius compensation is instated, it remains in effect until it is cancelled. It is during these motions under the influence of cutter radius compensation that the contour is milled (in our case only one surface is milled - a movement to point three). In many cases, however, there will be several surfaces to mill. Point out that the control will be constantly looking ahead in the program to determine what's coming up in the next command. Based upon what it sees, it will continue to keep the cutter on the left or right side of all surfaces it sees (based upon whether G41 or G42 is used to instate).

Finally, cutter radius compensation must be cancelled. And again, G40 is used to cancel. We recommend retracting the tool in Z (if possible) prior to cancelling. So after the movement from point two to point three, the tool will be retracted (at rapid) and a G40 will be specified.

Here is an example program that shows the three steps to using cutter radius compensation. Note that we're assuming the control has but one register per offset.

  • O0002 (Program number)
  • N005 T01 M06 (Place 1.0 milling cutter in spindle)
  • N010 G54 G90 S500 M03 T02 (Select coordinate system, absolute mode, start spindle and get the next tool ready)
  • N015 G00 X6.6 Y-0.6 (Rapid to first XY position)
  • N020 G43 H01 Z0.1 (Instate tool length compensation, rapid to Z0.1)
  • N025 G01 Z-1.1 F50.0 (Fast feed to work surface)
  • N030 M08 (Turn on coolant)
  • N035 G42 D31 X6.0 (Instate cutter radius compensation, note conventional milling is being done)
  • N040 Y4.6 F6.0 (Mill right side)
  • N045 G00 Z0.1 (Retract)
  • N050 G40 M09 (Cancel cutter radius compensation, turn off coolant)
  • N055 G91 G28 Z0 M19 (Return to tool change position, orient spindle)
  • N060 M01 (Optional stop)
  • .
  • .
  • .

Trial machining considerations

Explain that cutter radius compensation allows a setup person to easily trial machine XY surfaces. When they see an XY surface that has a critical tolerance, they can simply increase the cutter radius compensation value (by a value of 0.010 inch is usually good enough). This will make the machine think that the cutter is larger in diameter than it really is - and it will keep it away from the surface being machined. Once the tool has machined the surface, the program is stopped and the surface is measured. The offset will then be adjusted based upon the findings of the measurement. The tool will then be rerun. The next time it cuts, the surface will be within the tolerance band.

Sizing considerations

With milling cutters that machine critical XY surfaces it's likely that tool wear will impact the surfaces being machined. As tools wear, their tendency will be to become smaller in diameter. And again, with most tools, they won't shrink enough during their lives to cause a dimension to go out of tolerance. But for those tools that machine extremely critical XY tolerances, the operator may have to reduce the cutter radius compensation value before the tool is completely dull.

What about turning centers?

While our discussions have applied only to machining center compensation types, many of these same points apply to turning center compensation types (geometry offset, wear offsets, and tool nose radius compensation). The entire introduction will apply nicely Geometry offsets are similar to fixture offsets in that they are used to assign program zero. And tool nose radius compensation is quite similar to cutter radius compensation. Rest assured that our Turning Center Curriculum does include appropriate presentations for these features.

Here are two links that bring you to our CNC curriculum page and our CNC educators page. Use these two links to learn more about how you can use our key concepts approach in your own classes.

End of article (M01)

Top of page

Time saver: Program Offset Entries Whenever Possible

As you know, certain offsets must be entered before a job can be run. For machining centers, these offsets include fixture offsets, tool length compensation offsets, and cutter radius compensation offsets. For turning centers, they include geometry offsets, wear offsets, and tool nose radius compensation offsets.

In most CNC applications, setup people are responsible for entering offsets manually - during the setup. Indeed, one of the main benefits of most compensation types is that they allow the separation of programming tasks from setup tasks. For those tooling-related variables a programmer won't know when programming (like a cutting tool's exact length or radius), a setup person will handle them at the time the setup for the job is made.

While compensation types do, in most cases, make life easier for programmers, there are times when you will know (or will find out) what the values of certain offsets will be long before a setup is made. We make a very important statement about this: Any time you know the values of offsets prior to running a job, you can probably reduce the time a machine is down between production runs (setup time) by programming the offset settings.

Tool length compensation offsets

Consider, for example, a company that measures tool length compensation values for tools used on machining centers off line. A tool setter (probably in the company's tool crib) assembles and measures these values. They probably write tool length values down on a piece of paper for the setup person to copy into the machine during setup.

Instead of writing down the offset settings, the tool setter could be entering (or modifying) a tool offset entry program as long as they have a computer with a simple text editor close by. Consider this template program:

  • O1000 (Offset entry template program)
  • G90 G10 L1 P1 R20.0000
  • G90 G10 L1 P2 R20.0000
  • G90 G10 L1 P3 R20.0000
  • G90 G10 L1 P4 R20.0000
  • G90 G10 L1 P5 R20.0000
  • G90 G10 L1 P6 R20.0000
  • G90 G10 L1 P7 R20.0000
  • G90 G10 L1 P8 R20.0000
  • G90 G10 L1 P9 R20.0000
  • G90 G10 L1 P10 R20.0000
  • G90 G10 L1 P11 R20.0000
  • G90 G10 L1 P12 R20.0000
  • G90 G10 L1 P13 R20.0000
  • G90 G10 L1 P14 R20.0000
  • G90 G10 L1 P15 R20.0000
  • G90 G10 L1 P16 R20.0000
  • G90 G10 L1 P17 R20.0000
  • G90 G10 L1 P18 R20.0000
  • G90 G10 L1 P19 R20.0000
  • G90 G10 L1 P20 R20.0000
  • M30 (End of program)

Notice all the G10 commands. These are data setting commands. G90 tells the control to overwrite the current offset register value with the one included in this command. The L word tells the control the kind of data to be set (L1 specifies tool offset data for most Fanuc controls). The P word specifies the offset number. We've included twenty tools in this template program. If the job doesn't require twenty tools, the tool setter will simply delete the unneeded commands. The R word specifies the value to be entered into the offset. Note that with this template program, the tool setter must simply modify the R word in each command.

In our template program, we've included a value of 20.0000 for all R words, which is longer than any tool the company uses. If the tool setter doesn't have all the needed components to assemble a given tool, they'll leave the value as 20.000 and the setup person will easily see which tool/s have not been assembled and measured. (Note that if the setup person accidentally runs the program with an offset set to 20.0000, the tool will be run well above the setup.)

Again, as the tool setter assembles and measures a given tool, they will edit the appropriate R word in this program. After loading all cutting tools in the machine, the setup person will simply load this program and run it once. Doing so will enter all tool offsets. While this assumes your company has a pretty good distributive numerical control (DNC) system, this can be done within seconds. Entering twenty offsets manually will take much more time and is an error-prone task.

Note that there are tool length measuring devices that will actually create the program shown above (or one much like it). Go to the Parlec website to see one. This eliminates the need for the tool setter to type the offset value, and also eliminates the possibility for typing mistakes.

Tool nose radius compensation offsets

Again, any time you know the value of offsets prior to making a setup, it is wise to program offset entries. Another example has to do with tool nose radius compensation for turning centers.

As you know, the setup person must enter the tool type (a code number) and the tool nose radius for any single point cutting tool that uses tool nose radius compensation. If the setup person forgets to do so (and current values are zero), the control will behave just as if tool nose radius compensation is not being used - and the workpiece will not be machined correctly.

Most programmers will specify the tool nose radius to be used for each tool right on the setup sheet, meaning they do know the value of tool nose radius compensation offsets as the program is written. Consider this program.

  • O0001 (Program including tnr compensation offsets)
  • N005 G10 P2 R0.0312 T3
  • N010 G10 P5 R0.0156 T2
  • N015 T0101 M41
  • N020 G96 S600 M03
  • N025 G00 X3.2 Z0.005
  • .
  • .
  • .

Notice that this program begins with two G10 commands. In line N005, the R register of offset number two is set to 0.0312 and the T is set to a value of 3 (a turning tool). Offset four's R is set to 0.0156 and T is set two 2 (a boring bar). These commands keep the setup person from having to enter the offset values manually (saving time) and eliminate the possibility of forgetting them - or entry mistakes.

Fixture offsets

One last example we'll mention is related to fixture offsets. If you make qualified setups that are repeated on a regular basis, the program zero location/s will be in exactly the same location every time the setup is made. For the first time the setup is made, it may be necessary to actually measure these values and manually enter them. But for every subsequent time the setup is made, these same numbers must be re-entered.

Again, if you know the values of offsets, why would you force a setup person to manually enter them? Consider this program:

  • O0001 (Program including fixture offsets)
  • N005 G90 G10 L2 P1 X-12.1127 Y-10.2124 Z-13.1323
  • N010 G10 L2 P2 X-13.2140 Y-12.0144 Z-12.0147
  • N015 T01 M06

For many Fanuc controls, L2 specifies that you're setting fixture offsets. The P word specifies which fixture offset is being set. And X, Y, and Z specify the values going into the fixture offset registers.

End of article (M01)

Top of page

G-code primer: Outputting Fixture Offset Settings

Programs provided by Steve Legg of Messier-Dowty

Two special commands are used in custom macro B to send data out through the communications port (RS-232c port). One called BPRNT allows the output of alpha-numeric text data and a few special characters, as well as macro variable values formatted as integer numbers with a variable number of significant digits. BPRNT outputs variable numeric data as a combination of 8-bit characters that yield 32-bit binary values. I've seen little use for BPRINT.

DPRNT also allows the output of alpha-numeric text data and a few special characters, as well as macro variable values, formatted with a variable number of decimal places. DPRNT outputs variable numeric data as text characters. In most applications, DPRINT will be your command of choice for outputting data through the communications port.

If your machine has custom macro B, you can use the DPRNT command any time you want to output information. This command is used, for example, with touch probe-based post-process gauging systems to output the measurements taken by the probe.

In this article, we'll be demonstrating the use of DPRNT for the purpose of outputting fixture offset settings. You may know that Fanuc provides a standard way to output the current values of all tool offset registers (for tool length and cutter radius compensation values). But this action does not include fixture offset registers.

If you have qualified tooling and jobs are often repeated, the values of fixture offsets for those jobs are known, but must still be re-entered each time the job is run. Long prove outs or large batches of parts sometimes have to be interrupted too. Recording, then changing fixture offset values allows operators on a multi-pallet machining centre to readily switch between jobs, proving out new work during the day and afternoon shifts (for example), then running production on another pallet at night. Setup people commonly write these values down somewhere, a practice that leaves room for copying mistakes and information loss. One of the programs we'll be showing outputs a nicely formatted list of all current fixture offset settings instead, quickly eliminating the possibility of recording an incorrect value, or losing correct ones.

When the job is rerun, the setup person must re-enter the fixture offset values, which takes time, and again, opens the door to entry mistakes. If your machine/s allow G10 (data setting by program command), our second program will be very helpful. It actually outputs a program including the appropriately formatted G10 commands. When the job must be re-run, the setup person simply loads and runs this program.

Before we show the programs, you must understand a little about the DPRNT command. It is also important to know how fixture offsets are referenced within custom macro.

Opening and closing the communications port

Prior to giving the DPRNT command/s, you must open the communications port for transmission with POPEN. And when you're finished, you must close the port with PCLOS.

Understanding DPRNT

With DPRNT, you can output a series of alpha characters and numerical values, including any value stored in a variable. For numerical values, you must also specify the decimal format to be used when the value is printed. The best way to present the DPRNT command is to show an example:

  • #5=1
  • #30=-32.8616
  • POPEN
  • DPRNT[AXIS*#5[10]***#30[34]]
  • PCLOS

Notice how the commands POPEN and PCLOS commands surround the DPRNT statement/s. Again, they open and close the communications port.

Everything within the expression to the right of the DPRNT word is enclosed in brackets. This is part of the syntax for DPRNT. Alpha characters (like the word AXIS) are printed exactly as they appear. Each asterisk character will be printed as a space character.

Notice the bracketed numbers to the right of local variables #5 and #30. They specify the decimal format to be used for printing the current values of #5 and #30. For #5, which is currently set to a value of one (1), the value will be printed with one place to the left of the decimal point and zero places to the right of the decimal point. In essence, this value will print a whole number.

For #30, the value (-32.8616) will be printed with three significant digits to the left of the decimal point and four digits to the right of the decimal point. Since our current value (-32.8616) has only two significant values to the left of the decimal point (32) only two values will be printed to the left of the decimal point.

The result of this command, when printed, will be the text:

AXIS 1 - 32.8616

Accessing the values of fixture offsets

A series of system variables gives you access to fixture offsets. Unfortunately, the system variable numbering varies from one Fanuc control model to another, so you'll have to find those that are used on your particular control model. For a 10, 11, and 15 series control, among others, they happen to range in the 5200 series. Here is the list of system variables for these control models:

  • #5201: is the X value of fixture offset number one
  • #5202: is the Y value of fixture offset number one
  • #5203: is the Y value of fixture offset number one
  • #5204: is the B value of fixture offset number one
  • #5221: is the X value of fixture offset number two
  • #5222: is the Y value of fixture offset number two
  • #5223: is the Y value of fixture offset number two
  • #5224: is the B value of fixture offset number two
  • #5241: is the X value of fixture offset number three
  • #5242: is the Y value of fixture offset number three
  • #5243: is the Y value of fixture offset number three
  • #5244: is the B value of fixture offset number three
  • #5261: is the X value of fixture offset number four
  • #5262: is the Y value of fixture offset number four
  • #5263: is the Y value of fixture offset number four
  • #5264: is the B value of fixture offset number four
  • #5281: is the X value of fixture offset number five
  • #5282: is the Y value of fixture offset number five
  • #5283: is the Y value of fixture offset number five
  • #5284: is the B value of fixture offset number five
  • #5301: is the X value of fixture offset number six
  • #5302: is the Y value of fixture offset number six
  • #5303: is the Y value of fixture offset number six
  • #5304: is the B value of fixture offset number six

Notice how each fixture offset system variable is twenty greater than the previous one. That is, the X system variable for fixture offset number two is twenty greater than the X system variable for fixture offset number one. This trend repeats for every axis of every fixture offset. This will be important to know as you study the programs below.

Printing the current list of fixture offset settings

Here is an example of the text that will be sent out through the communications port when our first program (O5555) is run:

G 54

  • AXIS 1 - 32.8616
  • AXIS 2 - 34.2843
  • AXIS 3 - 49.9746
  • AXIS 4 269.917

G 55

  • AXIS 1 - 31.5296
  • AXIS 2 - 34.2843
  • AXIS 3 - 51.3859
  • AXIS 4 359.917

G 56

  • AXIS 1 - 30.1183
  • AXIS 2 - 34.2843
  • AXIS 3 - 50.0539
  • AXIS 4 89.917

G57

  • AXIS 1 - 31.4503
  • AXIS 2 - 34.2843
  • AXIS 3 - 48.6426
  • AXIS 4 179.917

G58

  • AXIS 1 - 32.8466
  • AXIS 2 - 34.2843
  • AXIS 3 - 50.2202
  • AXIS 4 280.206

G59

  • AXIS 1 - 30.1333
  • AXIS 2 - 34.2843
  • AXIS 3 - 49.8083
  • AXIS 4 100.206

Again, the output of this program will be a simple text file that can be printed and included with the setup documentation for the job. The next time the job is run, the setup person will enter the values into the control from this sheet.

Here is the program that outputs the current fixture offset settings:

  • O5555 (OUTPUT FIXTURE OFFSET DATA)
  • #9=6. (SET NO. OF FIXTURE OFFSETS -- MAX VALUE=6)
  • #18=4. (SET NO. OF AXIS REGISTERS -- MAX VALUE=15)
  • #4=1. (INITIALIZE FIXTURE OFFSET COUNTER)
  • POPEN (OPEN THE OUTPUT PORT)
  • WHILE [#4 LE #9] DO 1 (SAVE ALL FIXTURE OFFSET DATA)
  • #33=5200. + [#4 * 20.] (SET FIXTURE OFFSET POINTER #)
  • #32=53. + #4 (SET FIXTURE OFFSET NAME)
  • #5=1. (INITIALIZE FIXTURE OFFSET REGISTER NO.)
  • DPRNT[]
  • DPRNT[]
  • DPRNT[G#32[20]] (OUTPUT THE FIXTURE OFFSET NAME) DPRNT[]
  • WHILE [#5 LE #18] DO 2 (SAVE ALL REGISTERS IN A FIXTURE OFFSET)
  • #31=#33 + #5 (SET REGISTER POINTER #)
  • #30=#[#31] (GET THE REGISTER VALUE)
  • IF [#5 GE 4.] GOTO 200 (IF WE WILL OUTPUT A ROTARY AXIS)
  • N100 (OUTPUT A LINEAR AXIS REGISTER VALUE)
  • DPRNT[AXIS*#5[10]***#30[34]]
  • GOTO 300
  • N200 (OUTPUT A ROTARY AXIS REGISTER VALUE)
  • DPRNT[AXIS*#5[10]***#30[43]]
  • GOTO 300
  • N300 #5=#5 + 1. (INCREMENT REGISTER COUNTER)
  • END 2 #4=#4 + 1. (INCREMENT FIXTURE OFFSET COUNTER)
  • END 1
  • PCLOS (CLOSE THE OUTPUT PORT)
  • M30

Outputting a G10 program

Again, the previous program does require the setup person to manually enter the fixture offset values each time the job is run. If your machine allows the G10 command (data setting by programmed command), as most current machines do, you can actually eliminate the need for manual fixture offset entry. Here is an example of a program that will be created:

  • O0001
  • M00
  • G 54
  • G90 G10 L2 P 1 X- 32.8616 Y- 34.2843 Z- 49.9746 B 269.917
  • G 55
  • G90 G10 L2 P 2 X- 31.5296 Y- 34.2843 Z- 51.3859 B 359.917
  • G 56
  • G90 G10 L2 P 3 X- 30.1183 Y- 34.2843 Z- 50.0539 B 89.917
  • G 57
  • G90 G10 L2 P 4 X- 31.4503 Y- 34.2843 Z- 48.6426 B 179.917
  • G 58
  • G90 G10 L2 P 5 X- 32.8466 Y- 34.2843 Z- 50.2202 B 280.206
  • G 59
  • G90 G10 L2 P 6 X- 30.1333 Y- 34.2843 Z- 49.8083 B 100.206
  • M30

Note that this program does leave the control in fixture offset number six (G59), so be sure to include the initial fixture offset instating command at the beginning of your machining program/s. Also, notice the M00 at the beginning of the program. Since this program will overwrite the current settings of all fixture offset registers, this command gives the operator one chance to abort the program if they've run it by mistake.

Here is the custom macro that outputs the G10 program.

  • O5555 (OUTPUT FIXTURE OFFSET PROGRAM)
  • #9=6. (SET NO. OF FIXTURE OFFSETS -- MAX VALUE=6)
  • #18=4. (SET NO. OF AXIS REGISTERS -- MAX VALUE=15)
  • #4=1. (INITIALIZE FIXTURE OFFSET COUNTER)
  • POPEN (OPEN THE OUTPUT PORT)
  • DPRNT[]
  • DPRNT[O0001]
  • DPRNT[]
  • DPRNT[M00]
  • WHILE [#4 LE #9] DO 1 (WRITE A FIXTURE OFFSET PROGRAM)
  • #33=5200. + [#4 * 20.] (SET FIXTURE OFFSET POINTER #)
  • #32=53. + #4 (SET FIXTURE OFFSET NAME)
  • DPRNT[]
  • DPRNT[G#32[20]] (OUTPUT THE FIXTURE OFFSET NAME)
  • #24=#[#33 + 1.] (GET THE X-AXIS REGISTER DATA)
  • #25=#[#33 + 2.] (GET THE Y-AXIS REGISTER DATA)
  • #26=#[#33 + 3.] (GET THE Z-AXIS REGISTER DATA)
  • #2=#[#33 + 4.] (GET THE B-AXIS REGISTER DATA)
  • DPRNT[G90*G10*L2*P#4[10]*X#24[34]*Y#25[34]*Z#26[34]*B#2[43]]
  • #4=#4 + 1. (INCREMENT FIXTURE OFFSET COUNTER)
  • END 1
  • DPRNT[]
  • DPRNT[M30]
  • PCLOS (CLOSE THE OUTPUT PORT)
  • M30

A limitation of DPRNT

You may be wondering why, if the control has custom macro, we use G10 for the purpose of getting fixture offsets re-entered. The commands:

  • #5201=#24
  • #5202=#25
  • #5203=#26

for example, can be used to set the X, Y, and Z registers of fixture offset number one to the current values of #24, #25, and #26 respectively. These commands can be used instead of the G10 command. However, we've run into a limitation of the DPRNT command when trying to output the text "#5201=#24".

There seems to be no way (we know of) to print certain characters like the pound sign (#) and the equal sign (=). This eliminates the possibility of using the commands shown above to re-enter the fixture offset setting commands. This means the machine must have the G10 option enabled in order for this program to work.

A request for help!

If you know of a way to use the DPRNT command to print these special characters, please let us know. Simply email us at lynch@cncci.com. We'll include your technique in an upcoming issue of The Optional Stop newsletter.

Again, thanks to Steve Legg for providing these excellent programs. It is exactly this kind of information The Optional Stop newsletter is intended to provide. If you have techniques you would like to share, be sure to let us know!
End of article (M01)

Top of page

Parameter preference: Setting Up User Defined G and M codes

Parameters control countless things about the way your CNC machine tools behave. In each Parameter preference segment, we will expose parameters that have an important impact on how your machines run. But first, a disclaimer. Parameters vary from one Fanuc control model to another - as do the actual functions they control. Always check in your Fanuc Operators manual and/or Maintenance manual to confirm the parameter number and settings we show. Never blindly change a parameter! If there is any doubt about what the parameter does, contact your machine tool builder to learn more.

The application

As you know, there are many G and M codes included with your CNC machine tool. These words have a fixed usage that is determined by the control manufacturer (Fanuc in our case) and the machine tool builder. What you may not know is that you have a way of creating your own G and M codes - you can even change the function of those that your machine currently has.

Though this application is commonly thought of as a custom macro application, note that most machines don't require custom macro in order for you to create user defined G and M codes. By far, the best applications for user defined G and M codes involve custom macro techniques, but in this article, we'll limit our discussions to applications that do not require custom macro.

One example application involves safety words that many programmers like to include at the beginning of their programs. These words ensure that the machine is in the appropriate states (commonly the same states as when the machine is first turned on). Here is an example of a series of safety commands for a machining center program:

  • O0001 (Program number)
  • N005 G17 G20 G40 (XY plane, inch mode, cancel cutter comp.)
  • N010 G49 G64 G80 (Cancel tool length comp., normal cutting mode, cancel canned cycles)
  • N015 G90 G94 G98 (Select absolute mode, feed per minute, initial plane for canned cycles)
  • .
  • .
  • .

Remember that there is a limitation when it comes to how many G codes can be included in one command (with most Fanuc controls, it is three). This is why we've broken the safety words into three commands.

As stated, many programmers like to include these commands (or something like them) at the beginning of all programs. To shorten the amount of words needed in your program, you can define your own G or M code which would instate all of these words.

When picking the G or M code number you wish to define, you must be careful not to overwrite a current G or M code since Fanuc also allows you to redefine any G or M code as well as create new ones. To ensure that you don't pick one that's already in use, Fanuc allows you to define G and M codes over a value of one-hundred (G101 or M101, for instance).

So instead of invoking the safety words given in the three commands shown above, you can simply have the command

  • N005 G101 (Instate all safety words)

do so (after defining G101, of course).

You probably already have many programs that are run on your CNC machine/s. If you add G101 (or any new G code) now, it's likely that many programs will have to be changed. This is one time when re-defining a current G or M code can be helpful. If you can pick an appropriate G or M code, you may save a lot of editing.

In our case, we might want to change the function of G90 - the absolute mode selector. If we do, whenever the control executes a G90, it will invoke all of safety words and perform the normal function of G90. Since most programmers include a G90 at the beginning of all programs (and at every tool change), we can be sure that the machine is always in the desired states when programs are run.

How it works

There is really nothing magical going on. All we do to create a user defined G or M code is set up a cross-reference within the control. A series of parameters is used for this purpose. In the case of defining the G101, for example, a parameter is set to tell the control that whenever a G101 is executed, it must run a pre-determined program. Within this special program, we'll include all of the safety words.

The same is true for re-defining a current G or M code. And if the invoking word (G90 in our example) is included within the special program, the control will perform its normal function (selecting the absolute mode in our case). The control will not try to execute the special program a second time.

Finding the parameters

As always, we recommend starting in the Fanuc Operator's Manual in the section that is most closely related to the parameter/s in question. Since user defined G and M code parameters are associated with custom macro, I start by looking at the custom macro descriptions.

Toward the end of the custom macro descriptions in the 15 series manual, I find three headings of interest: Macro call using G code, Macro call using M code, and Subprogram call using M code. For M codes, I recommend using Macro call using subprogram, since it most closely emulates how true M codes work.

There are ten parameters related to user defined G codes, meaning up to ten user defined G codes can be defined. They range from parameter 7050 through 7059 (again, for a 15 series control). I notice that each is related to a pre-determined program. 7050 is related to program O9010. 7051 is related to O9011. And this continues through parameter 7059, which is related to program O9019.

User defined M code parameters are similar. They range (for this control) from parameters 7071 through 7079. Program O9001 is related to parameter 7071. Program O9002 is related to parameter 7072. And this continues through parameter 7079, which is related to program O9009.

Creating a user defined G code

Say I want to create a new user defined G code (G101). To do so, I must first set parameter 7050 (or any of the available user defined G code parameters) to a value of 101. I must also load/type program O9010 (or the corresponding program number) into the control:

  • O9010
  • G17 G20 G40
  • G49 G64 G80
  • G90 G94 G98
  • M99

Note that this program must end with an M99, like a subprogram.

From this point, whenever a G101 is read by the control, it will execute program O9010, and invoke the various safety words.

Changing the function of a current G code

The same thing goes for re-defining a current G code. Say I want G90 to be used to invoke all safety words, and, of course, to set the absolute mode. This time I'll set parameter 7050 to a value of 90. And here is the related program:

  • O9010
  • G17 G20 G40
  • G49 G64 G80
  • G90 G94 G98
  • G90
  • M99

Notice that the only difference is the addition of a G90 word. Remember, this will cause the control to perform the normal function of G90 - it will not try to execute program O9010 a second time.

An application for user defined M codes

Our simple application for user defined M codes is related to making two similar machines more compatible with regard to M codes. Consider, for example, two turning centers made by different manufacturers. One uses M41 and M42 for low and high spindle range. The other uses M23 and M25.

Any program that must be run in both machine will have to be edited on a regular basis. But we can make these two machines more compatible by adding two user defined M codes to one of the machines. We'll pick the machine that uses M25 and M25.

On this machine (assuming it has a 15 series control), we'll set parameter 7071 to a value of 41 and parameter 7072 to a value of 42. From this point on, whenever the control sees an M41, it will execute program O9001. When it sees an M42, it will execute program O9002. Here are the two programs:

  • O9001
  • M23
  • M99
  • O9002
  • M25
  • M99

Notice that all we've done is included the appropriate M code for low or high spindle range in each program. Again, when the control reads an M41, it will execute program O9001 and perform an M23. When it reads an M42, it will execute program O9002 and perform an M25.

There are countless applications for user defined G and M codes. We're showing some pretty simple ones. To learn more, you'll need to learn more about custom macro - which is Fanuc's version of parametric programming. Note that we offer several training products that can help your learn custom macro.

End of article (M01)

Top of page

Safety tip: Watch Out For That Tailstock Center!

Many turning centers, commonly called universal style turning centers, have the ability to do chucking work, bar work, and shaft work. These machines have horizontal spindles, meaning the workpiece is loaded and held in a horizontal orientation. With chucking work and most bar work, the tailstock is not used. It is usually retracted far out of the way. Our safety tip has to do with how you manually load workpieces when doing chucking and shaft work.

We recommend getting in the habit of holding workpieces when loading them into horizontal spindle turning centers from below. Never allow your hand to get behind the workpiece (grabbing it from the right end) during the loading process. While this may be okay for loading in chucking applications, when you're performing shaft work - and the tailstock center is in close proximity - your hand will be right in the way of the tailstock center if you grab the workpiece from its end.

As you know, most turning centers use foot-pedals to activate the chuck and tailstock - and with some machines these foot-pedals are quite close to one another. If you step on the wrong one by mistake, the tailstock will advance when you're expecting the chuck to close. And again, if your hand is in the way, you'll be seriously injured. If you always hold and support workpieces from below whenever loading them, your hand will never be in the way of the tailstock center.

End of article (M01)

Top of page