Indiect Addressing

RSVIEWRULZ

Member
Join Date
May 2003
Location
Far Away
Posts
47
I have the hardest time understanding Indirect addressing and have gone far out of my wayt o avoid it all costs.

Well, being older more brave, I need to take the time to understand it as well as apply it to an everyday programming function...

I use primarily AB PLC 5 Class PLC's

Any info, guides or anything would be appriciated

Thx
 
Indirect Address

The address N10:12 is a reference to the 12th word (well, 13th, counting from zero) in file 10, which has been configured to be an integer file. When the PLC encounters it in an instruction, it goes to the data table, gets the value that's stored there, and does with it whatever the instruction requires.

An example of an indirect address is N10:[N7:0]. When the PLC encounters it in an instruction, it goes to the data table, gets the value that's stored in N7:0 (let's say N7:0 = 12). Then the PLC is able to interpret N10:[N7:0] to really be referencing N10:[12]. The PLC will then go to the data table, get the value of N10:12, and does with it whatever the instruction requires.

If you change the value of N7:0, you are now pointing to a different register in the N10: data file. Since you are no longer pointing to N10:12 (since N7:0 is no longer 12), the value in that register won't be changed.

Simple enough.

Some caveats.

1) If N7:0 = 200, and there is no N10:200, the PLC will fault.

2) If your indirect address is a coil (say, OTE B20/[N7:5]), if the value of the pointer changes, the coil will no longer be controlling the original register, but a different one. The usual warning "Caution: Outputs will remain in their last state".



There's also something called Indexed Addressing. That's where you put a '#' symbol in front of an integer address and manipulate the value in S:24. A 12 in S:24 makes the address #N10:0 cause the PLC to read register N10:12 when evaluting an instruction. Be careful, some instructions, such as COP, FAL manipulate S:24 as part of the internal bookkeeping, and so wipe out the number that you poked into it. (That's why you usually use a '#' sign with those instructions). Just be sure you know what you're pointing at.
 
Indirect addressing

Read up on indirect addressing in your PLC-5 manual, there is more to it than I will explain here.
The INDIRECT portion of the address is contained within brackets, [xxxx], this is called the pointer address.

Example:
Indirect address
N7:[N20:1]/02

N7= Type/File
[N20:1]= whatever value is stored in N20:1 data table.(the pointer)
02= Bit number

If N20:1 had the value of 10(ten) stored in its data table, the PLC would interpret N7:[N20:1]/02 as address N7:10/02. The number 10(ten) was derived by INDIRECTLY as you did not DIRECTLY enter the number 10(ten)into the address.

The same could go for the BIT address if you were to enter
N7:10/[N20:1].
If N20:1 had the value of 2(Two)stored in its data table, the PLC would interpret N7:10/[N20:1] as address N7:10/02. The number 2(Two) was derived by INDIRECTLY as you did not DIRECTLY enter the number 2(Two) into the address.

Timers, Counters and Control type files have special precautions, you can read about them in your PLC-5 manual.
Also an integer file used to indirect address Input or Output files will be converted to octal, again you can read about it in your PLC-5 manual.
Such things as indirect and indexed addressing can make it a little difficult for beginners to follow a program.

Roger
 
It can also be thought of this way:

N7:10 is an address of data,

N7:[N7:12] is an address of an address
 
Indirect addressing is the use of ONE register to manipulate MANY values.

Say you want to position a box at a certain distance.

The first box is going at position 1 which is 6 inches
The second box is going at position 2 which is 12 inches
And so on...

You first need to know which box you are positionning. Imagine that you count them.

Now you could have a rung for each box/position logic.

You could do a "Compare" function to stop the robot or conveyor when the box has reached the desired target... position.

BUT... what if you have 500 boxes to place in there position
What if those position are not only in an horizontal plan but also a vertical plan... 500 boxes = 1000 rungs + ...

There you need to use indirect addressing.

You use a register has you target value.

Say its register 000 (zero)

Whit a rung using indirect addressing, you need only to use the box count has the index and write those target values in there respective indexes...

Follow me.

In register 000 you have the real target
In register 001 you have the value for box No. 1 (6 for 6 inches)
In register 002 you have the value for box No. 2 (12 for 12 inches)
And so on...

So box No.1 will be placed at the value read in the register No.000 which in fact has the Indirect value of 000 + 001(the box count value).

So the value in this register 000 is 6 because your box count is 1 and the value in register 000+1 is the value in register 001.

Indirect addressing is used in many many places... in the PC you are using, when you load a program into RAMs... the code is using indirect addressing ... because it never loads in the same RAM memory addresses... so it's "jumps" and "GOTO" need to know where to jump or goto... indirect addressing is the only way.
 
Something not mentioned here that I have used before is indirect addressing a file number.

eg N[N7:0]:0

I have a stand that the different toolings are frequently swapped in and out of the base machine but they all run the same, the only difference is the timers. I set up some files N20, N21, N22, N23...

N20:0 is the Extend Dwell for tooling #1
N20:1 is the Extend Fault Delay for tooling #1

N21:0 is the Extend Dwell for tooling #2
N21:1 is the Extend Fault Delay for tooling #2

What I did was moved a value into N7:0 corresponding to the tooling # I am running at the time.

Then I move the timer presets into the appropriate registers and the machine will run the new tooling without me re-programming it.

Tooling #1 --> MOV 20 N7:0

Tooling #2 --> MOV 21 N7:0

--> MOV N[N7:0]:0 T4:0.PRE (extend dwell)
--> MOV N[N7:0]:1 T4:1.PRE (extend fault)


--------------------------------------------------------------------


You can indirect address to Files, Words and Bits using the same methods, though it would be very tricky to keep track of all three.

eg N[N7:0]:[N7:1]/[N7:2]
 

Similar Topics

I am very new to Modbus and the industry, so forgive me if I am missing something obvious. I have known Modbus register addresses coming from a...
Replies
7
Views
227
I have a system using Rx3I CRU320 redundant CPU with Proficy Machine Edition Software. In the hardware configuration of each CPU module, under...
Replies
14
Views
388
See the screenshot of EIP tag list. We are trying to read in a digital input that is hard-wired. It is shown here as I31.1. I believe we cannot...
Replies
7
Views
283
Hello all. I have a Simatic SM374 (374-sxh01-0aa0) sim module. I am using TIA portal v.18. I can't find this module in my list of hardware devices...
Replies
12
Views
755
Hello, I have a device with 68 words input. But one block on the Devicenet Scanner is only 61 words. I am trying to map this device to 2...
Replies
3
Views
531
Back
Top Bottom