Have it Your Way
Confirming initialized conditions ensures that programs will run as expected.
Programmers often assume quite a bit about their CNC machines when they execute a program. They may, for example, assume that certain initialized states are still set the same as they were when the machine’s power was turned on. If this is not the case, however, the program will not run as expected. Maybe they assume that the measurement system of choice (imperial or metric) is still selected when the program is run. If it is not, the axes will not move as expected.
To avoid the problems associated with such assumptions, you may be in the habit of including a series of commands at the beginning your programs to ensure that initialized states are still active. You could, for instance, include a G20 (imperial) or G21 (metric) command to ensure that the appropriate measurement system has been selected.
While this is a very good habit, one that I would urge all programmers to consider, including such initializing commands in all of your programs can be cumbersome. And if at some future date you must add another command, you’ll probably have to change a lot of programs.
I suggest you create a user-defined G code (like G100) with which to specify and store your program-initializing commands. If you must eventually add more commands, you can easily do so. (This assumes your machine is equipped with custom macro capability. If not, the same result can be accomplished with a simple sub-program call.)
Just as an inappropriately selected G code will cause your programs to behave poorly, so can inappropriately specified parameters. You can ensure that program-related parameters also are set as they must be when your programs are executed. If a given parameter varies among your programs or machines, you can even specifiy the variables in a user-defined G code.
Parameter-setting commands would be overly cumbersome to include in all of your CNC programs, but they are quite easy to include in your user-defined initializing G-code (G100) program, and doing so provides a somewhat transparent benefit over including them in your machining program. Since parameter numbers vary among control models, you may require a different initializing program in each machine, and each will appropriately set your chosen parameters. This cannot be accomplished if you elect to include all initializing commands in the machining program and you expect the program to run on different machines.
To create a user-defined G code with a FANUC 0iD control, you can set parameter number 6050 to a value of 100. After that, the control will execute program number O9010 whenever it reads a G100 word. Initializing commands will be included in program O9010.
For example, maybe you have had issues with program format when using multiple repetitive cycles on a turning center. Newer FANUC controls allow both one-line and two-line multiple repetitive cycles. A parameter controls which program format must be used. If this parameter is not appropriately set, the control will generate an alarm when the program is run, and it will take time to diagnose and correct the problem.
Parameters vary among FANUC control models, so you must reference your parameter manual to find program-related parameters in question. With a 0iD control, the first bit number of the parameter specifies the program format used with multiple repetitive cycles. You can include it in your initializing program to ensure that the control is appropriately set to accept programs utilizing your desired program format method.
Truly, any time you find yourself manipulating parameters in order to get programs to run properly is an example of when you should consider adding commands to your initializing program.
Here is an example for a FANUC 0iD control that is being used on a turning center:
(Normal safety commands)
G18 G20 G23 (XZ plane, imperial measurement system, stored stroke limit off)
G40 G67 G99 (Cancel tool nose radius compensation, cancel modal macro call, per revolution feed rate)
G10 L52 (Select parameter entry mode)
N0000 R110 (Inch, ISO, TV check off)
N0001 R10 (Program format)
N0020 R4 (Output device is memory card)
N3410 R0 (Circular motion tolerance)
N5130 R0 (Thread chamfering amount)
N5133 R300 (Escape amount during multiple G71 and G72)
G11 (Cancel parameter setting mode)
Again, this program will be executed when the control reads a G100 word. The first two commands probably resemble what you currently do in all your CNC programs. They simply ensure that all initialized states are still in effect. The G10 L52 command tells the control to instate the parameter entry mode, and each subsequent command specifies a parameter setting. The N word specifies the parameter number and the R word specifies the setting value. G11 cancels the parameter setting mode.
Note that you can even include parameter settings that may not be directly related to the way your programs run. In this example, we set the punch code format to ISO and turn off tape vertical (TV) check. If this setting is turned on, loaded programs must include the same number of characters in every command (which is never the case). We also set the output device to the memory card.
While the mistakes listed here will not sound an alarm or cause a program to fail, they will cause confusion, wasted time and scrap parts.
Which command is better to get your machine axes to the reference position?
A custom-macro-based system can predict when a tool will become dull.