Passing input paremeters

Krilun

Member
Join Date
Aug 2008
Location
Cleveland
Posts
44
I would ideally like to increment a DINT tag from a JSR instruction as in input parameter and pass it into a subroutine. Is this possible and if it is, how do I do this?

-Ken
 
Ken, Can you specify what programming software you are using? I'm assuming it is a Rockwell package. So initially I will say yes you can pass parameters (using the JSR and SBR instructions together) and/or use AOIs in Logix 5000 instead of a separate subroutine.
The help file on JSR and SBR in Logix 5000 does a good job of explaining how to do this. Pass the parameter using the JSR and receive it in the subroutine using the SBR instruction. You can pass the parameter back (if needed) using the RET instruction.
 
the help files didn't give me what I need. What I need to syntax. Say I have a DINT tag called TEST and I wanted to pass it in with a value of 4. Other than moving the value of 4 into TEST and using it as in input paramenter, in the JSR input parameter box can I say something like TEST=4
 
the JSR instruction can't execute what other instructions accomplish only pass and receive tags. For example you'd have to do a MOV 4 TEST first then use TEST as an input paramater in the JSR to pass the DINT into the subroutine. I guess I'm not understanding what you are trying to accomplish.
 
I'm a C++ programmer. I'm use to modifying input parameters, for example I could add 1 to TEST and pass it by simply saying ++TEST or I could mulitply it by 2 and pass it TEST*2. Thats what I want to do with JSR is modify what I'm passing as I'm passing it.

But I guess I am limited to moving DINTS into tags and then passing them.
 
I understand what you are getting at. Ladder logic and computer programming are different beasts. You have to manipulate your data first, then pass in the parameters of the JSR instruction. In logic you will need to do an ADD of a static 1 to TEST (ADD 1 TEST) first then after that (in the same rung) do a JSR call.
 
Configure the subroutine to take a single DINT as an input, and to return a single DINT as a return value.

In the subroutine, use a local DINT tag as the by-value pass of the input DINT, increment it, and return the local DINT back to the subroutine call.

Note that the JSR must be configured with one input parameter, and the same parameter as a return value.

In 16+, use an AOI, with In/Out parameter.
 

Similar Topics

Hello I am trying to have one screen that has one trend, that I can have an operator select what tag to trend. IE I am trending a bit shift, a...
Replies
0
Views
1,161
hey folks, I am just new in the industrial world so bear with me. I have rslogix5 and i have a input signal which i want to bypass. If this...
Replies
5
Views
2,836
I'm using FactoryTalk ME version 13. I'm aware how to pass a parameter file once, but I was wondering if it is possible to do it twice...
Replies
4
Views
155
I inherited a project in which a ME application displays process measurements (temp, pressure, flow, etc) on a PanelView Plus display. The data...
Replies
4
Views
489
My first real attempt at utilising the AOI function in Compactlogix. The issue I'm having is, I have an array of INT[400], but in my AOI I'm only...
Replies
1
Views
454
Back
Top Bottom