You are on page 1of 2

You Asked, We Answered: Custom Macro B

8
Custom macro B is FANUC s version of parametric programming. Judging by the questi
ons, 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.
Columns: 11/21/2011
MIKE LYNCH
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 dis
play 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 yo
u can t find this soft key, try inputting and executing the command using manual d
ata 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 s
uch 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 pl
ace 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 m
essage ENTER DIA IN #101 on the display screen. The operator must then call up t
he variable page and enter a diameter in common variable #101. Finally, the oper
ator presses cycle start to have the machine continue. In the custom macro, it w
ould be wise to test the value of the entered value for correctness prior to all
owing 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 t
wo 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 c
ontrol models use different system variables to provide access offsets. So, if y
ou 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 re
gister. 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 mor
e universal. However, if you have to read the values of offsets, it might be bet
ter 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. C
onsider these two series of commands that confirm the value of #101 is between f
ive and ten.
Without AND
IF [#101 LT 10] GOTO 3
#3000 =100 (BAD INPUT)
N3 IF [101 GT 5] GOTO 5
#3000 = 100 (BAD INPUT)
N4

(Program continues)

.
.
With AND
IF [#101 GT 5] AND [#101 LT 10] GOTO 5
#3000 = 100 (BAD INPUT)
N5

(Program continues)

.
.
With older controls, AND and OR were reserved for use with binary expressions an
d could not be used in the manner shown in the second example above. However, ne
wer controls do allow AND and OR to be used within conditional expressions. Unfo
rtunately, I can t tell you which control models allow AND and OR to be used in th
is manner, but if you write a lot of custom macros, it would be worth your time
to test it.
Keep in mind that if programs are run in multiple machines, you will not be able
to use this new feature for programs run in older machines.

You might also like