You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old September 14th, 2021, 02:39 PM   #1
dskplc
Member
New Zealand

dskplc is offline
 
Join Date: Aug 2013
Location: New Zealand
Posts: 116
Jsr/sbr

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.
  Reply With Quote
Old September 14th, 2021, 03:29 PM   #2
Operaghost
Member
United States

Operaghost is offline
 
Operaghost's Avatar
 
Join Date: Apr 2002
Location: Dallas, TX USA
Posts: 3,329
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
Attached Images
File Type: jpg Parameters.JPG (68.0 KB, 100 views)
__________________
I despise when people take random quotes and ascribe them to me - Julius Caesar
  Reply With Quote
Old September 14th, 2021, 03:32 PM   #3
widelto
Member
Colombia

widelto is offline
 
widelto's Avatar
 
Join Date: Jul 2005
Location: Barranquilla, Colombia
Posts: 3,076
see attached files

Opera was faster
Attached Images
File Type: jpg Capture Subroutine being called.JPG (151.0 KB, 18 views)
File Type: jpg Capture call subroutine.JPG (100.0 KB, 18 views)
__________________
My two cents.
  Reply With Quote
Old September 14th, 2021, 03:32 PM   #4
nehpets
Member
Wales

nehpets is offline
 
nehpets's Avatar
 
Join Date: Mar 2009
Location: Wales
Posts: 478
You can set up a UDT and pass that as a parameter.
__________________
Why do programmers get confused between Halloween and Christmas - OCT31 = DEC25
  Reply With Quote
Old September 14th, 2021, 04:45 PM   #5
dskplc
Member
New Zealand

dskplc is offline
 
Join Date: Aug 2013
Location: New Zealand
Posts: 116
Quote:
Originally Posted by Operaghost View Post
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.
  Reply With Quote
Old September 14th, 2021, 04:47 PM   #6
dskplc
Member
New Zealand

dskplc is offline
 
Join Date: Aug 2013
Location: New Zealand
Posts: 116
Quote:
Originally Posted by widelto View Post
Opera was faster
That looks good. Thank you!
  Reply With Quote
Old September 14th, 2021, 04:48 PM   #7
dskplc
Member
New Zealand

dskplc is offline
 
Join Date: Aug 2013
Location: New Zealand
Posts: 116
Quote:
Originally Posted by nehpets View Post
You can set up a UDT and pass that as a parameter.
Good idea. I will try that too. Thank you.
  Reply With Quote
Old September 14th, 2021, 04:53 PM   #8
dskplc
Member
New Zealand

dskplc is offline
 
Join Date: Aug 2013
Location: New Zealand
Posts: 116
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.
  Reply With Quote
Old September 14th, 2021, 05:02 PM   #9
Operaghost
Member
United States

Operaghost is offline
 
Operaghost's Avatar
 
Join Date: Apr 2002
Location: Dallas, TX USA
Posts: 3,329
Quote:
Originally Posted by dskplc View Post
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
__________________
I despise when people take random quotes and ascribe them to me - Julius Caesar
  Reply With Quote
Old September 14th, 2021, 06:04 PM   #10
dskplc
Member
New Zealand

dskplc is offline
 
Join Date: Aug 2013
Location: New Zealand
Posts: 116
Quote:
Originally Posted by Operaghost View Post
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.
  Reply With Quote
Old September 15th, 2021, 03:17 AM   #11
cardosocea
Member
United Kingdom

cardosocea is offline
 
Join Date: Nov 2016
Location: Fields of corn
Posts: 1,944
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?
  Reply With Quote
Old September 16th, 2021, 07:17 PM   #12
dskplc
Member
New Zealand

dskplc is offline
 
Join Date: Aug 2013
Location: New Zealand
Posts: 116
That is a very good question.
  Reply With Quote
Old September 17th, 2021, 03:05 AM   #13
5618
Lifetime Supporting Member
United States

5618 is offline
 
5618's Avatar
 
Join Date: Oct 2017
Location: York, PA
Posts: 181
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/showthr...758#post785758
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
JSR/SBR on LogixPro kohhm75 LIVE PLC Questions And Answers 4 March 21st, 2020 03:30 PM


All times are GMT -4. The time now is 08:04 AM.


.