Okuma Argument & Local Variables
Okuma arguments use local variables which are created by the user in the program. A local variable is two alphabetical characters followed by up to two more alphanumeric characters.
Example
AA11=1 : creates a local variable called 'AA11' and assigns it a value of 1.
BB22=.5 : creates a local variable called 'BB22' and assigns it a value of 0.5.
CC33=AA11*BB22 : creates a local variable called 'CC33' and assigns it the value of the sum of AA11 multiplied by BB22.
Local Variables in Subprogram Calls
Local variables can be used in subprogram calls. To check if a variable is null (like Fanuc #0) then it needs to begin with a 'P' e.g. PA12.
When 'P' is commanded at the beginning of a local variable, the input can be interrogated with an EMPTY evaluation to see if it has a null/empty value.
Example
IF[PA12 EQ EMPTY]N10
M00 (code will stop here if PA12 has been commanded)
N10 (code will jump here if PA12 has not been commanded)
Subprogram Call Example
(Program start)
BB22=4.567 (set local variable BB22 to 4.567)
CALL O1234 AA11=1.234 BB22=BB22 PC33=1 (PC33 is an optional input)
M02
(Program end)
(sub program O1234)
O1234
VC1=AA11 (This will set Common Variable VC1 to 1.234)
VC2=BB22 (This will set Common Variable VC2 to 4.567)
VC3=PC33 (This will set Common Variable VC3 to 1)
IF[PC33 EQ EMPTY]N10 (Check if PC33 has been commanded)
G0 X=AA11 Y=BB22 Z=PC33 (Move to XYZ position)
GOTO N20 (Skip XY move)
N10 (Move to XY position)
G0 X=AA11 Y=BB22
N20
RTS (End of subprogram)
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