RSLogix 5000 - Programs vs Routines

BillRobinson

Member
Join Date
Oct 2006
Location
Sydney, Nova Scotia
Posts
185
Anybody know the pro's/con's of using programs vs routines?

For example, say the "Main Task" is a continuous task and we either have 1) a single program with a main routine that JSR's to other routines or 2) multiple programs each with a single main routine.

1)
Main Task
-{Do Everything Program}
---[Start Everything Routine]
---[JSR This Routine]
---[JSR That Routine]
---[JSR Whatever Routine]

or

2)
Main Task
-{Do This Program}
---[Start This Routine]

-{Do That Program}
---[Start That Routine]

-{Do Whatever Program}
---[Start Whatever Routine]
 
It allows you to break your machine down into more manageable parts plus allowing you to prioritize tasks via time slicing. On large projects, myself and another programmer were both working online, each on a different task at the same time.
 
Ease of troubleshooting in my case.

You can also create periodic routines which run separate to the main routine.
 
Last edited:
The other versatility is sometimes sections of one code can be used in another program more difficult on a PLC. However lanquages such as C++ thrive on modular programming in the same format
 
Multiple routines in a program share the program tags. Multiple programs cannot share program tags.
There is a limit to how many programs you can have in a task.
And I think that multiple programs add to the scan time
 
Its only a case of how you want to organise your program. Also the program tags you create are local to that particular program. So if you want similar tags on different fragments of code, create separate programs. I personally would just create multiple routines.
 
Separate programs can also have separate local program scoped tags. I have several 'mostly canned' programs I toss together for various applications, sharing common code even among very different machines in the plant, simply because I can drop them in as complete programs, and don't have to incorporate into the main line control.
 

Similar Topics

Hi everyone, I hope this isn’t too much to ask?!? I hope no one minds my “new programmer” questions. Deep breath, here goes… I am having some...
Replies
2
Views
1,624
I have moved some programs from the tasks to the unscheduled programs / phases. All the code is deleted from the programs; all the tags have been...
Replies
3
Views
4,478
i have factorytalk application (.mer) and rslogix 5000 application(.acd) and the are some problems in factorytalk application some trends are not...
Replies
2
Views
3,892
i think that after electricity got off the program in my plc deleted so i want to comper the program in the computer and the program in the plc...
Replies
4
Views
1,999
Can anyone assist me deleting Unschedule programs in RSLogix 5000? I am using an old program and don't need several routines that i shifted it in...
Replies
4
Views
7,777
Back
Top Bottom