Scanning In RSLogix 5000

MarkNightingale

Lifetime Supporting Member + Moderator
Join Date
Sep 2010
Location
In The VAT Shed
Posts
732
Hi,

I think I have got this correct but I just want to make sure.

I have acquired a program which has quite a lot of JSR's and RETurn's in the program files.

This is what I believe happens.

If a JSR is used and there is no RETurn in the program file that was called, then the program will execute the next program file in the current task.

If a JSR is used and a RETurn is used the program will RETurn back to the program file where the JSR instruction was used and continue from the rung after the JSR.

I hope this makes sense.

Mark
 
This is what I believe happens.

If a JSR is used and there is no RETurn in the program file that was called, then the program will execute the next program file in the current task.

If a JSR is used and a RETurn is used the program will RETurn back to the program file where the JSR instruction was used and continue from the rung after the JSR.



this would be more correct for your first (with no RETurn) condition:

suppose that a JSR is used - and there is no RETurn in the file that was called ...

when the processor reaches the end of the "called" file, then it will go back to the point at which the JSR instruction was used - and continue on from that point.


and this for the second (with a RETurn) condition that you mentioned ...

suppose that a JSR is used - and there is a RETurn in the file that was called ...

when the processor reaches the RET in the "called" file, then it will go back to the point at which the JSR instruction was used - and continue on from that point.


in simplest terms, the RET doesn't change the point to which the processor returns ... instead it only affects whether the processor will "depart" from the called routine "early" – in other words, before it reaches the bitter end of the called routine ...
 
Last edited:
Hi,


If a JSR is used and there is no RETurn in the program file that was called, then the program will execute the next program file in the current task.


Mark


There is an "Implied" return at the end of every subroutine. Therefore, unless it sees a RET statement earlier in the subroutine, it will simply process the entire subroutine and then return to the point of call.

The RET statements are generally used to end a routine pre-maturely. Not matter what, you always return to the point of call (unless of course you dig down too deeply into nested calls).
 
Thanks for the replies.

It all makes sense now.

The program is using the RETurn function to go back if a condition is not met, so as not to carry on the sequence un-necessarily.

Thanks again.

Mark
 

Similar Topics

Hey all, I'm taking on my first big project and had a general, hopefully simple, question. Under my MainTask, I have my MainProgram, and under...
Replies
5
Views
5,304
Hello, I am using Unity pro V15. I have Quantum CPU 671 and Ethernet NOE 77101 configured. I have configured IO scanning on NOE. I have attached...
Replies
5
Views
137
Hi I am in the process of making an OT lab for training and to test incident response, an i keep hearing NOT to scan network because some...
Replies
3
Views
854
Looking for some application advice with barcode scanners and Compactlogix PLC and a Panelview Plus. I assume Ethernet/IP is the way to go here...
Replies
1
Views
1,571
Hello guys, We a compact logix processor and one of the safety input modules 1734-IBS seems to be faulty as sometimes the module led turns red...
Replies
4
Views
1,453
Back
Top Bottom