# Use of variables with tool offsets. (Shop Talk).

Last month we discussed macro programming, the use of variables and we introduced arguments. Let's now look at the use of these concepts in setting tool wear offsets.

This sample program worked in our machine, where the macro options are installed and turned on. As with any program, just because it works in one machine does not mean it works in all machines. We cannot guarantee that this program works in your machine and we take no responsibility for a snafu if you use this program.

The program shown here is a subprogram. This program is called into effect by a G65 command in the main program. Remember: G65 is a command that calls a macro subprogram into effect. Alternately, M98 can also call a subprogram. Main program code: G65 P1111 (calls the macro subprogram).

When the main program calls the macro subprogram, the control jumps to the subprogram and runs the following routine.

How it works

The program number is O1111 and is called in the main program with P1111. The title of the program is "offset check," as shown in the comments. The 500 series variables are used, calling #500, #501, #511, #512 and #513. This program identifies each variable and the value the variable represents.

The #500 variable equals the value located in the file #2110. This file is the wear offset Z value for tool #10. The control builder (Fanuc) assigns #2110 as the specific location for the given offset value.

The operator measures the part and adjusts the offset to correct the size produced. The macro program then compares the input value against the allowable range, +0.030 and -0.020.

The macro program O1111 defines the variable #500 as equal to the value put into the control for the Z axis offset for tool #10.

The program then identifies variable #501 as equaling 0.00. Variable #511 is set equal to variable #500. The additional variables are set equal to a mathematical equation as shown in the program.

The program then presents an argument. The first argument says, if the value in variable #511 is equal to the value in variable #501, go to line 300.

The second argument says, if #511 is less than or equal to #512, go to line 200. The final argument says, if #511 is greater than or equal to #513, go to line 200.

The program reads these arguments and moves to program line 200 or 300. Line 300 directs the control back to the main program to continue machining. Line 200 sets off an alarm, stopping the machine and alerting the operator with the comment "WEAR OFFSET OUT OF RANGE."

This program sets a range of acceptable values for the tool #10 Z-axis offset. If the offset value is within the acceptable range, the program continues to operate. If the offset entered is higher or lower then the given range, the machine alarms out.

In this example, the acceptable range is +0.030 and -0.02 from the initial measured offset. These values are set out in program when variables #512 and #513 are defined.

This type of procedure can be very helpful in reducing mistakes when entering or modifying offset values. There are numerous ways to perform this procedure. If you use a different method, e-mail it to us. Alternate methods will be posted to the RTSI web site (www.cnc-training.com).

Steve Rose is a manufacturing consultant and president of RTSI, Solon, OH, which also offers Internet web site development. Mr. Rose can be reached by phone 440.542.3066; fax 440.542.3006; e-mail srose@cnc-training.com; or on the web at www.cnc-training.com.