Is there a way to pass a variable size array to an AOI?

BAJ1

Member
Join Date
Mar 2010
Location
Minneapolis
Posts
19
I looked into this a little bit a while back but now have an application where it would make life soooo much more simple if this is possible.

From what I can tell, the InOut type in AOIs needs to be defined up front, including array size if the InOut is an array. The tag you enter when using the AOI must match in type and array size. There doesn't seem to be a way to pass the first element of an array (like a pointer in C) and then use additional elements within the AOI.

Obviously it can be done in the built-in instructions like COP, but is there a way to do this with AOIs?

Thanks,
-Brad
 
I'll try this out, but for now my first thought is that since it's an InOut parameter, it doesn't "copy" into an internal parameter, so thinking that it should just work....????

Watch this space while I try it...
 
Thanks for the reply. I think I tried that previously and you get a verify error for the AOI. But let me know what you find out.
 
Thanks for the reply. I think I tried that previously and you get a verify error for the AOI. But let me know what you find out.

OK - so I made my AOI InOut parameter as data-type DINT[20]

Then I wrote AOI calls to fire arrays Array1 and Array2 at it...

Initially Array1 was DINT[20] - and it worked ok.

Array2 I made DIN[50] - and it still was ok.

I then changed Array1 to DINT[5] and got a verification error.

So it seems that the array size you send to the AOI has to be at least as big as that declared, but bigger is OK.

So I tried with the AOI InOut parameter as a DINT[1], and was still able to access the elements of larger arrays sent as parameters !! That is shown in the pictures - the AOI parameter is DINT[1]

Dunno if that is any help to you....

2012-02-28_233014.jpg 2012-02-28_233029.jpg
 
Here it is working. Notice the AOI InOut parameter is a DINT[1] array, but the AOI code is fetching data from other areas in bigger arrays.

I included a SIZE check in the AOI logic, so that I wouldn't crash the processor.

2012-02-28_234428.jpg 2012-02-28_234645.jpg
 
So I'm guessing that helps ?

I changed it a bit....

added a Not_Present flag if the element pointer is too big for the array passed.

2012-02-28_235628.jpg 2012-02-28_235659.jpg
 
Last edited:
Daba, I really appreciate your help on this, can't wait to try this out!

So the verification step in RSL5k can't verify that you are accessing elements outside the predefined array size because the index is passed as a variable. The issue I ran into before was that I was explicitly accessing certain elements of the array (beyond the defined size) within my AOI and the verification step caught that.

I was going to head home now but I think I may have to stay later and try this out!
 
edited post above

& don't work too late !!

definitely include the SIZE check, you don't want your PLC faulting on you....
 
Thanks, I will. My AOI requires a buffer array as an InOut, so I'm using SIZE to make sure the buffer is at least as large as the target array, setting an ERR bit Output if not.

Freezing rain now. I think it will be a long 38 miles home.
 

Similar Topics

I'm hoping someone can help me with this. I have a display using a parameter file. I want to be able to click on a button and have it bring up a...
Replies
3
Views
1,952
Hello, I am still new to PLC programming and I just got this job two year out of school so I don’t remember much. I was given a task were I have...
Replies
1
Views
169
So I'm having issues with a certain rung and one of my coworkers mentioned it may not allow the signal past the latch coil. For example in the...
Replies
27
Views
3,751
I’m a bit stuck on HMI (KTP-1200) programming… See the picture attached. The PASS or FAIL box should only appear when the toggle switch is...
Replies
7
Views
1,076
I've been given a line that has several sysmac c200Hx PLCs. The First station Im trying to wrap my head around has a NS8 HMI. I'm using Cx-one...
Replies
2
Views
750
Back
Top Bottom