Jsr plc 5

schui

Member
Join Date
Sep 2011
Location
Toronto
Posts
51
Hi ALL

Could someone please help me to understand what is happening with the following instruction

I have a JSR with the following parameters

Program File Number U:61
Input Parameter N12:470
Input Parameter 120
Input Parameter 10.0
Return Parameter N12:470

Thank you I appreciate any help
 
Hi ALL

Could someone please help me to understand what is happening with the following instruction

I have a JSR with the following parameters

Program File Number U:61
Input Parameter N12:470
Input Parameter 120
Input Parameter 10.0
Return Parameter N12:470

Thank you I appreciate any help

There is Data being passed to and from the Subroutine when it is called. Without seeing the PLC Program, there is no way of knowing what the Data is.

Have a look at the JSR Instruction in this Manual.

http://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1785-rm001_-en-p.pdf

Stu....
 
in simplest terms, this is an example of the JSR "passing parameters" to the subroutine ...

look at the SBR at the top of ladder file #61 ... and at the RET at the bottom of that same file ... they're other pieces of the puzzle - and you'll need to get a handle on how they work in order to fully understand the JSR ...
 
Last edited:
I have a JSR with the following parameters

Program File Number U:61
Input Parameter N12:470
Input Parameter 120
Input Parameter 10.0
Return Parameter N12:470

Program File 61 is called (meaning the code in it will execute, and the data values specified by the "Input Parameters", are pushed into a FIFO stack.

Program File 61 will have a SBR instruction (first instruction - that's a rule), that unloads the FIFO stack into the 3 addresses listed in the SBR.

The subroutine can now execute its code with those values "passed" from the calling routine.

The RET instruction loads the value specified by the "Return Parameters" into a FIFO stack, and code execution is returned to the JSR in the calling routine. The FIFO values are loaded into the addresses specified in the JSR Return Parameters.

In your specific case, N12:470 is both an Input and a Return Parameter, so it is most likely being modified by the subroutine file 61, using the literal data values 120 and 10.0 specified as Input Parameters in the JSR
 
Example from Page 13-9 of the PLC5 Instruction Set Reference Manual:

PLC5 JSR Subroutine Passing Parameters Example..jpg
 
Last edited:
Quick question for any of you on this feed. I have a similiar situation in a PLC 5 controller with the following parameters:


Location: Toronto
Posts: 51
Jsr plc 5
Hi ALL

Could someone please help me to understand what is happening with the following instruction

I have a JSR with the following parameters

Program File Number U:7
Return Parameter B0:0
Return Parameter B0:0
Return Parameter CT3175:18253
Return Parameter B0:-32581.100

Now first off this program is running online at the plant and I have this offline copy. I try to verify the program and get 4 errors for each return parameter. Also within the U:7 routine there is no SBR or RET instruction.

Does this mean that these return parameters can be removed?
 

Similar Topics

Hi Everyone, I'm writing a program to control 2 motors depending on a switch selector position A or B. In POS A, motor 1 should be running while...
Replies
12
Views
2,862
Hi, does it matters if I stop reading a subroutine (adding AFI instruction in front of the JSR) when he PLC is running. I verified and...
Replies
3
Views
2,450
Help! I've created extra files online with Logix500, but when I try to include them in the main (JSR) the PLC faults. Any suggestions?
Replies
1
Views
4,637
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
528
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
853
Back
Top Bottom