Ab Rs Logix Indirect Addressing

PERSPOLIS

Member
Join Date
Jun 2002
Location
ontario
Posts
295
HI EXPERT

CAN ANYBODY EXPLAIN WHAT IS INDIRECT ADDRESSING ,WHEN DO WE USE IT AND WHAT IS THE PURPOSE OR ANY DOCUMENTATION THAT CAN HELP ME TO GRASP THIS TOPIC OF PLC

MERRY CHRITMAS AND HAPPY NEW YEAR EXPERTS
 
Besides the official AB tech notes which rsdoran suggested, you might find this helpful.

Basic idea: you can use indirect addressing to “re-aim” an operation. Suppose you want to use a MOV (move) instruction to place a source value (example: 123) into a destination (example: N7:4). That’s pretty simple. But suppose that a little later on you want to MOV the same source to another destination (example: N7:8). Without indirect addressing, you’d probably decide to just use another MOV command. That would work fine - but suppose that you know that eventually you’re going to have to change the destination again - and again - and again. There’s another (better?) way than using a different MOV for each separate destination. Suppose that you use only one MOV but that you enter the destination as N7:[N7:99] - and then each time BEFORE you execute the MOV, you have your program store the proper value into N7:99 - in order to re-aim the MOV at the desired destination. For example: if N7:99 contains the value 4, then the destination of the MOV will be N7:4. Change the value in N7:99 to 8 and the destination will become N7:8 instead. Some people find it helpful to think of the value inside the square brackets as a “pointer” into your data table.

For a fairly extreme example, check this out. Suppose that you enter the destination as N[N7:75]:[N7:99]/[N7:44] - and that the following locations are filled with the following values:

N7:44 = 5
N7:75 = 7
N7:99 = 3

Now when the processor executes the MOV, it will interpret the destination as: N7:3/5 - which shows that you can aim not only the WORD number - but also the FILE number - and also the BIT number. And of course you could use this same technique to re-aim the source of an operation as well as the destination. Very powerful stuff.

Tip: If you’re using RSLogix5 or RSLogix500, try this. From the menu at the top, select View - and then Properties - and then click the Address Display tab. Find the box for “Display Value for Indirect Address” - and then watch the way an example of an indirect address gets displayed on your screen when this box is checked or unchecked. This is a pretty simple way of visualizing just how the processor will interpret (or decode) your indirect addresses.

Note on politics: Some people don’t like indirect addressing because a “Find All” search won’t reveal all of the addresses which are specified this way. Plus the “Usage” button on the data table windows won’t show that the address is being used in your program. Still - if you need this type of power-user capability, then indirect addressing is often the elegant solution to a very ugly programming task.

Final note: Guess what happens if you enter too large (or too small) a number in your indirect address “pointer” location - and thus try to aim the operation at a location which doesn’t actually exist? If you answered “FAULT” then you got it right.
 
To add to Ron's wonderful explaination. The last time I used indirect addressing was to track pallets.

And I never had any problems using it. So look as you make a could map of what you are doing. I always use a spreadsheet when doing any large programming so I know what everything is and where it's going. You'll see in the example program below.

I defined a B9 file in my plc. Then I created a list of bits and what they mean. The word files in my program are the pallet ID numbers. So each word has up to 16 bits of status per pallet.

You download the source PLC code here and everything else that came with this program. PDF's are included.

http://www.mrplc.com/cgi-bin/code/filedisplay.cgi?category=machab

Indirect Addressing - Pallet Tracking "Brick Yard 500" 1.1

So basically everytime a pallet came into a reading station, I read the pallet id, and transferred that information like so:

Say pallet number 5 entered the station. I read the pallet ID, then using indirect addressing, I did a "lookup" of the status of the pallet.

B9:[pallet_id]/0

So in this case, my address would be: B9:5/0.

And bit 0 in my program means, "Base Present".

So using the same ladder code, the next pallet into the station could be 32. So I can lookup the status of pallet 32 like:

B9:[pallet_id]/15

So in this case, ny new address would be: B9:32/15

And bit 15 in my program means, "Good Part".

Hopefully I explained that ok.
 
The descriptions of indirect addressing posted so far are better than I could give so I will let them alone. I have used indirect addressing a reasonable amount and I personally like what it brings to the table.
Most of the cases I have used it in are similar to the examples given so far. The last examlpe was selecting two values from an indexed table and interpolating between them (machine limit speed calculation). It can take a little to get your mind around this. But once you do it is really powerful stuff. As Ron's example shows, you can use multiple indirections in one instruction, which is pretty wild and incredibly powerful.
However, there is a dark side. I have also used indirect addressing in subroutine calls in a SLC5/05. In this example I had three identical machine sections. I wrote one program file and called it three times, once per program scan. I incremented a variable to indicate what data file was to be used in the given subroutine call. So in scan n I used the data files for machine section 1, in scan n+1 I used the data for section 2 and in scan n+2 I used the section 3 data.
This was great for development as a single change to the control logic corrected errors in three sections at one time. However, our customer doesn't like this at all since it is difficult to troubleshoot relative to a more typical approach. The customer can't just look at the program file logic online and see the state of the bits and variables. The data change once per scan so it's impossible to follow on the screen. You need to open a data window to the appropriate dtaa file to see the logic status.
This is mostly my fault for writing a program above the technical capability of its ultimate audience. I got caught in the trap of using something because its cool, without thinking of the ramifications.
The moral of this story, as with all technology stories, is use the advanced stuff with care. It may save you 50 hours in development just to cost you 200 hours in support.

Keith
 

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
663
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,949
Hi there I'm currently converting an RSLogix500 program that I wrote 20 years ago into RSLogix5000 for an SLC to CompactLogix upgrade. The...
Replies
3
Views
2,188
I’m working with indirect addressing and trying to make an HMI where each Rectangle Object has a tag of “A[0-127]” with a correlating Push Button...
Replies
15
Views
4,195
I am confused. I am using indirect addressing to copy from one point to another based on an integer file but I got one Copy instruction that...
Replies
4
Views
2,181
Back
Top Bottom