Jsr/sbr

dskplc

Member
Join Date
Aug 2013
Location
New Zealand
Posts
119
Hi,

I have been tasked to test JSR/SBR instructions using parameters in RSLogix 5000. I found a video that was extremely helpful using 1 parameter in the JSR instruction going to the 1 parameter in SBR. I need to use 4 parameters in the SBR (no RET) and am assuming I will need 4 parameters in the JSR also?
I have not done this before so can use any advice possible. I have read the Rockwell manual for general instructions but am still lost. Thanks in advance for your help.
 
Think of the JSR and SBR parameters as Move (MOV) instructions

Each JSR Input Parameter is the Source of a MOV, and then each SBR Input Parameter is the Destination for a MOV.

There is no requirement that you use Return (RET) parameters.

OG

Parameters.JPG
 
Think of the JSR and SBR parameters as Move (MOV) instructions

Each JSR Input Parameter is the Source of a MOV, and then each SBR Input Parameter is the Destination for a MOV.

There is no requirement that you use Return (RET) parameters.

OG
Thank you very much.
 
Jsr/ret

Thank you for the replies about JSR/SBR.
I also have been tasked to test JSR/RET (no SBR) but only can have return parameters for both instructions (no input parameters). I am wondering if I can only have a return parameter on a JSR? I have seen a RET have a return parameter but not a JSR. Thanks in advance for advice in this too.
 
Thank you for the replies about JSR/SBR.
I also have been tasked to test JSR/RET (no SBR) but only can have return parameters for both instructions (no input parameters). I am wondering if I can only have a return parameter on a JSR? I have seen a RET have a return parameter but not a JSR. Thanks in advance for advice in this too.

Yes, you can do this. The JSR can have both Input and/or Return parameters. The SBR can only have Input parameters and the RET can only have Return parameters

Using my example from above. The RET Return parameters would be the Source of the Move. The JSR Return parameters would be the Destination.

OG
 
Yes, you can do this. The JSR can have both Input and/or Return parameters. The SBR can only have Input parameters and the RET can only have Return parameters

Using my example from above. The RET Return parameters would be the Source of the Move. The JSR Return parameters would be the Destination.

OG
Thank you! I really appreciate your reply.
 
Now for the important questions:

How do you guarantee that the variable mapped is in the right parameter? Similarly, how do you guarantee that it's the correct data type?

How do you guarantee that your parameter isn't overwritten in another routine?
 
Here's an example I posted a few years ago. Not shown in the pic at the end of the routine is RTN VibSensorInSBR that returns the vibration sensor UDT to whichever sensor is the data. The returned UDTs are elements in a larger pump UDT. I could have passed the register addresses to the SBR as an input parameter, but chose this way because it seemed like the thing to do at the time. Nowadays I would be tempted to use an AOI instead of a SBR. There's many ways to a desired result.

http://www.plctalk.net/qanda/showthread.php?p=785758#post785758
 

Similar Topics

Hello Gurus, I am working on the elevator exercise of LogixPro and my output on the subroutine is being energized without its flag being called...
Replies
4
Views
2,166
Jsr
We have a motor control JSR with Input and Output parameters, There are 36 motors that are controlled by the same JSR. What or how can I view...
Replies
8
Views
500
I intend to pass a BOOL array to an ST routine (for loop) to count the true bits. (should never have used a Bool array, lesson learned) The ST...
Replies
10
Views
823
Currently, I have a 1769-L36ERM that is being using to control a machine with 15 servos. Due to the nature of the process, the code is very...
Replies
9
Views
1,515
I have this program: ZIP (.rss inside no documentation). PDF (Italian documentation). Allen Bradley SLC5/03 PLC. I want to know how is the...
Replies
8
Views
2,020
Back
Top Bottom