Improving Program Compatibility Among Your CNCs
Put in the effort to eliminate machine-specific programming methods.
Share
Hwacheon Machinery America, Inc.
Featured Content
View MoreMaintaining multiple, nearly identical CNC programs for the various machine tools your company owns is cumbersome and error-prone. Consider the delays/mishaps that occur when an operator uses the wrong program. While it requires effort, if you eliminate machine-specific programming methods, you will need but one program per workpiece regardless of how many machine tools can be used to produce it.
Some programming variations relate to CNC model differences. For example, Okuma CNCs require a G15 to specify work coordinate system setting and a G56 to specify tool-length compensation, whereas FANUC CNCs require a G54-G59 (or G54.1) to specify work coordinate system setting and a G43 to specify tool-length compensation.
Other variations relate to the machine tool builder’s selection of M codes. One turning center builder, for instance, uses M41 and M42 to specify low and high spindle ranges while another uses M23 and M25.
Most program syntax variations can be handled with relative ease (if FANUC CNCs are involved) with user-defined G and M codes. That is, you can cause a FANUC CNC to accept syntax from other CNCs/machines.
For example, you can easily create a user-defined G code for Okuma’s G15 on a FANUC CNC. After doing so, the FANUC CNC will execute the appropriate G54-G59 word whenever a G15 command is specified in the program. The format for Okuma’s G15 is:
- G15 H01 (Invoke coordinate system number one)
First, set one of the parameters related to user-defined G codes on the FANUC CNC. These parameter numbers vary among FANUC models. For a FANUC 30i-series CNC, the first available user-defined G code is set by parameter number 6010. If this parameter is set to a value of 15, the CNC will execute program number O9010 whenever a G15 is executed. The value of H (the offset number) will be placed in local variable #11. Assuming the FANUC CNC uses G54-G59 (it does not have the expanded workpiece coordinate system option), here is an example of how program O9010 could be written:
- O9010 (User-defined G15 program)
- IF [#11 NE 1] GOTO 2
- G54
- GOTO 99
- N2 IF [#11 NE 2] GOTO 3
- G55
- GOTO 99
- N3 IF [#11 EQ 3] GOTO 4
- G56
- GOTO 99
- N4 IF [#11 EQ 4] GOTO 5
- G57
- GOTO 99
- N5 IF [#11 EQ 5] GOTO 6
- G58
- GOTO 99
- N6 IF [#11 EQ 6] GOTO 98
- G59
- GOTO 99
- N98 #3000 = 100(H-WORD OUT OF RANGE)
- N99 M99
If the FANUC CNC has the expanded work coordinate system option (G54.1), program O9010 will be simpler.
- O9010 (User-defined G15 program using G54.1)
- IF [#11 LT 1] OR [#11 GT 48] THEN GOTO 98 (Test that offset number is appropriate)
- G54.1 H#11 (Specify workpiece coordinate system setting command)
- GOTO 99
- N98 #3001 = 101(OFFSET NUMBER OUT OF RANGE)
- N99 M99
Similar techniques are used with user-defined M codes. For the turning center spindle-range issue, you could cause the machine that uses M23/M25 to accept M41/M42 commands. First, set the appropriate parameters. For a 30i series FANUC CNC, the first available user-defined M-code parameter is parameter number 6071. If this parameter is set to a value of 41, the CNC will execute program O9001 whenever an M41 is seen in the program. If parameter 6072 is set to a value of 42, the CNC will execute program O9002 when M42 is seen.
- O9001 (M41 program)
- M23 (Execute the low-range M code)
- M99
- O9002 (M42 program)
- M25 (Execute the high-range M code
- M99
Other programming variations are related to programmer discretion. With machining center cutter-radius compensation, for instance, some programmers specify coordinates based on the work-surface path while others specify coordinates based on cutter centerline path. With the first method, the operator enters the cutter’s radius in the cutter comp offset. With the second method, he or she enters the radial deviation from the planned cutter size and the size of the cutter being used. When faced with this kind of variation, pick the method that works best for the application and stick with it for all programs.
Still other programming variations are related to machine repair issues. One machine may have a faulty check-valve in the coolant system that requires a programmed dwell to allow time for coolant to flow at full strength, or a turning center may have a misaligned headstock that requires the programming of taper movements to ensure that straight surfaces are machined. In these cases, proper machine tool maintenance is required so no special programming considerations are necessary to deal with maintenance issues.
One last programming variation is related to machine tool kinematics and is especially important for four- and five-axis machine tools. Traditionally, G-code programs for these machines specify axis movement for positioning the tool tip (X, Y, Z, A and B, for instance). With this method, programs will be specific to a given machine, and elaborate postprocessors are required to generate the required motion commands. Additionally, resulting motions tend to cause scalloping on finished surfaces.
With modern CNCs, it is possible to program all motions from workpiece coordinates that match your CAM system’s cutter location data. Compensations within each machining center, like G54.4 workpiece setting error compensation and tool center-point (TCP) control, deal with kinematic differences among machine tools. This means postprocessors will be much simpler, programs will be more universal and machined surfaces will be smoother.
Related Content
How to Determine the Currently Active Work Offset Number
Determining the currently active work offset number is practical when the program zero point is changing between workpieces in a production run.
Read MoreHelp Operators Understand Sizing Adjustments
Even when CNCs are equipped with automatic post-process gaging systems, there are always a few important adjustments that must be done manually. Don’t take operators understanding these adjustments for granted.
Read MoreStrange 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 More2 Secondary Coordinate Systems You Should Know
Coordinate systems tell a CNC machine where to position the cutting tool during the program’s execution for any purpose that requires the cutting tool to move.
Read MoreRead Next
Registration Now Open for the Precision Machining Technology Show (PMTS) 2025
The precision machining industry’s premier event returns to Cleveland, OH, April 1-3.
Read MoreBuilding Out a Foundation for Student Machinists
Autodesk and Haas have teamed up to produce an introductory course for students that covers the basics of CAD, CAM and CNC while providing them with a portfolio part.
Read More5 Rules of Thumb for Buying CNC Machine Tools
Use these tips to carefully plan your machine tool purchases and to avoid regretting your decision later.
Read More