Okuma Variable Types
| Variable Number | Type of Variable | Note |
|---|---|---|
| VS1 - VS100 | System Variables | Reset to null when program ends. VS limits vary with controller version. |
| VC1 - VC200 | Common Variables | Keep value when machine is turned off. |
System Variables (VZOF / VTOF / etc.)
Beyond the numbered VS and VC variables, the Okuma OSP control exposes its offset tables as named system variables that a part program can read and, in most cases, write. Where Fanuc addresses work and tool offsets through numbered #-variables (e.g. #5221, #2001), Okuma names them by function and axis and indexes the offset set in brackets β VZOFX[n] is the X work-zero offset for offset set n, VTOFH[n] is the length (H) value for tool-offset number n. Fanuc equivalents are noted below where helpful. Read/write applies as marked; index ranges depend on the OSP version and the installed offset-set option.
| Variable | Description | R/W |
|---|---|---|
| Work Zero Offsets | ||
VZOFX[n] | Work coordinate system zero offset, X axis, for offset set n (Fanuc #5221+ style, per axis) | r/w |
VZOFY[n] | Work coordinate system zero offset, Y axis, for offset set n | r/w |
VZOFZ[n] | Work coordinate system zero offset, Z axis, for offset set n | r/w |
VZOFX[1] | X zero offset of the first work-offset set (e.g. G15 H1), example of the indexed form | r/w |
VZOFY[1] | Y zero offset of the first work-offset set | r/w |
VZOFZ[1] | Z zero offset of the first work-offset set | r/w |
VZSFTX | Zero shift (common shift) amount added to every work offset, X axis β Fanuc external/G52-style shift | r/w |
VZSFTY | Zero shift (common shift) amount, Y axis | r/w |
VZSFTZ | Zero shift (common shift) amount, Z axis | r/w |
| Tool Offsets | ||
VTOFH[n] | Tool length (H) offset value for tool-offset number n β Fanuc #2001+ length offset | r/w |
VTOFD[n] | Tool diameter/radius (D) offset value for tool-offset number n β Fanuc #2401+ radius offset | r/w |
VTOFH[1] | Length (H) offset of tool-offset number 1, example of the indexed form | r/w |
VTOFD[1] | Diameter/radius (D) offset of tool-offset number 1 | r/w |
VNOSER[n] | Tool nose radius (R) for tool-offset number n β used by nose-R compensation on turning tools | r/w |
VNOSEP[n] | Imaginary tool-nose point / direction number (1β9) for tool-offset number n β sets the nose-R comp orientation | r/w |
| Spindle / Status | ||
VSPS | Actual spindle speed (rpm) β Fanuc #3027 style read of live spindle RPM | r |
Worked Example: Variables Doing Real Work
The short program below puts all three variable classes from this page to work in one place: a common variable (VC100) carries a value across a subprogram CALL and back, a local variable (DPTH) is created from a CALL argument and exists only inside the subprogram, and an IF/GOTO branch decides whether a second pass is needed. A VS variable would be the wrong choice for VC100 here β per the table above, VS values reset to null when the program ends, while VC values persist.
( ===== MAIN PROGRAM - ROUGH A POCKET IN TWO PASSES ===== )
( VC100 IS A COMMON VARIABLE: IT KEEPS ITS VALUE ACROSS THE )
( CALL BOUNDARY - AND WOULD EVEN SURVIVE A POWER CYCLE )
VC100=0.500 ( TOTAL STOCK TO REMOVE )
CALL OPKT DPTH=0.300 ( PASS 1 - DPTH ARRIVES IN THE SUB AS A LOCAL VARIABLE )
IF [VC100 LE 0] N200 ( THE SUB UPDATED VC100 - IS ANYTHING LEFT? )
CALL OPKT DPTH=VC100 ( PASS 2 - TAKE WHATEVER STOCK REMAINS )
N200 G00 Z1.0 ( BOTH PATHS REJOIN HERE - RETRACT )
M02
( ===== SUBPROGRAM ===== )
OPKT
( DPTH EXISTS ONLY INSIDE THIS SUBPROGRAM. IT WAS CREATED BY THE )
( CALL ARGUMENT AND VANISHES AT RTS. VC100 IS STILL VISIBLE HERE. )
G01 Z=-DPTH F15.0 ( FEED DOWN BY THE LOCAL ARGUMENT VALUE )
( ... POCKET MOVES WOULD GO HERE ... )
G00 Z0.1 ( CLEAR THE FLOOR )
VC100=VC100-DPTH ( REPORT STOCK REMOVED BACK THROUGH THE COMMON VARIABLE )
RTS
Trace it through: the first CALL removes 0.300 and drops VC100 to 0.200, so the IF test fails and execution falls through to the second CALL, which takes the remaining 0.200 and leaves VC100 at zero. If the first pass had covered everything, the IF [VC100 LE 0] N200 line would have jumped straight to the retract at N200.
References
- Okuma, OSP Programming Manual, Okuma Corporation.
Have a question or want to contribute?
Contact us with corrections, additions, or topics you'd like covered.
Get in Touch