PDA

View Full Version : AB indirect adressing


Andy
May 10th, 2002, 05:27 PM
Can anyone help me. Ive just started a new job and in the factory where i am working the plc standard is A.B now ive done some work with omrom which helps me a little but on the A.B plc 5 a system can be used called indirect adressing, can anyone explain to me what this system is and how it works becouse the explanations i have found are very vague.

rsdoran
May 10th, 2002, 07:37 PM
http://www.plctalk.net/qanda/showthread.php?s=&threadid=83

That thread may help some.

ganutenator
May 11th, 2002, 07:46 PM
This is an example where I used Indirect addressing. I needed 20 'Not Equal to statements'. Instead of coding B131:0 NEQ B132:0, B131:1 NEQ B132:1, B131:2 NEQ B132:2 .........B131:19 NEQ B132:19.

I put this in a For/Nxt Loop. [N137:0] is a variable that equals 0-19.



---NEQ----------------- New Alarm Found Pulse
|Not Equal |-------------------(L)
|Source A B131:[N137:0]|
|Source B B132:[N137:0]|
-----------------------

Note to PLC guru wanna be's: I am sure that many people will critique this, or make statements like "Oh, my god!, how could you ever write such a confusing piece of code or even think of using indirect addressing". Please let me remind you that I took this out of context to try and explain indirect addressing. And yes, N137:0 was the Index of a For/Nxt loop. And oh, my god, how could I ever use a latching instruction and call it a pulse.

February 6th, 2003, 10:07 PM
An example of the use of indirect addressing is in the creation of recipes. Lets say that you have ten components within your recipe, if you wanted to store ten recipes it would mean that you would have to have 100 entry areas in your touch screen (or area where you enter a recipe). Alternatively, you could use some code that would compare the recipe number and move the data entered to a fixed location in the PLC. Of course this would be wasteful in code and clumbsy.

By using indirect addressing you can create a short piece of code using the recipe number to create a pointer to another address (an indirect address) where the value entered could be stored. To do this you need to have a means to manipulate the addressing (rather than the data) and this is indirect addressing.

For example. Let us say that I want to store ten recipes each with ten ingredients at a location in my PLC (say the starting address for the 100 entries is address 6000).

Recipe#1 would reside in locations 6000 to 6009, recipe#2 would reside in locations 6010 to 6019....and so on.

Now in the touch screen I have only 1 set of ten locations where I enter a recipe but I need to move the data I enter into a location that relates specifically to the recipe number. So in this case I would create some code that would calculate the address where my entered data is to reside. e.g.

If I am entering information for recipe #1 the math would be: -

(RECIPE #)*(no of ingredients in recipe)+(the starting location where my recipe data would reside) - (no of ingredients in recipe). So for our example (recipe#1) this would be: -

((1 * 10)- 10)+6000 = 6000

for recipe #2: -

((2 *10)- 10)+6000 = 6010

For recipe#100: -

((100 *10)- 10)+6000 = 6090

The values 6000, 6010 and 6090 are pointers to the indirect address to which you would like to move the data.

To perform a save after entering the ten ingredients you would simpy move a block of data starting at the address where you are entering the data (e.g. address 20) to the address being pointed at by the calculation you performed.

Hope this helps, Dave

Allen Nelson
February 7th, 2003, 08:46 AM
Indirect addressing in the AB world is pretty straightforward.

First off, regular addressing.

The address N10:5 is a reference to the fifth word in data file 10 (and data file 10 is formatted as an interger).

If the value of N7:0 = 6, then the address N10:[N7:0] is a refernce to the sixth word in N10.

If you change the value of N7:0, you change the location that N10:[N7:0] is referring to. This may or may not change the value of N10:[N7:0], depending on the data stored there.

You don't have to index on the word level. You can also index on the bit level B13/[N7:0], or even N10:5/[N7:0], and even at the data file level N[N7:0]:5.

You can also have multiple indirects: N[N7:0]:[N7:1]/[N7:3]

If you know BASIC (or other programming languages), think of it as an array.
(DIM X(100). For i=1 to 100; x(i) = i; Next i)

Some cautions:

Make sure that the register that the indirect address points to actually exists. For example, if N7:0 = 100 and you have N[N7:0]:3 or F20:[N7:0], then N100:3 or F20:100 must be valid addresses. If they are not, the PLC will fault.

There's a bit more (as well as a discussion of the difference between indirect an indexed addressing AT THIS LINK (http://www.plcs.net/dcforum/DCForumID1/2634.html)