Help - Search - Members - Calendar
Full Version: Index Addressing
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
Kah Chun
Hi everyone,

I'm wondering if anyone here is willing to provide me an example usage of 'index addressing'. I have a SLC5/04 OS400 and it doesn't support indirect addressing. This leave me with no other option but to use index addressing instead.

My current programme requires me to do a count and to store a minimum 5 previous counts. These 5 counts + the latest count will be displayed on the PanelView. FIFO will work but the control register has been used somewhere in the programme and I don't want to change it. Indirect addressing as I said, does not work with my SLC.

I haven't used index addressing before but I understand that it's a tricky little thing cause many other instructions are using it too. I figure out that as long as I'm using 2 variable registers (one to keep the original S:24 value and another to keep my programme count) and moving+interchanging them at the beginning and at the end of my programme, I'll be able to keep track with the exact S:24 value that I require without affecting other instructions that might use the index register.

My question is what is the best way to create the stack for the count using index addressing? I would appreciate if someone is willing to share a sample programme or tips and discuss it with me.

smile.gif
Sleepy Wombat
QUOTE
My current programme requires me to do a count and to store a minimum 5 previous counts. These 5 counts + the latest count will be displayed on the PanelView.

So why can't you use just a number of MOV or File Copy instructs?



Kah Chun
QUOTE(Sleepy Wombat @ May 30 2006, 01:42 PM) [snapback]34766[/snapback]

So why can't you use just a number of MOV or File Copy instructs?


I certainly can, Sleepy Wombat. But that means I need to create a number of rungs to do that. In my case, I only need to have 5 counts but it is likely that I'll have to store more than 5 in the future. Index addressing will give me the option to easily expand the stack whenever I need it.
Doug-P
QUOTE(Kah Chun @ May 29 2006, 11:50 PM) [snapback]34767[/snapback]

I certainly can, Sleepy Wombat. But that means I need to create a number of rungs to do that. In my case, I only need to have 5 counts but it is likely that I'll have to store more than 5 in the future. Index addressing will give me the option to easily expand the stack whenever I need it.
Correctly using Sleepy Wombat's suggestion, you need only three rungs and two files no matter the number of counts involved (up to the length of a /04 file).
Ken Moore
One rung, two files, three instructions, can handle up to 256 words.

Ron Beaufort
Greetings Kah Chun,

I'll go along with my colleagues and suggest that there are probably better ways to accomplish your task ... but you've asked a perfectly valid question ... and you should be able to find the answer in this post and in the next two posts which follow it ...

QUOTE
I figure out that as long as I'm using 2 variable registers ... and moving+interchanging them at the beginning and at the end of my programme, I'll be able to keep track with the exact S:24 value that I require...


you're certainly on the right track ... BUT ... you'll probably need to do the "moving and interchanging" step JUST BEFORE you make use of the S:24 value ... and NOT just at the beginning and end of the program ... this is covered in the posts that I linked above ... but if you still have questions after reading that information, please post again and we'll try to nail everything down for you ...

hope this helps ... and welcome to the forum ...
Kah Chun
Thanks to everyone who replied. I guess I've forgotten to mention that I'm programming my SLC in remote run and I'm not supposed to stop it in order to create a new file.
panic mode
QUOTE(Kah Chun @ May 30 2006, 06:18 PM) [snapback]34808[/snapback]
Thanks to everyone who replied. I guess I've forgotten to mention that I'm programming my SLC in remote run and I'm not supposed to stop it in order to create a new file.


Then just use few registers you already have. I would do same as Ken suggested. Did you look closer to see what this rung really does? Btw. COP instruction doesn't handle blocks larger than 128 words but this is minor.

EDIT...

you will also need to make sure this is done only once (on one shot) or you will have all five registers with same value in only 4 scans...

XIC B3:0/0 OSR B3:0/1 BST COP #N7:0 #N7:5 4 NXB COP #N7:5 #N7:1 4 NXB MOV N7:30 N7:0 BND

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.