Indirect Addressing conversion SLC 5/05 to Studio

WrongWay

Member
Join Date
May 2011
Location
Sturgis,Mi
Posts
36
I would appreciate some help understanding some code from the RSLogix 500 days.
I'm trying to convert a Studio and I get a PCE for the following:
COP #N[N29:51]:0
DEST #N26:50
Length 72

I assume I need to make an array but I really do not understand what data I am copying from a to b. That is, what is a and b?

Thank you
 
The SLC is using file indirection. The range of values of N29:51 in the old logic needs to be determined. For example, if N29:51 could be any value from 11 to 20 and at one instant it is 11, then the COP instruction would copy 72 integers from N11:0 through N11:71 to the destinations from N26:50 through N26:121. If at another instant the value of the pointer N29:51 was 19, then the COP would be copying values from N19:0 through N19:71...
 
The SLC is using file indirection. The range of values of N29:51 in the old logic needs to be determined. For example, if N29:51 could be any value from 11 to 20 and at one instant it is 11, then the COP instruction would copy 72 integers from N11:0 through N11:71 to the destinations from N26:50 through N26:121. If at another instant the value of the pointer N29:51 was 19, then the COP would be copying values from N19:0 through N19:71...




And it would get very ugly if N29:51 were ever either 26 or 29.
 
I think I understand it now. 10 unique recipes are stored in N70 through N79. Each is 72 ints long.
I.E when N29:51 equals 71 it copies the data from N71 to N26:50.
 
I think I understand it now. 10 unique recipes are stored in N70 through N79. Each is 72 ints long.
I.E when N29:51 equals 71 it copies the data from N71 to N26:50.

Perfectly understood.

Just know that if N29:51 is less than 70 or greater than 79 there could be problems.

If it tries to read N14:0 and file 14 is timers, counters, binary, float or registers the PLC will fault on wrong file type. If it point to another integer file that is shorter, say only 50 integers long, then the PLC will fault out also.

At this time it is good to learn to have checks on the value of N29:51 and make sure it can not have an out of range value written to it, or default to a specific recipe if it is ever out of range.

Remember Bubba has his own PanelView in his locker he throws a simple program in to change any bit, number, timer or counter he wants to.
 
Isn't OP converting from RSLogix 500 to Studio 5000? It sounds like you used the logix conversion tool, based on the PCE (program conversion error). The tool is good for converting a program in a pinch, but as you discovered it doesn't handle indirect addressing well.

If you can, take the time to give your tags meaningful names. Right now it seems simple, but down the road you will find yourself regretting keeping the name I[1].0 (Local:1:I.Data.0 isn't any better imo). In the past, I have created a UDT for one recipe, and then created an array of the UDT for recipe selection (for the sake of this post I will call it uRecipe).

In the case of your indirect issue, you could have a tag called activeRecipe of type uRecipe, a tag array called recipeIndex of type uRecipe[10], and a DINT called newRecipe. It would look like this:

MOV
Source: recipeIndex[newRecipe]
Dest: activeRecipe

Make sure you have checks in place so nobody can try to enter a negative number or a number greater than 9 into newRecipe, and it should work the same as the SLC MOV instruction.
 
Thank you, I always make time to create meaningful tag names. I've fought through too many programs where the programmer felt that they were unnecessary. It's taken years off of my life.
 

Similar Topics

Hello, I'm very new to programming with absolutely zero schooling in this field and pretty hands off training in my new role, it's been fun...
Replies
4
Views
668
Hey everyone, Just used the PLC5/Logix migration utility to convert a program, and while addressing the PCEs, I noticed a lot of errors for "XIC...
Replies
12
Views
1,985
Can anyone explain to me what this would mean in a COP instruction? Source: #N[N187:4]:[N187:5] Dest: #N[N187:1]:0 Length: 20 I am doing a...
Replies
6
Views
2,210
🙃 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,633
Howdy folks, I am an Allen Bradley guy currently living in an Emerson world. Working with Rx3i on PacSystems Machine Edition v. 9.6? i think...
Replies
3
Views
621
Back
Top Bottom