RET Instruction with Zero Return Parameters

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...
7
Replies
5,597
Views
I have a segmented network with proper routing so I can reach across subnets without issue, but why can't FT Linx browse across subnets? If its...
10
Replies
1,261
Views
Does anyone have a copy the old System Ferret software? I can't find it in my software repository. It was a free download.
3
Replies
1,104
Views
Have a 1768 L33ER. Whole local chassis faulted with this error. Already tried new controller. New end cap. First module 1769 IQ16 is bad...
0
Replies
1,136
Views
"Hello, I am a user using GX-Works2. I have a question - if there is a subroutine where P000 is not declared and only the RET instruction is used...
0
Replies
468
Views
Top