Custom macro B is FANUC’s version of parametric programming. Judging by the questions, comments and suggestions I regularly receive from readers, it is a feature that many of you have utilized. There are certain questions that I receive on a pretty regular basis. While none by itself is enough to justify its own column, taken together, these questions can provide some helpful information.

• How can I tell if my machine has custom macro B?
There are two ways you can do this. With newer FANUC controls, if you find a display screen soft key labeled MAC VAR, press it. If the display shows a series of variables (such as #1, #2, #3 and so on), the machine has custom macro B. If you can’t find this soft key, try inputting and executing the command using manual data input (MDI):

#100 = 1

If the control executes the command without generating an alarm, the machine has custom macro B.

• Is there a way to get the machine to prompt the operator for an input?
This would be a helpful feature. You might have an application that requires the operator to answer a question prior to continuing. Unfortunately, there is no such feature in custom macro B, but there is a work-around.  You can use the stop with message system variable (#3006) to stop the machine (just like M00) and place a message on the display screen. The message can tell the operators to enter a value into a given variable. The operator then presses the cycle start button to continue. Here’s an example:

#3006 = 110 (ENTER DIA IN #101)

When the control executes this command, it will stop the machine and place the message ENTER DIA IN #101 on the display screen. The operator must then call up the variable page and enter a diameter in common variable #101. Finally, the operator presses cycle start to have the machine continue. In the custom macro, it would be wise to test the value of the entered value for correctness prior to allowing the program to continue.

• Is it better to use G10 or system variables to enter offset data?
There are two ways to enter data into offsets, G10 and system variables. These two commands do exactly the same thing on a 21 series FANUC control:

G10 L2 P1 X13.2726

#5221 = 13.2726

Both of these commands set the X register of fixture offset No.1 to 13.2726. So which is better? Here are two considerations:

First, G10 is more universal when writing values into offsets. Different FANUC control models use different system variables to provide access offsets. So, if you have several controls requiring the same program, you might have to reference different system variable numbers in each program. The same G10 command can be used in all programs.

Second, you must use system variables if you ever need to read from an offset register. G10 does not allow this ability. So the following command will place the current value of fixture offset No.1’s X register into common variable:

#101 = #5221

If you need only to write values into offsets, G10 will be better because it’s more universal. However, if you have to read the values of offsets, it might be better to stick with the system variables for everything.

• Can I use AND and OR within conditional (IF) statements?
This ability provides more versatility for developing conditional expressions. Consider these two series of commands that confirm the value of #101 is between five and ten.

Without AND
IF [#101 LT 10] GOTO 3

N3 IF [101 GT 5] GOTO 5

N4 … (Program continues)

.

.
With AND
IF [#101 GT 5] AND [#101 LT 10] GOTO 5