Logix5000 Indirect addressing

hooter32

Member
Join Date
Feb 2011
Location
louisiana
Posts
37
Does anybody know of a manual or website that breaks down Indirect addressing. I have seen it used and find it hard to follow without any knowledge of it. Thanks for any info.
 
Logix 5000 uses arrays AND indirect addressing. Indirect addressing is simply using a variable to define an address. If you look at:

"thisaddress.[thataddress]" you are using the variable "thataddress" to point to a specific address or variable name. "thataddress" can be used anywhere in the program. "thisaddress.[___]" is really a one-dimensional array, and can have a length in values or in logix 5000 a series of named addresses can be used. That's indirect addressing. The same principle applies in PLC-5 and 500 using numbers only.

Logix 5000 arrays use indirect addressing, and are usually addressed like "thisaddress.[thataddress,thatotheraddress]". When you are setting up the "thisaddress" you might have to set up the number of variables in the array (not so sure if AB allows this dynamically or not).
 
Does anybody know of a manual or website that breaks down Indirect addressing. I have seen it used and find it hard to follow without any knowledge of it. Thanks for any info.

I will break it down for you - in simple terms, hopefully this will help you get to grips with Indirect Addressing.

Best to use an example, it always helps.

Suppose I need to know in my code whether a month has 28, 30, or 31 days (let's ignore leap-years to keep it simple). I might be using it for production rates per day (just an example !).

I could set up an array Days[12] (a tag called Days that is an array of 12 elements, numbered ("indexed") as elements 0-11).

I could store the values for the number of days in each element of the array, where each element corresponds to a month of the year...

Days[0] = 31 ..January
Days[1] = 28 ..February
Days[2] = 31 ..March
Days[3] = 30 ..April
.....and so on to.....
Days[11] = 31 ..December

Before looking at Indirect Addressing, let's flip the coin and look at Direct Addressing. Suppose I want to know how many days are in month 7 (July). I could fetch the data from the array by addressing Days[6]. I would have to have 12 unique "reads" of the array to fetch all 12 months data. "If Month=4 get Days[3]" etc.

Indirect addressing is a method of using an "indirect" value to specify which location of the data array you want to address. In this case we might have a tag that contains the month we are interested in, let's call it Month. So we could subtract 1 from month, and store the result in another tag called ArrayPointer. Then we could get the data for any month, 1-12, by addressing into the array using the ArrayPointer tag : Days[ArrayPointer].

Logix5000 simply sees a tagname in the square brackets, and evaluates it, which for this simple arrangement just means fetching the value of the tag called ArrayPointer, and using that value as the element number of the Days array.

But this all looks a bit clumsy, month 1 needs to address the array at element 0, etc., so we can do a couple of things to make it easier.

Firstly, we could have created our array 13 elements long (indexes 0-12), and simply ignored element 0, so month 1 data is stored in Days[1], month 9 in Days[9], etc. Our Indirect Addressing example now doesn't need to subtract 1, so we can address each month's data more easily as Days[Month]. Logix sees the tagname Month in the brackets, fetches the value of Month, and uses the value as the array element number to read or write.

Alternatively, we could have kept the original 12-element array, and performed the subtraction of 1 at the same time as the Indirection. This is where Logix is good, because it allows us to put expressions in our indirects. So we could get the number of days for Month by using the address Days[Month-1]
. And so it goes on...

The expressions can be as complex as you like, the only critical thing is that it has to evaluate to a legal array element number : 0 to (arraylength-1). The only other thing to remember is we can't use "double-indirect" addressing, Days[Period[6]] is not allowed.

So, whenever you see Indirect Addressing used in a program, it is nearly always a means to save program code, all you have to do is perform the same maths as the processor will do to the index expression inside the square brackets.

A long post to explain what is, actually, a very simple concept. Any questions, just ask.

P.S. I do hope you didn't mean Indexed addressing and Logix5 or Logix500 .....
 
Thanks for the replies. I have read all of the links and examples at least 4 times. It's not quite as fuzzy as before. I'll now look at some more examples and try to follow along with what you have showed me. I'm probably overcomplicating this but without any formal training, it's hard to know everything.
 
Last edited:
let's see how simple we can make this ...

take a look at the figure below ... it shows an array of 10 tags named My_Tag[0] through My_Tag[9] ... that's just plain old everyday addressing ... no problems so far? ...

now then ...

suppose that I asked you for the value of My_Tag[2] ... the correct answer is 43 ... no problems so far? ...

suppose that I asked you for the value of My_Tag[5] ... the correct answer is 62 ... no problems so far? ...

and so on ... if you're not having any problems so far, then we're getting somewhere ...

now then ...

suppose that I asked you for the value of My_Tag[My_Pointer] ... the correct answer is 88 ...

and of course, My_Tag[My_Pointer] is an example of Indirect Addressing ...

so how (you might ask) did we get 88 for the value of My_Tag[My_Pointer] ? ...

secret handshake: WHATEVER is inside the [square brackets] has to be a number ...

but, (and this is what confuses many students) sometimes what's inside the [square brackets] isn't just a simple, plain-old, easy-to-understand, vanilla number ... well, in that case, what's inside the [square brackets] has to either:

convert to a number ... or ...
calculate to a number ... or ...
be turned into a number ... or ...
be regarded as a number ... or otherwise ...
"boil down to" a number ...

that's the trick ... WHATEVER is inside the [square brackets] has to be a number ... (like I said, it's a rule) ...

so ...

if the words My_Pointer are located inside the [square brackets] then we need to "boil down" or "decode" the words My_Pointer to a number ... (that's the rule) ...

the only way to "boil down" the words My_Pointer to a number is to look inside the box/location named My_Pointer and see what NUMBER we find stored there ...

since the value stored inside My_Pointer happens to be 7 in the example shown below, then the indirect address of the location My_Tag[My_Pointer] must actually be "decoded" as the address My_Tag[7] ...

and ... the value stored at My_Tag[7] happens to be 88 ... bingo! ...

so in other words, the indirect address My_Tag[My_Pointer] is just another way (an INDIRECT way) of specifying the address My_Tag[7] ...

I hope that this helps ...

.

indirect_addresses.PNG
 
Last edited:
What's formal training? :D

Any instructor, training class, or mentor. I've learned what i have from books and from the expertise of you fellows in the forums (which I owe a lot). I actually took Mr. Daba's example and plugged it into RsLogix5000 emulate and tested it. I'm starting to see the light.
 
Last edited:
I haven't had formal training since the factory classes for PLC-3. Twenty years ago! Since, I've worked on the SLC's, PLC-5, Flexlogix, and RSL 5000 series, AND been thrown under the bus with Symax, Automation Direct, GE, and all the assorted HMI systems that have come, lived, and died in the last 20 years or so. How? Sheer determination, willing to learn even more, and keeping a dadburned copy of every manual on my PC where I can find it.

Formal training, while it can help a lot, does not, and will not, teach you how to be a "PLC guru". Most of that is on you. I've worked with engineers who can't spell, technicians that flounder when it comes to reading voltage, and have shut down entire facilities because their college level education didn't teach them how NOT to do something. There's a lot that comes with experience only.

My current second round of employment (after being laid off a 20 year job) is offshore, where I would have NEVER originally chosen to go. I'm going on 8 years now. My first boss for offshore, when I asked him who I called when I needed help, said "you are your own tech support." And it's true, not only here, but everywhere else, where there are some things that experience and dumb luck are the best teachers. They used to call me Mr. ESD for a reason. (But I knew the fix for the problem I was tracing!)

Some of my AB teachers were not on par with Ron Beaufort, and had never seen a PLC. They could teach "the book", but hypothetical or real life situations? Nah. Go look at some of the "hi, help me with my project" threads, and see that this is still the case.

Good luck! Don't shut anything down too much, and PLEASE don't blow yourself up.
 
Yes it was. Thanks a bunch everyone. I have spent numerous hour beating my head in trying to troubleshoot code using indirect addressing with little to no luck. These examples have greatly helped a lot. Having good resources like this forum make my job easier. I spend a lot of time reading manuals and forums so I can step up my PLC knowledge a notch and try to be the PLC "guru". Thanks again for your time.
 

Similar Topics

Hi all I need to read the values of many variables from a stl cycle. For example, suppose I have 3 variables: tag1,tag2,tag3. Is it possible to...
Replies
1
Views
1,310
I know you can do indirect addressing using 5000, but is it possible to do partial indirect addressing? Meaning... I pass any number, say, 1000...
Replies
11
Views
4,067
Good day all. I think I've got it but please put me right if not. (More than likely). If I set up an integer (call it "array") with a non-zero...
Replies
15
Views
6,495
I'm trying to copy the controllers datetime to a DINT[7] element of a UDT. Nothing happens. If I change the tag to the following it works...
Replies
4
Views
3,135
Hi! So my problem is a little funky, I had Studio 5000 v 24 and 30 installed, but forgot to install RSLogix (which I cannot go without). Is there...
Replies
2
Views
112
Back
Top Bottom