Subroutines vs. Add-on Instructions in RSLogix 5000?

Use an AOI:
When you do not want to be able to access global variables, without passing them, in the code.
When you find it exciting to guess just how much free memory you need for the temporary memory used by the AOI when calling it.
When you do not want to be able to do online edits of the code.
When you want to use trial and error to find out at which amount of code an AOI saves memory instead of using duplicate code between routines.

But also when:
You need to lock part of the code from future editing.
 
When you want to use trial and error to find out at which amount of code an AOI saves memory instead of using duplicate code between routines.
By the way, I saw a program designed in india that calls the same subroutine more than 30 times from the main routine, but they change input and output parameters every time they call the subroutine, I wonder in this way, which one is faster or mofe effective AOI or subroutine method.?
 
Why wonder?

I wonder in this way, which one is faster or mofe effective AOI or subroutine method.?
Make a loop of 100 iterations an call a AOI and a subroutine that do the same thing. Use the real time clock to time the two and compare.

My hunch is that the subroutine and AOI would compile down to nearly identical code and take about the same a mount of time. If I am wrong it would be good to know which is faster.
 
Each instance of an AOI has its own tag and thus its own memory space. A subroutine does not - it uses the same memory space each time it is called.
 

Similar Topics

What are the pro's/con's of using subroutines vs using the add-on instructions in RS5k? With the add-on instructions, the actual code is visible...
Replies
9
Views
4,006
I have been asked to extensively modify a piece of machinery that is very mission critical to the operation, thus not allowed much downtime or...
Replies
4
Views
2,311
We have an application where we need to indicate a piece of machinery needs maintenance. I have created a routine which resets a value of "days...
Replies
12
Views
3,752
Hi all. Please see attached. Tried to google the error with absolutely no results. I did the same at payed version and real PLC so I'm almost...
Replies
7
Views
2,342
hello all is there a rule of thumb as to using or not using subroutines when writing a program ? i am using an Allen Bradley slc 500 thank you...
Replies
5
Views
1,748
Back
Top Bottom