RSLogix5000 Add-on instructions: how to remove required InOut parameter?

ryangriggs

Lifetime Supporting Member
Join Date
Jun 2016
Location
USA
Posts
198
In RSLogix5000 I am attempting to create an add-on instruction called "SWAP" which simply swaps the values of two integer tags.


Here is what the instruction looks like in Ladder:


K6ERM.png



As you can see, the first input is called "SWAP" and requires a tag of type "SWAP" to be created and attached. I can't understand why this parameter exists, and I can't figure out how to get rid of this. It's not present in the Parameter list. It seems messy and confusing to be required to create a separate tag every time I use the instruction, since it's only interacting with other tags to swap their values. This is not necessary on any built-in instructions, so why is it necessary on add-on instructions? Or, if it's not necessary, can you please help me understand out how to remove it?




I reviewed the Rockwell manual for add-on instructions, but I can't find anything that references this parameter or how to remove it.



Enlightenment would be greatly appreciated.



Here is the parameter config screen:
K6ERS.png


Here's the instruction's logic:
K6ERW.png
 
Most Instructions require a tag for them to be able store their parameter data and their status. When you create a timer, you must have a timer tag to go with it. When you create a counter, you have to create a counter tag. Likewise, when you create an AOI, each instance will require a unique tag be assigned to it. Your SWAP has an EnableIn and an EnableOut. Those bool tags must exist somewhere. Likewise your First and Second will be stored here also.

OG
 
As you can see, the first input is called "SWAP" and requires a tag of type "SWAP" to be created and attached. I can't understand why this parameter exists, and I can't figure out how to get rid of this. It's not present in the Parameter list. It seems messy and confusing to be required to create a separate tag every time I use the instruction, since it's only interacting with other tags to swap their values. This is not necessary on any built-in instructions, so why is it necessary on add-on instructions? Or, if it's not necessary, can you please help me understand out how to remove it?

Where do you think the 'EnableIn' bit you are using resides in memory? Answer: It's part of the tag you create. The AOI-generated data type assigns memory for EnableIn, EnableOut, and any input or output (but not InOut) data the instruction will use. Built-in instructions likely do have the same or equivalent memory usage, it's just not always exposed to the user.

In your case I suspect you could re-use the same tag for all your instructions without issue, especially given how minimal your AOI is.

EDIT:
Likewise your First and Second will be stored here also.
I am reasonably confident this is incorrect -- InOut tags are passed by reference, not value, so First and Second will look at the external tags provided and will not have any internal storage for them.
 
Last edited:
Thanks, that makes sense. Not well explained in the Rockewell docs. You cleared it up.
 
...I am reasonably confident this is incorrect -- InOut tags are passed by reference, not value, so First and Second will look at the external tags provided and will not have any internal storage for them.

Correct. I had not noticed they were In/Out. But I think our point was made and the OP understood.

OG
 

Similar Topics

Are there any downfalls to using add-on instructions, other than having to import them manually? I would like to create add-ons for such things...
Replies
2
Views
1,737
The help file for RSLogix 5000 v16 mentions several instructions that cannot be used within a custom Add-On:JSR Jump to Subroutine...
Replies
1
Views
6,801
Hello everyone. I'm working with RSLogix 5000 and everything looked to be perfect, I am able to watch all my devices en RSLinx. So I have a...
Replies
1
Views
1,941
I'm trying to display the concentration of a solution on an HMI. I want to do the calculation in the PLC (ControlLogix). The problem is that it...
Replies
2
Views
1,511
I have a tag called 'MBTCP.DATA.ReadData' INT[600] of which I would like to pull 16 sequential values into an add-on instruction. I will need...
Replies
6
Views
2,514
Back
Top Bottom