Good afternoon, I have created multiple individual programs on our KRC2 210 to complete different tasks needed. I have looked through the Kuka manual multiple times on how to create a program to call the individual programs in sequence. I was taught and used this method on Fanuc and it was called call command. I'm not finding how to accomplish this in the KRL.
Kuka Krc2 Program call
-
Hancock Concrete -
November 11, 2020 at 7:56 PM -
Thread is Unresolved
-
-
Create another program and simply call them:
Def main
Prog1(<parameters>)
Prog2(...)
Prog3(...)
End
-
You just need to put the program name You want to call, followed by (). What is inside the parenthesis will depend if the subprogram works with arguments/parameters, or not.
The example below is an excerpt from Cell.src
You will see program P00 being called some times, with different parameters, and some EXAMPLE programs, being called normally.
Code
Display MoreLOOP P00 (#EXT_PGNO,#PGNO_GET,DMY[],0 ) SWITCH PGNO ; Select with Programnumber CASE 1 P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 ) ; Reset Progr.No.-Request EXAMPLE1 ( ) ; Call User-Program CASE 2 P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 ) ; Reset Progr.No.-Request EXAMPLE2 ( ) ; Call User-Program CASE 3 P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 ) ; Reset Progr.No.-Request EXAMPLE3 ( ) ; Call User-Program DEFAULT P00 (#EXT_PGNO,#PGNO_FAULT,DMY[],0 ) ENDSWITCH ENDLOOP END
-
KRL has no equivalent to Fanuc TP-Language's CALL command. Instead, calls are implicit.
Generally, if you have created a module call FOO, you can call it from any other program by simply coding FOO() -- the () are required. If FOO accepts arguments, you would need to fill in the arguments you are passing inside the (), separated by commas: FOO(variable1,variable2)
It becomes slightly more complicated if you have multiple subroutines and/or functions defined inside a single module .SRC file. For KRL modules, the "top" routine has the same name as the module itself, so FOO.SRC would begin with DEF FOO(). This "top" routine is global by default, and can be called from anywhere.
If FOO.SRC contains other DEFs or DEFFCTs, however, those subroutines (DEFs) and functions (DEFFCTs) can only be called by routines inside of FOO.SRC (their "scope" is to the module), unless the DEF/DEFFCT line includes the keyword GLOBAL. If any routine/function is declared using the GLOBAL keyword, it becomes available to be called from anywhere in the robot. This can be convenient, but also requires you to ensure that no two Global routines ever have the same name.
-
Thank you very much for the replies. That is simple enough. I didn't know if I needed to stop the advance run at the end of each program to stop it from jumping to the next before one is complete.
Each program runs great on their own, and they all go to the home position when completed, so I will not need arguments at all. I simply just want it to complete one program after the next in order.