Addon Instruction - output array of unknown size. RsLogix 5000

clementcbc

Member
Join Date
Sep 2010
Location
Hong Kong
Posts
24
Hi,

I'm new to this PLC game.

Using RsLogix 5000
I'm trying to write a addon instruction that will write the result string to a destination SINT array of unfixed size.

So I've basically got.
MyAddon is the name, with following tags:
ResultArr, SINT[100], LocalTag.
DestArr, SINT, InOut param.

The user would pass element [0] of an array to it.
|--MyAddon------------|
|DestArr = SomeArray[0]|
|-----------------------|
(SomeArray will be SINT[x]. I don't want to force the user to use a specific sized array)

Inside my Addon, I use COP to copy my ResultArr into DestArray.
However, only the first SINT is copied.
I.e. SomeArray[0] will be correct (ResultArr[0]), but SomeArray[1..x] are all blank.

Does anyone have know how to make it work properly?

Thanks!
 
I was trying to do this a while ago myself. To the best of my knowledge there is not a way to pass an array into an AOI that is a different size than the matching declared array. So internally if you have a SINT[100] array you need to pass a SINT[100] array or it won't accept the rung.

A COP won't work at the array tag level. You need to specify an element value. Once you specify the array to the element level the length is in destination data type elements. For example:

assume Input[100] as a 100 element SINT array
Output[100] as a 100 element SINT array

COP(Input, Output, 1)
is an invalid entry

COP(Input[0], Output[0], 1)
copies only the first element of the source array

COP(Input[0], Ouput[0], 100
copies the whole array.

Keith
 
Hi Keith,

Thanks for your help on that.

Actually, I found a semi acceptable solution.
According to "Logix5000 Controllers Common Procedures", PDF published by AB.
(Attached) Pg 273 says you can pass "array tag that is the same size as
your definition" OR "an array tag that is larger than your definition".

So i made DestArr to be SINT[50], and ensured SomeArray to be SINT[>50].
That's good enough for what i need, so that's cool.

And yes, thanks for the tip. I managed to figure out the COP array thing eventually. =)
 
You learn something new every day. I didn't know that.

Given the limitation, why would they do any checking at all? I guess in the future I will just declare all of my In/Out arrays as single element arrays to give myself the flexibility.

When I was trying this I called my local Rockwell rep to see if I could do anything about this. I was told the array sizes had to match. Apparently it pays to RTFM once in a while. :oops:

Keith
 
I don't know why.

The strange thing is:
I had no problems using SINT as a InOut param to copy an array into the addon's internal array.
But I did have problems using the same method to copy from addon's internal array into InOut param. (which was my original problem).

I think it is designed to protect InOut parameters from copy overflows, but not the internal structures.
 

Similar Topics

Hi, I'm creating a simple addon instructions with some inputs and outputs as you normally would (RSLogix 5000 version 20). When I add the...
Replies
3
Views
1,697
for micrologix devices rslinx 5000 I am task with adding some static bars to one of our lines. The current code has 2 bars already in place. I'm...
Replies
3
Views
1,489
I'm running an AOI on a CompactLogix L33ER. In the AOI I trigger a TON (Local Tag) with a input parameter bit (HMI Enable Pushbutton). I have a...
Replies
19
Views
3,741
I finally got my hands on a copy of RSlogix 5000 and have been playing around with it. I'm a little confused about add on instructions, but I've...
Replies
14
Views
3,242
Hi all, I use prosoft MVI56MCM in controllogx L62 as modbus communication card. I download addon instruction from prosoft website and...
Replies
2
Views
2,497
Back
Top Bottom