Invalid array subscript specifier RSLogix5000

Barry Kirk

Lifetime Supporting Member
Join Date
Mar 2007
Location
York, PA
Posts
61
I'm having trouble with nesting arrays.

Example.

Created a tag called Test[10] which is of type DINT

Entered the ladder with...

CLR(Test[Test[3]])

produces the error Invalid array subscript specifier.

Test[3] contains the value 0 so it should work.

moving Test[3] into another DINT, OtherTest and then using that DINT

CLR(Test[OtherTest])

this works.

Is there any way to nest subscripts with RSLogix5000 ?
 
Hmmm...seems you are using a recursive pointer...apparently illegal, since both indirections point at the same file...

My best guess is that only one indirect address per data source.element is allowed.

Looks like the interim storage is the fix...
 
Well, I also tried

Test[NewTest[0]]...

Where Test is an array of DINT

and NewTest is also an array of DINT

That didn't work either.

Where NewTest[0] == 1

and Test was a length 10 array.
 
I remember having trouble with 2 indirects which were nested. I'm pretty sure that isn't allowed currently. It may even be that 2 indirect references even if not nested ( variable[array_index reference].[bit index reference] ) may not be allowed either. I loved programming in 'C' for machine control. Almost everything was expressed in multiple indirect references.
 
Barry Kirk, good find, but just because you can doesn't mean you should.

OkiePC said:
Hmmm...seems you are using a recursive pointer...
It isn't a recursive pointer, Bernie has it right, it is indirect addressing. I am not so sure I agree with Bernie's love for pointers to pointer to pointers to pointers.... It makes debugging difficult.

Is Test[] an array of integers? Otherwise you will get a fault for indexing into an array with the wrong data type.

Looks like the interim storage is the fix...
Yes,
I:=Test[3];
CLR(Test);

This should work. I tried this on our software. I fails like the RSLogix5000 does :( The work around works on our software and I bet is will work on the RS5000 too.

Barry Kirk, why do you need to do this? Your second example is more plausible. I can see shifting a queue of indexes or pointers as being much easier and efficient than shifting whole data structures.
 
We can do it now! It will be fixed in the next release :)

I was surprise it was that easy to fix. I don't write the compiler code so I had no idea.

P0:=YourArray[MyArray];

Still the trick is that MyArray must be an array of integers or converted to an array of integers. YourArray can be anything.

Everyone here was wondering the same thing I was. Why would you want to do that?
 

Similar Topics

I have installed a Yaskawa VFD and am getting this error in the PLC now? Error: Rung 57, MOV, Operand 0: Invalid array subscript specifier.
Replies
1
Views
2,009
Please help. I'm trying to use the BSL In rslogix 5000. Then, Error: Rung , BSL, Operand 0: Invalid array subscript. Please help
Replies
2
Views
3,996
I'm running into an issue with a few Add-Ons within my rungs, I will add some pictures for a description of what is happening, I know I'm missing...
Replies
14
Views
3,267
Hi, I'm trying to add ethernet modules to one of our plcs, but I get about 15 errors that say "Invalid Signature. Reseal instruction to resolve."...
Replies
5
Views
336
Hello, Im new to Studio 5000 View Designer and i try to make a popup reusable screen. So i create a user-defined screen with 2...
Replies
2
Views
256
Back
Top Bottom