Custom Macro Enhancements
This parametric programming version hasn’t changed much over the years, but there have been some important updates.
Share




Custom Macro is the most popular version of parametric programming for CNC machine tools. Created by FANUC and adopted for use by several control manufacturers, it provides countless benefits to CNC users. I have demonstrated many benefits in previous columns.
Though the Custom Macro has been around for a long time, it hasn’t changed much over the years. I will highlight the most important updates, but keep in mind that if you must maintain compatibility among new and old machines, you must use only those Custom Macro features that are shared by all of your machines.
• Improved arithmetic. Newer versions of Custom Macro include more arithmetic functions than older ones. These functions include arc sine, arc cosine, improved arc tangent and power. The number of allowed nesting levels (brackets within brackets) has been increased from four to five.
• Improved conditional branching statement. Early versions of Custom Macro provide a rather simple IF statement. If the logical expression within the IF statement is evaluated as true, the only option is to specify an unconditional branch (GOTO). While the GOTO statement is often required, there are times when the true condition requires a different action—like a simple arithmetic operation command. Consider these examples:
Old way:
IF [#1 NE #0] GOTO 5
#1 = 0.25
N5 . . .
New way:
IF [#1 EQ #0] THEN #1 = 0.25
Newer versions of Custom Macro also provide the ability to test more than one condition using the AND and OR extensions. Consider this example:
IF [[#1 EQ #0] AND [#1 LT 1.0]] THEN #1 = 0.25
Only if both conditional expressions are true will the arithmetic operation be executed.
• Referencing system variables by name. With older versions of Custom Macro, system variables are referenced by a four-digit variable number. The alarm-generating system variable, for example, is #3000, and the command
#3000 = 100 (R WORD MISSING)
will generate an alarm, and the message “MC100 - R WORD MISSING” will be displayed.
With newer versions of Custom Macro, you can additionally reference system variables by name. This makes it easier to determine what a system-variable-containing command is doing. Consider how much easier it is to understand this revised alarm-generating command:
[#_ALM] = 100 (R WORD MISSING)
You must reference the Custom Macro descriptions in your control manufacturer’s programming manual in order to find the appropriate name for each system variable (there are many). And by the way, referencing this manual is the only way to determine if your specific control model allows the new features described in this article.
• Reading parameter values. This may be the most important Custom Macro enhancement. While CNC users have had the ability to enter (write) parameters from within programs (using G10), there has been no previous way to read them.
Consider this command:
#101 = PRM [1,1]
The value of bit number one for parameter number one (a one or a zero) will be placed in common variable #101. (The value before the comma is the parameter number; the value after the comma is the bit number.)
It happens that for a FANUC 0iD control, bit one of parameter one specifies program format. For a turning center, this affects whether the format for one-line or two-line multiple repetitive cycles is required. A value of zero makes the control require two-line multiple repetitive cycles. A value of one makes it require one-line multiple repetitive cycles.
With the ability to read parameter settings and test their values with conditional branching (IF) statements, you can (among countless other things) ensure that your programs include the appropriate multiple repetitive cycle commands.
Other enhancements to Custom Macro include:
• Improved time/date. This Custom Macro function is helpful for timing events, as is required for tool-life monitoring.
• Sub-program call using a specified letter address. Previously, only a “T” or “M” word could be used to call a sub-program. Current versions of Custom Macro allow you to specify that a sub-program be called when a letter address of your choosing is executed (though some letter addresses, like N, G and O, are not allowed).
• Abbreviating arithmetic and logic names. Programs can be shortened a little with this feature. The arithmetic function ROUND, for example, can be specified as RO. Just the first two alpha characters are required.
Related Content
6 Ways to Streamline the Setup Process
The primary goal of a setup reduction program must be to keep setup people working at the machine during the entire setup process.
Read More4 Ways to Stop a Cycle to Allow Operator Intervention
Completely automatic operation should always be the goal, but there are situations that require operator intervention during the CNC cycle.
Read MoreA Balancing Act for Differential Gaging
Differential gaging measures using two devices, which has advantages over standard, comparative measurements using a single sensing head. These include the ability to measure size without regard to position.
Read MoreTroubleshooting Differences in Programming Methods, Machine Usage
Regardless of the level of consistency among machines owned by your company, you probably have experienced consistency-related issues. Here are some tips to help solve them.
Read MoreRead Next
How I Made It: Dennis Rymanowski
Dennis Rymanowski has worked at NSH USA for 60 years, with his passion for manufacturing living alongside his passion for his family’s polka band.
Read MoreA New Frontier in Surface Finish Control
What if your machine tool could measure surface roughness as it cuts? This article explores how in-process metrology is advancing from concept to reality, enabling real-time feedback, immediate detection of anomalies and new levels of control over surface quality. Discover the technologies making this possible.
Read More