91ÊÓÆµÍøÕ¾ÎÛ

Published

Accessing Parameter Values from within Programs

A new parameter reading function gives CNC programs more intelligence, enabling them to behave as you need them to.

Share

Leaders-In background

A relatively new FANUC feature provides the ability to read parameter values from within CNC programs. It has always been possible to enter (write) parameter values from within programs using a G10 command, but the new PRM function completes the read/write loop. The format for the parameter reading command varies based on the parameter type.

1. Eight-bit parameters:
#101 = PRM[1] (Sets common variable #101 parameter to number one’s value. For example, if parameter number one’s value is 01100110, the value of #101 will be set to 01100110.)

#101 = PRM[1, 4] (Sets common variable #101 to the value of bit number four of parameter number one. So if parameter number one’s value is 01100110, the value of #101 will be set to 0.)

By the way, you can easily test whether or not a given machine has this new functionality by executing the first command above (#101 = PRM[1]) using manual data input (MDI). If common variable #101 is set to the value of parameter number one, the machine has the ability to read parameter values.

2. Axis-type parameters:
#101 = PRM[1322]/[2] (Sets common variable #101 to the second axis value of parameter number 1322.)

Applications
Some parameters affect the way CNC programs behave. Others affect the way programs must be written. For these reasons, having the ability to read parameter settings from within a program has important implications. In essence, you can give your programs more intelligence. After determining what the CNC expects, you can make your programs behave accordingly.

Improving Compatibility
Consider the program format required for multiple repetitive cycles and subprogramming on turning centers. Bit one of parameter one (for a FANUC 0iD control) specifies whether multiple repetitive cycles use a one-line or two-line command, and how multiple executions of a subprogram are specified.

If this bit is set to a value of 0, the two-line multiple repetitive cycle format must be used, and the P word in an M98 command specifies the number of subprogram executions. If this bit is set to a value of 1, the one-line multiple repetitive cycle format must be used, and an L word in the M98 command specifies the number of subprogram executions. For example, the following commands will work regardless of how this parameter is set:
G00 X3.5 Z0.1
#33 = PRM[1,1] 
(Read bit one of parameter one)
IF [#33EQ1] GOTO 5 
G71 U0.125 R0.05 
(Two-line G71)
G71 P10 Q15 U0.040 W0.005 F0.015
GOTO 10
N5 G71 P10 Q15 U0.040 W0.005 D1250 F0.015
 (One-line G71)
N10 G00 X1.25 
G01 Z0 F0.008
X1.5 Z-0.125
Z-1.0
X1.75
X2.0 Z-2.0 F0.005
Z-2.75 F.008 
X2.5 Z-3.0 R.25 
G01 X2.75 
X3.0 Z-3.125
Z-3.5 
X3.25 
N15 X3.5 Z-3.625

 

Error Trapping
Perhaps you know a program will fail, or cause unexpected movements, if a parameter is not properly set. Maybe the machine must be in the imperial measurement system (inch) mode when your program is run. If bit number two of 
parameter number zero controls measurement system mode selection (as it is on a FANUC 0iD control), these commands will ensure that the CNC is in the imperial measurement system mode. An alarm will sound if it is not.
#33 = PRM [0,2] (Read bit two of parameter zero)
IF [#33=1] GOTO 5
#3000 = 100 
(You must select imperial measurement system.)
N5 . . . 

Related Content

CNC Tech Talks

Tips for Designing CNC Programs That Help Operators

The way a G-code program is formatted directly affects the productivity of the CNC people who use them. Design CNC programs that make CNC setup people and operators’ jobs easier.

Read More
Basics

Obscure CNC Features That Can Help (or Hurt) You

You cannot begin to take advantage of an available feature if you do not know it exists. Conversely, you will not know how to avoid CNC features that may be detrimental to your process.

Read More
CNC Tech Talks

Strange But True: Odd Things That Happen With CNCs

These oddities in the way a CNC naturally behaves can help explain some rather unusual situations that may occur during machining.

Read More
CNC Tech Talks

4 Reasons to Use Safety Commands

Safety commands help safeguard CNC applications from common programming or operation errors.

Read More

Read Next

Top Shops

Last Chance! 2025 Top Shops Benchmarking Survey Still Open Through April 30

Don’t miss out! 91ÊÓÆµÍøÕ¾ÎÛ's Top Shops Benchmarking Survey is still open — but not for long. This is your last chance to a receive free, customized benchmarking report that includes actionable feedback across several shopfloor and business metrics. 

Read More
Automation

AMRs Are Moving Into Manufacturing: Considerations for Implementation

AMRs can provide a flexible, easy-to-use automation platform so long as manufacturers choose a suitable task and prepare their facilities.

Read More
Basics

Machine Shop MBA

  Making Chips and 91ÊÓÆµÍøÕ¾ÎÛ are teaming up for a new podcast series called Machine Shop MBA—designed to help manufacturers measure their success against the industry’s best. Through the lens of the Top Shops benchmarking program, the series explores the KPIs that set high-performing shops apart, from machine utilization and first-pass yield to employee engagement and revenue per employee.  

Read More