CERATIZIT OptiLine Solid Carbide End Mills
Published

Understanding Vacancy

Custom macro B users tend to struggle with the concept that variables can be vacant. To fully master custom macro B, you must understand the concept of vacancy and its implications.

Share

Custom macro B is Fanuc’s version of parametric programming—and any control claiming to be Fanuc-compatible uses custom macro B as well. Something custom macro B users tend to struggle with is the concept that variables can be vacant. To fully master custom macro B, you must understand the concept of vacancy and its implications.

When a variable is vacant, it has no value. Some people confuse vacancy with zero. Zero is a value. When a variable is vacant,  it has no value. Another term for vacancy is “null.” It is correct to say a vacant variable is null.
The representation for vacancy in custom macro B is #0. The following command will set variable #101 to vacant.

#101 = #0


While this command doesn’t have any real purpose, there are several implications of vacancy that can have a real impact on how you write custom macro programs.

When are variables vacant?

In my experience, vacancy has the biggest impact on local variables (#1 through #33). When you first turn on the machine, and whenever an M99, M02 or M30 is executed, local variables will be in a vacant state. Again, this means
variables #1 through #33 will have no value at this point.

Certain local variables are automatically set to a value when a G65 command is executed—as long as the G65 command includes letter address arguments (such as A, B, C and so forth). Which local variables will be set depend upon which argument letter addresses are specified in the G65 command.

For example, in argument assignment number one (the more common form of argument assignment in custom macro B), the value of letter address A will be placed in #1, B in #2, C in #3, D in #7 and so on (the Fanuc manual shows the rest). Consider the following G65 command:

N060 G65 P1000 A4.0 B6.5 C9.0


When the machine executes program O1000 (specified by the P word in the G65 command), #1 will have a value of 4.0, #2 will have a value of 6.5 and #3 will have a value of 9.0. All other local variables will remain vacant. You can confirm this by looking at the local variable display screen page. You’ll see values next to #1, #2 and #3, but nothing (not even zero) next to the other local variables.

Mandatory Arguments

Your custom macro calling (G65) command will include some important letter address arguments. If the programmer using your custom macro makes a mistake and forgets to include one, your custom macro will behave in an unpredictable manner. You can test the local variable corresponding to each important argument to confirm that it has been included in the calling command. If it has not, you can make the custom macro generate an alarm. Here is an example:
.
IF [#1 NE #0] GOTO 5
#3000 = 100 (A MISSING IN CALL)
N5…
.

As long as letter address A has been included in the G65 command, local variable #1 will have a value—it will not be vacant—and the IF statement test will be evaluated as true. On the other hand, if letter address A has been left out of the call statement (a mistake), the IF statement test will be evaluated as false, and an alarm will sound.

Setting Default Values

There may be other arguments in your G65 command that are almost always set to a given value. You may, for example, be using letter address C to specify whether or not coolant is being used by the custom macro. You almost always use coolant, so you want the default setting for C to be “with coolant.” Only if you happen across a situation when you don’t want coolant will you include a setting for C in the calling command. In this case, you’ll set the value of C to zero (0). Leaving defaulting letter address arguments out of the calling command can dramatically shorten it, minimizing what a programmer must specify. Consider these commands:
.
IF [#3 EQ #0] GOTO 10
M09
GOTO 15
N10 M08
N15…
.

Assuming the programmer leaves letter address C out of the call statement (the normal condition), the IF statement will be evaluated as true, and the M08 will be executed. This turns on the coolant. If C0 is included in the call statement (programmer wants no coolant), the IF statement will be evaluated as false—and the M09 will be executed.

When you are developing a custom macro that will be used by others, we recommend testing the local variables corresponding to all letter address arguments. Test to confirm that all mandatory letter address arguments are included and that all other letter address arguments have a default setting. By doing so, you can confirm that the custom macro will have appropriate input data when it begins the function you intend.
Ingersoll Cutting Tools
Horn USA
CERATIZIT OptiLine Solid Carbide End Mills
GWS Tool Group
Kyocera SGS
Iscar
IMCO
Specialized Plastic Packaging for Cutting Tools
Over 8,000 premium carbide cutting tool options!
Sumitomo
paperlessPARTS
DN Solutions

Related Content

Basics

Understanding The Four Major Behavioral Styles

Companies today are expanding the role of teams in the workplace in an effort to empower employees and improve organizational effectiveness. The more we try to work as a team, the more important it becomes to recognize that people exhibit different behavioral styles.

Read More
Basics

How to Start a Swiss Machining Department From Scratch

When Shamrock Precision needed to cut production time of its bread-and-butter parts in half, it turned to a new type of machine tool and a new CAM system. Here’s how the company succeeded, despite the newness of it all. 

Read More
Basics

What are Harmonics in Milling?

Milling-force harmonics always exist. Understanding the source of milling harmonics and their relationship to vibration can help improve parameter selection.

Read More

7 CNC Parameters You Should Know

Parameters tell the CNC every little detail about the specific machine tool being used, and how all CNC features and functions are to be utilized.

Read More

Read Next

Sponsored

Increasing Productivity with Digitalization and AI

Job shops are implementing automation and digitalization into workflows to eliminate set up time and increase repeatability in production.

Read More
Turning Machines

A History of Precision: The Invention and Evolution of Swiss-Style Machining

In the late 1800s, a new technology — Swiss-type machines — emerged to serve Switzerland’s growing watchmaking industry. Today, Swiss-machined parts are ubiquitous, and there’s a good reason for that: No other machining technology can produce tiny, complex components more efficiently or at higher quality.

Read More

IMTS Elevate Workshop: Make Your Shop a Top Shop

This ½-day program offers attendees insight into the results from this year's Modern Machine Shop Top Shops annual benchmarking survey.

Read More
Ingersoll Cutting Tools