Do you have variables in your manufacturing operation?

Okuma control, the variables and related functions are part of User Task II. On the Fanuc control, it is part of Macro B. Most of the variable functions are now standard on the newer Okuma controls. Macro B is usually an option on many Fanuc controls. There are basically three types of variables – local variables, common variables, and system variables. Some controls also have a function called IO variables (input /output variables).

Common Variables

A common variable on the Okuma lathe is called out using V, on a machining center it is VC. Common variables can be used to represent coordinate positions, spindle speeds, or a counter.

Most Okuma machines will have common variables ranging from 1 up to 32. New machines will usually have 200. One of the basic uses of common variables is a parts counter. The operator or programmer would put a line of code in the program, each time the program reads that particular line one is added to the parts count. At the end of the shift the operator can check the number of parts by looking in the common variable page in parameter mode.

A parts counter on the lathe might look something like this, V10=V10+1, with this statement in the program the machine would add 1 to common variable 10 each cycle. For a machining center it would read VC10=VC10+1.

On a Fanuc control is would look like this #105 = #105+1.

System Variables

System variables have a specific meaning to the machine’s operating system. One system variable that is used quite often on an Okuma lathe or mill is VZOFZ. This is used to represent the Z zero offset from the zero set mode. When the machine reads the line containing VZOFZ, the Z zero offset would be set or updated. There are many systems variables ranging from zero offsets to pitch error comp to current machine position. Used in the program, the variable would read like this, VZOFZ=652.9658. The number following the equal sign is the value obtained from the Z zero offset in zero set mode. On a Fanuc control, the Z axis work shift is variable #2601 and the name is [#_WKSFTZ].

Local Variables

Local variable names are chosen by the programmer. The name is usually up to four characters long, with the first two characters being letters from the alphabet. Local variables are cleared upon the completion of the program or when rest is pressed. Up to 127 local variables are available on most controls with this type of function. With this type of variable we create a unique name that has some meaning to us. An example of this might be XDIM1 or ZDIM1. With these names we assign an X program position and Z program position. In the program it would like this:

XDIM1=1.0 (this defines the value for XDIM1)

ZDIM1=1.0 (this defines the value for ZDIM1)

G0 X=XDIM1 (X is positioned to 1-inch at a rapid speed)

G1 Z=-ZDIM1 F.010 (Z is positioned to 1-inch at a feed rate of .010 per rev)

I/O Variables:

A fourth, but often overlooked, type of variable is what we call an I/O variable. These types of variables are used to check the status of an input or output on the machine. For example, we can check to see if single block is on or if the spindle override is set to 100%. If the proper conditions do not exist, we can generate an alarm to alert the operator to the condition so it can be corrected before running the machine cycle. Here in this example to check if single block is on:

IF [VORD[00023]EQ 1] NAL06  (check to see if single block is on; if it is on jump to line NAL06)

NCUT (start of cutting program)

NDONE (end of cutting program)

GOTO NEND (jump to line NEND to read M30 end of program code)

NAL06  VAUCM[1]=’SINGLE BLK ON’ (comment that will appear with alarm if single block is on)

VDOUT[992]=9006

NEND M30

When programmers use check statements like this, they will usually check multiple items on the machine and will put these checks in a subprogram.

Most machines with the variable functions will also have the ability to do math within the program. This can range from simple addition and subtraction, trig functions using sine and cosine, or rounding up or down. With this example, we set the speed command S by using local variable and a simple math formula:

SFM=770 (surface speed of 770)

S=3.82/4*SFM (speed is equal to 3.82/4 flutes *SFM of 770)

For more information, please reach out to a Hartwig expert!

Ready to talk with a machine tool expert?

Your Hartwig representative can help connect you with the solution that will power your business’s next big innovation and efficiency.

Starred Machines