4 Reasons to Use Safety Commands
Safety commands help safeguard CNC applications from common programming or operation errors.
Share
DMG MORI - Cincinnati
Featured Content
View MoreI have received numerous questions about CNC over the years, many having to do with problems or issues with machine usage. Often, these issues have been presented as machine or control malfunctions, but were actually caused by programming or operation errors. Some resulted in rather odd machine behavior and were quite difficult to diagnose. Others involved somewhat hidden or unknown CNC features that users were unaware of.
The examples I show fall into the category of changed initialized states. You probably know that a CNC machine will automatically select certain modes when powered up. Many programmers depend on the machine retaining these modes, so they do not include related G codes, commonly called safety commands, in their programs. This can be a terrible mistake, as you are about to see.
One phone call I have received multiple times was about ridiculously slow feed rates on a turning center. The position displays showed evidence of movement (the one-ten-thousandths register incremented every second or so), but motion was undetectable. The reason was related to an incorrect subprogram calling command. Instead of specifying the subprogram call with M98, they used G98. They found the mistake, of course, and changed the G98 to M98. What they didn’t realize, however, is that they had inadvertently placed the lathe in per-minute feedrate mode. The intended per-revolution feedrate of 0.010-inches per revolution (ipr) was being taken 0.010-inches per minute (ipm). This is, indeed, a very slow feed rate!
One user complained that motions the machine was making were much smaller than they should be. It appeared to them that a tiny workpiece was being machined very close to the machine’s starting position. This turned out to be a mistyped G-code problem. They had intended to instate cutter compensation with G41, but did so with G21. Again, they quickly discovered and corrected the problem, but did not realize that they had placed the machine in metric mode. Instead of taking programmed coordinates in inches, the machine was moving in millimeters. So the machine was trying to make a “workpiece” 25.4 times smaller than it should be.
The two odd issues just described probably occurred many times more than I ever heard about. They are examples of issues that would go away if the user simply cycled the power. After restarting the machine and the initialized states were reselected, the problem would disappear. But this must be disconcerting to the user, since they would be left wondering what caused the problem in the first place. It also gives way to users incorrectly thinking that a machine could just go haywire and do unexpected things for no reason.
Another common phone call is related to an X- or Y-axis overtravel on a machining center during the program’s first motion command. Motion commands in the program appeared (and were) correct, but every time the operator started the cycle, the machine would go the wrong way and overtravel. After much discussion the first time I received this call, it was determined that the user had been using X- or Y-axis mirror image for the previous program. The setup person had turned it on manually, using the “Handy Settings” display screen. Since the previous program was written accordingly, it worked fine. But the current program was not set up to run with mirror image. Turning off mirror image, either manually or commanding the mirror image cancellation G code (G50.1 with current FANUC CNCs), solved the problem.
Yet another odd, motion-related machining center problem involved drilling a series of holes after a milling operation. The drilled holes were all out of location. We confirmed that programmed coordinates were correct, but none of the holes were where they were supposed to be. We eventually discovered that the previous tool, a milling cutter, was programmed using cutter radius compensation (G41 or G42), but the programmer did not cancel it (with G40) when the tool was finished. Since none of the drill’s motions broke any rules of cutter radius compensation, all subsequent X- and Y-axis motions it made were being modified by the previously used cutter-radius compensation offset.
It is for these reasons that you should include a series of G codes in your programs to ensure that initialized states are still in effect. The first two of these problems would not have occurred if the programmer had placed safety commands at the beginning of each program. The last two problems mentioned would have required the safety commands to be at the beginning of each cutting tool.
Older FANUC CNCs allow just three compatible G-codes per command, meaning you must provide multiple safety commands. Newer CNCs have no such limitation, but you should still break them up if your programs must run on older and newer machines.
Recommended safety commands for machining centers:
- N005 G99 G50.1 G20 (inches per revolution mode, cancel mirror image, inch mode)
- N010 G40 G15 G17 (cancel cutter comp, cancel polar coordinates, XY plane selection)
- N015 G23 G50 G54 (cancel stored stroke limit, cancel scaling mode, normal cutting mode)
- N020 G67 G69 G89 (cancel modal custom macro call, cancel coordinate rotation, cancel canned cycle)
Recommended safety commands for turning centers:
- N005 G99 G20 G18 (inches per revolution mode, inch mode, XZ plane selection)
- N010 G23 G40 G50.1 (cancel stored stroke limit, cancel cutter comp, cancel mirror image)
- N015 G64 G67 (normal cutting mode, cancel custom macro modal call)
FANUC considers some of the features specified above as optional. Invoking the related G code(s) will generate an alarm if the machine does not have them.
Related Content
A Spiral Milling Custom Macro Using Constant Contouring Feedrate
Helical milling or “spiral” milling are helpful when machining a circular pocket that is much larger than the milling cutter diameter.
Read MoreTips for Designing CNC Programs That Help Operators
The way a G-code program is formatted directly affects the productivity of the CNC people who use them. Design CNC programs that make CNC setup people and operators’ jobs easier.
Read MoreObscure CNC Features That Can Help (or Hurt) You
You cannot begin to take advantage of an available feature if you do not know it exists. Conversely, you will not know how to avoid CNC features that may be detrimental to your process.
Read More6 Variations That Kill Productivity
The act of qualifying CNC programs is largely related to eliminating variations, which can be a daunting task when you consider how many things can change from one time a job is run to the next.
Read MoreRead Next
5 Rules of Thumb for Buying CNC Machine Tools
Use these tips to carefully plan your machine tool purchases and to avoid regretting your decision later.
Read MoreRegistration Now Open for the Precision Machining Technology Show (PMTS) 2025
The precision machining industry’s premier event returns to Cleveland, OH, April 1-3.
Read MoreBuilding Out a Foundation for Student Machinists
Autodesk and Haas have teamed up to produce an introductory course for students that covers the basics of CAD, CAM and CNC while providing them with a portfolio part.
Read More