External Input for Programmed Values
Parametric programming provides three easy ways to access external data.
Standard CNC programs lack intelligence. They are executed sequentially, commands result in predetermined action/s and words for each command are fixed.
Parametric programming provides additional capabilities, and various compensation types such as fixture offsets, tool length and cutter radius compensation allow programs to reference data from outside the program. These data are typically stored in offset registers and affect the way a CNC program performs.
Certain applications require CNC programs to access other data from outside the program in much the same way that compensation does. These applications exceed the limits of what is possible with standard G code. With parametric programming, however, it is easy to make programs access external data.
Sources for external data include offset registers, permanent common variable registers and input signal terminals on a printed circuit board. Parametric programming system variables allow access to each type.
For offset access, most CNCs use a system variable name or number that corresponds to the offset register being accessed. For a popular FANUC CNC machining center model, system variable #2001 provides reading and writing access to the register for geometry offset number one, #2002 provides access to register number two, and so on. While each kind of offset is accessed with a different series of system variables, rest assured that you can access any offset register if you know the corresponding system variable name or number.
Permanent common variables are much like offset registers. You can enter them using the MDI panel keyboard, or data can be entered by some other source (maybe the results coming from a probing program). While the naming/numbering for these system variables vary, FANUC uses a series of system variables beginning with #500 to access them. Permanent common variable #501, for example, is used to access (read and write) the value in the permanent common variable register number 501.
Input and output terminals are accessed through a series of system variables ranging from #1100 to #1131 for inputs and from #2000 to #2031 for outputs. Each corresponds to a printed circuit board terminal location. If the terminal is active/on (current is flowing), the value of the corresponding system variable will be 1. If the terminal is inactive/off (current is not flowing), its value will be 0. For example, when terminal location number 2 is active, the value of system variable #1102 will be 1.
Which method you will use to store/access data will depend on your application. Sometimes it makes sense to place related data in offset registers, especially if the data is related to workholding or cutting tools. Other times, it is more logical to place the data in permanent common variables, especially if the data is more related to machine usage than tooling. Input/output terminals are important if external devices are being used that must provide feedback information to the CNC.
How data are placed in data registers also varies. In some applications, the operator will enter data through the MDI panel keyboard. In others, the data are entered by an external device, like a touch probe or post process gaging system. In another application, a machine sensor (like one that monitors the angular position of a rotary table) is connected to an input/output terminal.
What are some ways to access external CNC program data?
Here are three ways to access external data, with an example for each application:
- Offset Register Access: Enhancing Wear Offsets
There are times when the turning center operator cannot easily determine the amount of adjustment needed for a sizing adjustment. Consider a dimension specified over a ball (see Figure 1). Instead of calculating the offset adjustment amount, which requires trigonometry, have the operator store the measurement taken over the ball in an unused offset register. The program can then reference this value in a calculation that determines how to adjust the X- and Z-axis motions required to correctly machine the taper.
- Permanent Common Variable Access: Automating Program-Zero Assignment
The center of a round workpiece, when held in a V-block clamp (see Figure 2), will vary in a predictable way based on workpiece diameter. Instead of measuring this position every time a setup is changed, have the operator enter the workpiece diameter in a permanent common variable. The program can reference this value to determine the center position and then specify an appropriate value into the corresponding fixture offset register.
- Input Signal Terminal Access: Determine Rotary Device Position
If a rotary table is in the wrong angular position when a program is activated or restarted, the results could be disastrous. A sensor mounted to the rotary table (possibly a limit switch) can be connected to an input signal terminal in such a way that, when the appropriate side of the table is facing the spindle, the current will flow at the terminal. The program can test whether this terminal is active. If it is not, it can generate an alarm.
Related Content
Generating a Digital Twin in the CNC
New control technology captures critical data about a machining process and uses it to create a 3D graphical representation of the finished workpiece. This new type of digital twin helps relate machining results to machine performance, leading to better decisions on the shop floor.
Read MoreContinuous Improvement and New Functionality Are the Name of the Game
Mastercam 2025 incorporates big advancements and small — all based on customer feedback and the company’s commitment to keeping its signature product best in class.
Read More5 Reasons Why You Should Know How to Write Custom Macros
Custom macros enhance what can be done in G-code programs, giving users the ability to code operations that were previously not possible.
Read MoreFive-Axis Machines Speed NASCAR Engine Production
Moving from an aging set of five-axis mills to more advanced machines enabled Hendrick Motorsports to dramatically improve its engine production.
Read MoreRead Next
The Future of High Feed Milling in Modern Manufacturing
Achieve higher metal removal rates and enhanced predictability with ISCAR’s advanced high-feed milling tools — optimized for today’s competitive global market.
Read MoreInside Machineosaurus: Unique Job Shop with Dinosaur-Named CNC Machines, Four-Day Workweek & High-Precision Machining
Take a tour of Machineosaurus, a Massachusetts machine shop where every CNC machine is named after a dinosaur!
Read MoreIncreasing 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