indirect addressing

Phillip...

The difference between Indexed Addressing and Indirect Addressing is NOT the final location; the end-result is the same in either case. The difference is in the manner in which the final location is obtained.

As has been indicated, several times, Indexed Addressing, as practiced by AB, is "bound" to the range of the particular array, and can be "checked". I can't argue about that being a good thing... in some cases. However, because it is "bound" to that particular array, it is also a restriction. Gaining access to data outside of the "particular" array becomes more difficult; un-neccessarily so.

Can you pass an Array Identity as a variable? As in... Array_[X], where "X" is a variable, indicating any particular array?

Indexed Addressing, as practiced by other PLCs, is "unbounded". Their scheme consists of a Base-Address and an Offset. As scary as it sounds... that scheme allows access to ANY memory location in the memory-map. Yes... it requires discipline... as in, self-control, just like driving a beer-truck (or any other vehicle).

Indirect Addressing is also "unbounded". And yes, this too requires discipline. Indirect Addressing is NOT bound to any array in any case... short of that fundamental array which defines the entire memory structure.

As such, you can gain access to ANY table (any memory location) that your heart desires!

In human terms... being restricted in the AB manner puts you in a position where you might have to tell your boss... "Uuuuhhh, sorry boss, I can't get the answer... because I don't have access to those records."

If you are the programmer... then as far as the program is concerned... you are god (even if only a minor-god). As that program-god, you should have access to whatever you might want! However, even minor-gods, such as yourself, have to exercise discipline and self-control! At the same time, after fetching and manipulating the Indirect Address, you can impose your own "checking" to see that the Indirect Address is reasonable before you, in fact, use it!

Being the programmer is... Absolute Power!

Now, some might say that... "Absolute Power... Corrupts... Absolutely!"

But then... Aren't you really watch-dogging yourself, for your own sake?

This PLC stuff is one business where "performance" is everything! And that "performance" is a direct reflection of YOU!

Why in the world would anyone abuse that power in a manner that reflects badly on himself???
 
Can you pass an Array Identity as a variable? As in... Array_[X], where "X" is a variable, indicating any particular array?
In general whenever you are using indirection (whether achieved by indexing or indirect address pointing) the end-destination you are accessing will be of the same KIND of data. There is little point if, for example, the data retrieved is say the countdown of an alarm timer on a pressure switch on one access, and then the amps in a motor on the next. Indirection is almost always a case of accessing multiple instances of the same kind of data attribute, ie the current in say Motor#1, and then the current in Motor#n. Normally a tidy programmer will organise the all data instances of the same type into an arrays. Having done so, then indexing is perfectly usable.

Or if there are multiple attributes you are wanting to access, using the same Index, eg the Current in a motor, and the Speed of the same motor, then making Current and Speed members of a UDT, and then making an array of UDT tags then the CLX will let you access both with a single index, eg:

Motors[IndexA].Current
Motors[IndexA].Speed

Or you can incorporate UDT arrays within arrays of UDT elements. For example if you had a tank farm each with multiple pumpmotors, then I can write:

Tank[IndexA].Motors[IndexB].Current
Tank[IndexA].Motors[IndexB].Speed

Or alternately you can make arrays of arrays:

TagArray1[IndexA].Array2[IndexB].Array3[IndexC].Array4[IndexD]

I've just tried this out with an array nesting at least four Index's deep inside the same tag which has to offer enough power for most applications.Or a single variable itself can have up to 3 dimensions, eg:

DINT[IndexA,IndexB,IndexC].

(The main limitation here being that you are not allowed to use 2 or 3 dimensional elements within a UDT structure.) The point is that you have plenty of options when organising your data within the CLX in order to allow Indexing indirection for any realistic application I can think of.

Indexed Addressing, as practiced by other PLCs, is "unbounded". Their scheme consists of a Base-Address and an Offset. As scary as it sounds... that scheme allows access to ANY memory location in the memory-map. Yes... it requires discipline... as in, self-control, just like driving a beer-truck (or any other vehicle).

It seems to me that you may have missed the whole point of the CLX data structures. There is NO meaningful fixed base address within a CLX, or fixed memory tables that can be offset through. All CLX tags are simply string names. Each tag can have structure type (whether a predefined element like a DINT or REAL, a UDT structure, or arrays of these). If you allowed the Offset address to point to anything beyond the end of the tag array, then you have NO way to know what type of data you may be pointing to...it could be anything at all. Worse still an edit could quite readily insert or delete tags into this notional unbounded offset range, rendering the final destination every more meaningless. For this reason the CLX does not allow you to point outside the range of a single tag array. On the other hand that tag array itself can have as complex an internal structure as required to support all manner of data indirection requirements.

If you are the programmer... then as far as the program is concerned... you are god (even if only a minor-god). As that program-god, you should have access to whatever you might want! However, even minor-gods, such as yourself, have to exercise discipline and self-control!

The CLX allows multiple instances of RSLogix5000 to on-line edit the CPU at the same time. So all of a sudden you are not necessarily God anymore.

At the same time, after fetching and manipulating the Indirect Address, you can impose your own "checking" to see that the Indirect Address is reasonable before you, in fact, use it!

This is in fact one of the more challenging formal problems in computer science. And what if one of your fellow programmers determines to change the name of you destination tag via an on-line edit?? Instant CPU crash....no?
 
Last edited:
Terry Woods said:
And so, Gerry...

Do you not find that you are agreeing with me?
Did I say I wasn't??

Terry Woods said:
Gerry said...
"I guess you were just baiting us and not really seeking information."

I'm not on the question-side of this equation... I am, and always have been, on the answer-side.

It's not a brag... it is a simple, logical, fact.
I'll take that as confirmation.

Terry Woods said:
Oh... and by the way, Gerry... I've been here for several years. And in that time, I guess I might have asked three... maybe four, process-specific questions. (I think it's more like two or three... whatever, it ain't much.)

It's not a brag... it is a simple, logical, fact.

Get over it.
I've been here for several years as well, and I guess I might have asked even fewer questions than you - SO WHAT!

What exactly do I need to "get over"?
 

Similar Topics

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
620
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
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,380
Hi All, which the best way to do the indirect addressing in an optimize DB? Ccurrently this is my partial code inside an FB...
Replies
7
Views
2,273
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,975
Back
Top Bottom