RS500 - Studio 5000 Indexed Indirect Addresses

aarmcc01

Member
Join Date
Apr 2023
Location
Coventry
Posts
11
I have upgraded an old RS500 project to Studio 5000, it has thrown multiple errors which I am currently working through.

I have looked through other posts and read the help file for Indexed Indirect Addressing but not sure how it translates.
I am confused as to why the upgrade has thrown errors? Why does Studio 5000 not understand what the tag should be in the COP instruction?

Also, does anyone know how I would retag it in my new program?

Please see the two pics attached.

Screenshot 2023-04-27 091555.png Screenshot 2023-04-27 091741.png
 
You need to create an array. SLC's didn't have bounded arrays as such, so you'd state the file and element you wanted to locate that memory location.

I don't know enough about the application, but when refactoring, do consider the option of having arrays of UDT's to group things even further. Yes, this isn't flexible for modifications in the future, but may make reading the logic easier to do.
 
That syntax, i.e. N[CURRENT_LOOKUP][1], is from the C programming language (and others). As you discovered, it will not work in RSLogix 5000 :eek:.

You are probably looking for this:
COP N[CURRENT_LOOKUP,1] MIX1(2?)_TARG_ING_1
COP N[CURRENT_LOOKUP,0] MIX1_PRODUCT_CODE
but that all depends on how the two-dimensional array N and the one-dimensional array N91 are declared, and how CURRENT_LOOKUP is calculated, and you have not shown us any of that.
 
You're going to have to take a step back and examine the overall recipe management program. ControlLogix array tags generally do 1, 2, and 3 dimensional arrays *better* than the PLC/SLC did, but they don't have all the exact same features and functions as PLC/SLC data table addressing did.

What your program is doing is selecting the source for some data copies, indirectly. It's choosing to copy the data from different N-type (Integer) data table files.

The default data table file is N7. A SLC data table file can be up to 256 words in length, so the elements in N7 can be as much as N7:0 - N7:255.

In your logic, the position in the data table is literal: the copies start at Element 0 (1 word long) and Element 1 (5 words long).

It's the Data File number that's being changed.

If N7:23 = 10, then the source data file will be N10. 5 words from N10:1-5, placed into N92:1-5, and 1 word from N10:0 placed into N92:6.

If N7:23 = 11, then the source data file will be N11. 5 words from N11:1-5, placed into N92:1-5, and 1 word from N11:0 placed into N92:6.

In ControlLogix you could make an array where the first dimension is equivalent to the number of data table files used in this way, and the second dimension is 255 (the maximum length of a SLC data table).

But you couldn't use the exact same values in the data table number selector (N7:23), because it could be anywhere in the SLC's data table numbers, and ControlLogix is using an ordinary Array that starts at element zero in each dimension.

Or maybe you're already further down this path and I just have to say that the dimensions of a 2-D ControLogix array are separated by commas, so your syntax in the converted instructions should be "N[Current_Lookup,1]"
 
Last edited:
I now think I understand it...

N[N7:23] would be the same as writing N[100] if N7:23 = 100 and refers to the N100 - Recipe 000 in the image attached.
if N7:23 was 105, we would have N105 - Recipe 005?

Now, I need to understand how to write that in RS5000? I've tried a few things but not quite sure.

Screenshot 2023-04-27 121805.png
 
@Ken: can you declare the limits of the indices of an array in RSLogix5000?

E.g. Declare the array N as INT[100..131,6] (or INT[[100..131,0..5]).

Then if CURRENT_LOOKUP (the recipe index N7:23 in RSLogix500) is 100, it would take the first row from that N array i.e. N[100,1] through N[100,5] and N[100,0].

If that range of indices cannot be declared as 100..131, then declare array N as INT[32,5], and subtract 100 from CURRENT_LOOKUP e.g. N[CURRENT_LOOKUP-100,1], or
SUB CURRENT_LOOKUP 100 CURRENT_LOOKUP_0BASED
COP N[CURRENT_LOOKUP_0BASED,1] ...
 
You definitely cannot declare the indices of an array in Logix 5000. They all start at zero, and you have to remind yourself they end at "Length" -1 (because they started at zero).

I would re-write the "CURRENT_LOOKUP" logic to makes its values the actual "Recipe Number" instead of the SLC Data Table number.

I think the most straightforward way to store this recipe data is in a 2-dimensional array: Recipe_Data[32,20]

The first dimension is the number of Recipes (there are at least 32 according to that rung constants, and the second dimension is the elements for each recipe (there are clearly 20)

Recipe 000 will have the values stored in:

Recipe_Data[0,0]
Recipe_Data[0,1]
Recipe_Data[0,2]
Recipe_Data[0,3]
Recipe_Data[0,4]
Recipe_Data[0,5]
Recipe_Data[0,6]
Recipe_Data[0,7]
Recipe_Data[0,8]
Recipe_Data[0,9]
Recipe_Data[0,10]
Recipe_Data[0,11]
Recipe_Data[0,12]
Recipe_Data[0,13]
Recipe_Data[0,14]
Recipe_Data[0,15]
Recipe_Data[0,16]
Recipe_Data[0,17]
Recipe_Data[0,18]
Recipe_Data[0,19]

For each recipe, the first dimension number changes.

This is often one of the challenges when converting to ControlLogix, but it can also be rewarding to get rid of the old overly-complex logic that was used to work around the SLC's limited memory and addressing space.
 
I think I have solved it, I am no longer getting errors in my PLC, will just need to test functionality later.

Created UDT for the 6 DINTS that i need to copy.

Recipe_Targets.Product_Code
Recipe_Targets.Ing1_Target
Recipe_Targets.Ing2_Target
Recipe_Targets.Ing3_Target
Recipe_Targets.Ing4_Target
Recipe_Targets.Ing5_Target

I am then creating a tag Recipe[200] with the data type Recipe_Targets

COP Recipe[CURRENT_LOOKUP].Ing1_Target Length 5 to N92[1]
COP Recipe[CURRENT_LOOKUP].Product_Code Length 1 N92[6]

Attached image of how it appears in the routine, incase anyone is interested

Screenshot 2023-04-27 141920.png
 
An array tag with UDT-enumerated members is another excellent way to do this in the Logix platform. Nice !
 

Similar Topics

🙃 I have been scratching my head for a couple of days on this issue. I am in the process of converting a program from rs500 to Studio 5000...
Replies
7
Views
5,638
Hello I am trying to make a program work with a sqo instruction .The process has 5 steps ,and a starting step of zero.There should be 8 sec...
Replies
17
Views
1,057
I am working on upgrading a system with a ML1500 that uses a 1769-SDN DeviceNet Scanner to a CompactLocix L24ER-QB1B. Due to cost, I need to...
Replies
2
Views
1,403
I have been ask to check if we can have both English and Chinese in the same I/O description text window and rung comments. I could not Chinese to...
Replies
2
Views
1,213
Hi all, Here's an easy one. I've been asked to change a mitsubishi FX plc to a AB1400 using the same program. My customer has emailed me the...
Replies
5
Views
1,626
Back
Top Bottom