System Variable - Calling Program Number?
CONTROL: FANUC Oi-F / Mill
When working with a series of nested operations is there a way to return the o-number of the calling program at each level.
O1111 (MAIN);
M98 P2222;
M30;
%
O2222 (NESTED1);
#500 = ##### (??? #4000 Assigns the MAIN op number, but that doesn't work for all cases, see below);
M98 P3333;
M99;
;
%
O3333 (NESTED2);
#501 = ##### (??? How can one assign 2222 to #501 here?);
M98 P4444;
M99;
;
%
O4444 (NESTED3);
#502 = ##### (??? How can one assign 3333 to #502 here?);
M98 P5555;
M99;
;
%
And so on...
Thank you all in advance.
Re: System Variable - Calling Program Number?
There is also a limit to how many nesting levels that can be done
There isn't enough information on what you really want. The M98 P xxxx will send it to the program and the m99 will return it to the line after the m98pxxxx call
What is the use of the #500 ect. in your program. All your example does is record the program number and doesn't describe what you want to do with it
#500 = ##### (??? #4000 Assigns the MAIN op number, but that doesn't work for all cases, see below);
#501
#502 ect.
O1111 (MAIN);
M98 P2222;(Goto n2222)
M30;
N2222
M98 P3333 (goto3333
M99 (return to the line after M98 P2222 in the calling program )
N3333
M98P4444(return to the line after M98 P3333;)
M99
N4444
M98P5555(return to the line after M98 P4444;)
m99
%
Re: System Variable - Calling Program Number?
The code shown is a simplified example. #500's are place holders.
Is there a system variable that stores the calling programs' O-Number?
We are needing to write 1111 too #500, 2222 too #501, and 3333 too #502
We can view the call stack on the Screen Display how do we reference 1 level up?
PURPOSE: A subprogram will terminate if not called by a specific parent.
Re: System Variable - Calling Program Number?
this was on the forum from mike xyz on 6/28/10
Variable #4115 is the last O number read by the control so it contains the current program number.
Re: System Variable - Calling Program Number?
So, One could add two lines to each calling program... one to store #4115 and then one to clear the stored data.
O1111
(PARENT PROGRAM)
#500 = #4115(IN LEADING SAFETY BLOCKS)
#500 = #0 (IN TRAILING SAFETY BLOCKS)
O7777(DEPENDENT CHILD PROGRAM)
IF [#500 NE #1111] THAN #3000=1(*ERROR* - INVALID PARENT - SEE PRGMR)
This won't work, if the error is raised #500 won't be cleared...
Re: System Variable - Calling Program Number?
# 100's clears on reset #500's don't clear on reset
Re: System Variable - Calling Program Number?
Quote:
Originally Posted by
rcs60
# 100's clears on reset #500's don't clear on reset
^^^What do you mean by reset? Power Cycle? M30? M2?
Perhaps with unique parameter settings this is true, however on our controls,
and all other FANUC machines I have worked on, #100's are only cleared when control is Powered Off and On.
This is basic Macro-B knowledge. I don't need a review or an argument.
A better question is, What System Varibles are related to the call stack?