RET Instruction with Zero Return Parameters

dskplc

Member
Join Date
Aug 2013
Location
New Zealand
Posts
119
Hello, I have been tasked to create routines that has a JSR with zero return parameters to go to a routine with a RET with zero parameters. Is this even possible since there will be zero parameters to return?! I really appreciate any advice since I need to finish this task. Thanks in advance.
 
I am assuming Rockwell/Allen-Bradley. If otherwise, please let us know.

The RET instruction is typically found at the end of a subroutine. In addition to returning parameters, the RET instruction tells the scan to return from the subroutine, back to the JSR that called that routine. But it isn't required to use the RET as the END rung performs this same action.

However, you could program the RET with an input condition and place it somewhere in the middle of your subroutine. If the input is true, the scan would return now, and the rest of the subroutine would not be scanned. If the RET rung were false, the scan would continue to the END and then return.

So yes, the RET can be used in a program without making use of return parameters.

OG
 
Hi OG. Thank you for your reply. Yes, this is using RSLogix 5000. I guess I was thinking the RET would have to go strictly to the JSR so it is good to hear it goes to the routine where the JSR called it. I appreciate your guidance how to do this. Cheers.
 

Similar Topics

I am looking at the source code for a very old project and I noticed that the programmer added a RET instruction without any parameters to the end...
Replies
7
Views
2,704
Hi everyone, I have a series of 8 or 9 subroutines that are not in the main program file (File 2)..they are all consecutively placed in Ladder 11...
Replies
8
Views
412
I'm looking for a way to use the Audit Value for the controller to detect changes made programmatically. This link lays it out pretty cleary (page...
Replies
7
Views
2,699
On site and another Programmer is getting a Major Fault when downloading code that I gave him to interface withour machines. I have JSRs that...
Replies
3
Views
884
Posted just because it's has an Allen Bradley keyed selector switch https://www.youtube.com/watch?v=YeFevEGoPF0 LockPickingLawyer
Replies
6
Views
2,730
Back
Top Bottom