Calling lots of subprograms in a single program

Hello,

I have about 14 slightly different robot programs that are used for machine tending, the only differences between the codes are slight variations in the waypoints. I want to know if I can use the “assignment” function to ask the operator what machine code they want to run and then use a stack of “if statements” to check what name was entered and then run/call that corresponding subprogram.

Basically I want to create a “master” program that has all the programs attached so the operator does not need to scroll through the robot programs and instead can just enter the name of the program when prompted by the master program.

So I am just wondering if there would be any issues with doing this such as increasing file size or slowing down the program or issues with the variables being the same across the subprograms?

Hi!

I would say there is not any problem doing it, in fact i did the same some time ago , i had an UR10 connected to a S7-1500 with an HMI.
It consisted of different subprograms in the UR and i simply made a numeric variable and a start button in the HMI, and then the UR executes the corresponding subprogram depending of variable value using if statements.

About the file size, i wouldn´t say there is a problem unless you have a program as long as the bible haha.
About using the same variables in differents subprograms there shouldn´t be any problem as long as you don´t step values.

There are only two variables that are used in the programs and those are both installation variables. One (variable A) is used to count the number of parts processed and the other is the number of parts that need to be processed (variable B). When variable A is greater or equal to variable B the robot program stops.

Sounds like you should be fine. Doing this Master/Sub structure is industry standard for industrial robots, and should work very well for your application.

We run a similar set up with several programs. We have a pop up box for the operator to select a number corresponding to the parts they are loading. Then we use a Switch case select to adjust common variables and select the sub program to run. If you haven’t used the case select before it is much cleaner for a situation like this that several if’s would be (from my opinion).

How do you do a pop up box for the operator to select what parts they are loading? I’ve just been making my code as if they would type in the parts name into a pop up box.

When you change the Assignment to operator there are options for operator input. We select the “whole number” and then numbers are associated with the part and a chart is posted by the robot and in the pop up. For example Part A corresponds to 1, Part B corresponds to 2 and so on. See the picture.

Then you can use the associated number variable to select anything you need.

I have done the same thing with teaching a feature and then calling offsets based on the operator input. It works well but I can see the value in doing it this way as well.