Indirect Addressing Error After Converting from PLC-5 to ControlLogix

kevc2181

Member
Join Date
Feb 2013
Location
Louisiana
Posts
3
Hello :) I've already come up with a solution to the problem described below, so this is mainly a curiosity had the situation been different. I'm wondering if there is a clean way to solve this should many different values exist and not just a few as in my situation:

Background:
I was faced with an issue where the PLC-5 code for a PLC5/11 used indirect addressing in a copy instruction with "#N[N251:0]:1" as the source and a length of 50. Using the translate tool to convert the PLC-5 code to ControlLogix, I ended up with "N[N251_0][1]" which returns an error. Since there were only 3 possible values for N251_0 (101, 102, or 103) allowed by the code, I set up 3 EQU instructions (each on their own branch) to copy the value of the appropriate N101[1], N102[1], or N103[1] length of 50. This was a quick fix because there were only 3 possible values.

My question is: What if there were many values for N251_0? Is there a way to make the indirect addressing work as it did in the PLC5 code without having to make major modifications the code that was converted from PLC-5 to CLX?

I've attached screenshots of the before and after conversion, and of the solution I used.

Thank you for any input!:)

PLC-5 Code.JPG Converted PLC-5 to CLX.JPG CLX Solution.JPG
 
In your pictures it shows that N251_0 is an alias to N251[0]

Thus using N251_0 as an indirect yields essentially N[N251[0]] which has double indirect (two sets of brackets) which isn't allowed.

Another way would have been a MOV of N251_0 into a DINT which is not part of an array (let's say TEMP_DINT). Then use N[TEMP_DINT][1]
 
Welcome to the forum! I believe the issue is that N[N251_0] is actually referring to an element in an array tag named "N" in a logix based processor, whereas the PLC5 referred to numeric data table files. You might be able to do something similar in Logix if you used a two-dimensional array tag (ex. N[102,1]) but I don't think this would be worthwhile as it may use up a bunch of unnecessary overhead.

I tried looking up a similar situation in one of my conversions on hand and came up empty. Looks like you did the best thing. Others may have a different conclusion based on their experience.
 
For your particular application, I think your solution is ok.

I think a more general solution would need some rewriting. In the attached image:

a) my_array is declared as DINT[4,50]
b) destination is declared as DINT[50]
c) N250_1 is DINT

You'll need to copy N101 to the first dimension, N102 to the second one, and so on. Obviously, N250_1 only can be 0 through 3.

COP.png
 
In your pictures it shows that N251_0 is an alias to N251[0]

Thus using N251_0 as an indirect yields essentially N[N251[0]] which has double indirect (two sets of brackets) which isn't allowed.

Another way would have been a MOV of N251_0 into a DINT which is not part of an array (let's say TEMP_DINT). Then use N[TEMP_DINT][1]

Thank you for the input! I tried that with a DINT tag as you suggested, but it still returns an invalid expression.
 
Welcome to the forum! I believe the issue is that N[N251_0] is actually referring to an element in an array tag named "N" in a logix based processor, whereas the PLC5 referred to numeric data table files. You might be able to do something similar in Logix if you used a two-dimensional array tag (ex. N[102,1]) but I don't think this would be worthwhile as it may use up a bunch of unnecessary overhead.

I tried looking up a similar situation in one of my conversions on hand and came up empty. Looks like you did the best thing. Others may have a different conclusion based on their experience.

For your particular application, I think your solution is ok.

I think a more general solution would need some rewriting. In the attached image:

a) my_array is declared as DINT[4,50]
b) destination is declared as DINT[50]
c) N250_1 is DINT

You'll need to copy N101 to the first dimension, N102 to the second one, and so on. Obviously, N250_1 only can be 0 through 3.

Thank you both! I believe you two have the solution should a large amount of possibilities exist :geek:
 
Welcome to the forum! I believe the issue is that N[N251_0] is actually referring to an element in an array tag named "N" in a logix based processor, whereas the PLC5 referred to numeric data table files. You might be able to do something similar in Logix if you used a two-dimensional array tag (ex. N[102,1]) but I don't think this would be worthwhile as it may use up a bunch of unnecessary overhead.

I tried looking up a similar situation in one of my conversions on hand and came up empty. Looks like you did the best thing. Others may have a different conclusion based on their experience.

Just had the same issue. There is no way in Logix to substitute an array tag (ie N100, N101 etc) with a variable.

I ended up having to have a separate rung for each array.
Using your files: EQU N251_0 = 100 COP X N100[0] etc.

There is a tech note that says if you really want to do that use a 2 dimensional array...no thanks.
 

Similar Topics

I'm trying to set up a 1746-HSCE2 high speed counter module in a SLC500 with a SLC 5/03 processor. The manual -...
Replies
2
Views
3,008
I'm have been tasked with re-engineering the Error logic footprint of our machine Ladder program. I have the following issues to consider: 1.)...
Replies
10
Views
8,043
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
613
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
664
Hello Friends, I am trying to index M Bits, however GX Works2 is not allowing it with following message. https://ibb.co/zPcqj6M...
Replies
3
Views
1,372
Back
Top Bottom