Help - Search - Members - Calendar
Full Version: index addressing
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
kcor
confused.
is the attached file, the move instructions, is it taking the contents of N16 and adding the contents of N7:7 and placing the result in N7:8,
or
is it taking the contents of N16 and multiplying it by the contents of N7:7

do not quite fully understand everything I would like to know about indirect or indexed addressing with a ab plc, could someone explain it. Thanks
Ken Moore
On ladder 16 you are moving the value in N16:[N7:7] to N7:8, if the value of N7:7 was 99, then the effect would be to MOV N16:99 to N7:8. Then MOV N17:[N7:7] to N7:9, again if N7:7 was 99, then the effect would be to MOV N17:99 to N7:9.

I often use indirect addressing for analog alarms, write one alarm subroutine move the values to the correct registers, run the routine, index the register, and then check the next analog value.

Indirect addressing can save a lot of programming steps, when the exact same logic needs to be used on multiple registers. It also comes in handy for adding and averaging.
Here's one example: http://forums.mrplc.com/index.php?autocom=downloads&showfile=339

There should be an instruction somewhere in you program that indexes the value of N7:7, many times it will be an ADD instruction. When all the current logic is done, index the value of N7:7(ADD 1 to N7:7 and store in N7:7) and do again on the next indirect address. There should also be logic to "reset" the value in N7:7 to the starting value, which is usually 0 or 1, but can be any number.

People often explain indirect addressing like addresses, N16 is the street, and N7:7 contains the house number. So if you wanted to delivery papers to all the houses on N16 street, you would start with the first house, the house number contained in N7:7, then you call the home office and tell them N7:7 on N16 street is done, they increase the value in N7:7 by 1 and send you to the new address on N16 street.

Hope this helps, it may only confuse.

ken
kcor
QUOTE(Ken Moore @ Nov 1 2007, 02:55 PM) [snapback]61117[/snapback]
On ladder 16 you are moving the value in N16:[N7:7] to N7:8, if the value of N7:7 was 99, then the effect would be to MOV N16:99 to N7:8. Then MOV N17:[N7:7] to N7:9, again if N7:7 was 99, then the effect would be to MOV N17:99 to N7:9.

I often use indirect addressing for analog alarms, write one alarm subroutine move the values to the correct registers, run the routine, index the register, and then check the next analog value.

Indirect addressing can save a lot of programming steps, when the exact same logic needs to be used on multiple registers. It also comes in handy for adding and averaging.
Here's one example: http://forums.mrplc.com/index.php?autocom=downloads&showfile=339

There should be an instruction somewhere in you program that indexes the value of N7:7, many times it will be an ADD instruction. When all the current logic is done, index the value of N7:7(ADD 1 to N7:7 and store in N7:7) and do again on the next indirect address. There should also be logic to "reset" the value in N7:7 to the starting value, which is usually 0 or 1, but can be any number.

People often explain indirect addressing like addresses, N16 is the street, and N7:7 contains the house number. So if you wanted to delivery papers to all the houses on N16 street, you would start with the first house, the house number contained in N7:7, then you call the home office and tell them N7:7 on N16 street is done, they increase the value in N7:7 by 1 and send you to the new address on N16 street.

Hope this helps, it may only confuse.

ken




Thanks
can you do indirect addressing with the micrologix 1200?
attached is a sample code i downloaded, and if i b3:0.4 true, the plc will fault, and here is the fault
An indirect address reference in the ladder program is outside of the entire data file space.
what am i overlooking.
having one of those days.
thanks for reply
Ken Moore

The indirectly addressed element must exist in the data table, in your sample N7:7 has a value of 1,

But N16:1 does not exist in the data table, your N16 data table only contains one element N16:0
Same is true for N17 as well.

So if N7:7 has a value of 128, then N16:128 must exist in the data table.

Just right click on the N16 file, select properties, then change the number of elements to something slightly higher than you need. With a ML1200, 256 will be the maximum.
kcor
QUOTE(Ken Moore @ Nov 1 2007, 03:54 PM) [snapback]61121[/snapback]

The indirectly addressed element must exist in the data table, in your sample N7:7 has a value of 1,

But N16:1 does not exist in the data table, your N16 data table only contains one element N16:0
Same is true for N17 as well.

So if N7:7 has a value of 128, then N16:128 must exist in the data table.

Just right click on the N16 file, select properties, then change the number of elements to something slightly higher than you need. With a ML1200, 256 will be the maximum.



Dumb, Dumb, have you ever just felt dumb?
Been doing a project for the last few weeks with the omron cj1g plc, and just went brain dead.
Thanks for pointing it out.
I found no matter how stupid of something you might be doing, there is always someone on this site that will help steer you back in the right direction.
Downloaded your example on indirect addressing, great reference piece.
Thanks oops.gif withstupid.gif
Ken Moore
Glad you got it figured out, come back any time. You know what they say, "no such thing as a dumb question"


Good Luck,

Ken
paulengr
QUOTE(kcor @ Nov 1 2007, 02:36 PM) [snapback]61114[/snapback]
confused.
is the attached file, the move instructions, is it taking the contents of N16 and adding the contents of N7:7 and placing the result in N7:8,
or
is it taking the contents of N16 and multiplying it by the contents of N7:7

do not quite fully understand everything I would like to know about indirect or indexed addressing with a ab plc, could someone explain it. Thanks


One helpful warning: If you have a bug with indirect addressing, there are two possible outcomes. First, it can destroy other nearby data if you don't put the indirectly addressed table into an isolated data file. Second, if you ever end up with an illegal index (outside of the limits of the data table), the processor faults.

With that in mind, I make it a practice and highly recommend that you use a LIM (limit) check in front of every indirect addressing command.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.