RSLogix 5000 Routines

gizmo

Member
Join Date
Aug 2002
Posts
95
Greetings,
I've got a basic question about the ladder logic/routines structure.

I got about 20 routines with each about 20 rungs of logic. I was wondering if there are any advantages or disadvanges to leaving the logic in 20 seperate routines or combining them into 1 routine with about 400 rungs of logic?

I have several other routines, each of these routines is named for the area/process of logic that it contains. The 20 routines is asking about are all logic for the same area/process. I broke it out into multiple routines thinking it might make it easier for trouble-shooting, but have found that it really didn't help me out very much in trouble-shooting. Would the project be more efficent if I combine these into one routine?

Any advice would be greatly appreciated!
Thanks
 
From a purely fundamental processing efficiency standpoint one routine with everything in it would be slightly faster. Every subroutine call has processing overhead associated with it.
But I would personally go with the individual routines. You state that the separate routines didn't seem to aid in troubleshooting. They probably did help with development, though. They will probably also help with future modifications and additions. You also probably don't have a solid point of comparison right now in terms of the ease of troubleshooting. You don't have the one-routine case to compare to the multiple routine case. I would suspect multiple routines helped more that you think, especially when you consider that it's easy to stop execution of a single routine running a specific function as opposed to jumping around chunks of logic in a single routine. Not to mention that multiple routines help organize your thoughts.

Keith
 
Keep it the way it is.

You might save a millisecond if you combine the 20 routines into on IF all twenty routines get called each scan. You may find the the code runs faster when the routines are separated like you have it now. This is because routines that don't get called are not scanned. Each routine that is not scanned should save ideally 5% of the scan time. That is a lot.

I bet you can find what you are looking for faster when there are 20 routines. I know I would hate to scan through 400 lines of code trying to find a rung.
 
Rule of thumb, if each of your 20 routines is a fairly self contained logical unit, splitting them makes sense. If you would be taking one single logical unit, and splitting it down 'just because', it doesn't make much sense.

You can in most programming packages, add either 'section' or 'page' or 'area' titles/comments, and be able to search on them.

In your case, you say the one you can break down is one 'Area' or 'Process'... Can you split it into groupings like 'Interlocking', 'Infeed', 'Process 1', 'Process 2', 'Outfeed' ? that could make sense.

Even a staging table with 5 positions could have 7 sub-logic blocks, one for interlocking, one for cycle management, and one for each station/position.

It really all depends on your application :)
 
All of the answers are very good. A good programmer thinks about the maintenance guys and others who will be following them. I like to use UNCONDITIONAL subroutines that divide the program like chapters in a book. This typically makes it easier to follow.

Since you are using a ControlLogix, you might want to use different program files instead of subroutine files. This is a powerful option that might work well.

Good Luck!
 

Similar Topics

All, Using RSLogix 5000. I was wondering if there is a way to quickly check to see if all subroutines are being called by the Main Routine (in...
Replies
3
Views
1,590
Out of the blue my RSLogix locks up on trying to import a Routine or AOP into my Controllogix logic. A few months ago I was swapping logic...
Replies
20
Views
14,961
It is my understanding you can have 32 tasks in a project, and 32 programs in a task. What about routines?
Replies
7
Views
6,312
Hello Experts, I need to protect RSLogix5000 (V20.01) Program such that its routines shall not be exported. Rockwell Documentation says below...
Replies
2
Views
10,693
Is there any "rule-of-thumb" as when one should use Subroutines vs. Add-on Instructions in RSLogix 5000? TIA
Replies
5
Views
8,770
Back
Top Bottom