Sign in to follow this  
Followers 0
Guest Liquid

Indirect Addressing

8 posts in this topic

Hi, I read about this topic in the fourth page, but doesn't work for RSlogix5000. Any idea?, it will help in memory reduce.

Share this post


Link to post
Share on other sites
RSLogix5000 is used to program ControlLogix plcs. The ControlLogix architecture is tag-based as opposed to file-based. So in ControlLogix you don't have an address like N7:2/3 with discrete positions you can reference. Instead you have a tag that is assigned a random memory location. However, all is not lost. The ControlLogix processors support arrays, which are indexed collections of identical data types. The arrays can also be multi-dimensional. So if you have some idea of how items you need to reference and how many dimensions you will be dealing with you can create an array and index into it. For example, assume I have three machine sections and I need to keep a ten element fault log on each section. I can do this with a two-dimensional array. I will call my fault array FaultLog. I will use the data type INT for my array. When I define this tag I enter INT[3,10] in the Data Type field. This tells RSLogix I want a 3 X 10 integer array. You can then index into the array. However keep in mind that array indeces start with zero. This means the index values in my array can range from 0,0 to 2,9. When you index into an array in an instruction you use brackets. The indeces must data type INT, I believe. So if I want to see the most current fault on the first machine section, I would enter the address as 'FaultLog[0,0]. If I want the oldest fault on the first machine section the address is FaultLog[0,9]. The oldest fault on the third machine section is address 'FaultLog[2,9]'. Now comes the fun part. Indeces DO NOT need to be explicitly defined. So I can create two additional tags with data type INT; 'Section' and 'Fault'. I can now use my plc logic to modify 'Section' and 'Fault' and get at any fault code with the instruction address of 'FaultLog[section,Fault]. This is a two-dimensional example. You can have many more dimensions if needed, which actually makes this more powerful that the older indirect addressing. As a related note, data types INT and DINT are basically treated as arrays of bits. So If I have a tag 'Test' as data type INT, I can look at bit 3 (starting with zero) witht he address notation Test[3]. Or I can have another tag as data type INT called 'Bit'. I can look at any given bit using the notation Test[bit]. Now for the caution. The plc will get unhappy if you violate the array bounds with youre indeces. So it is good practice to limit check your indeces before using them. I hopew this helps. Keith

Share this post


Link to post
Share on other sites
Thanks a lot for your help!, But i have two more question, First, can I use "tagname[var1,var2].[var3]" ? va1, var2 and var3 SINT. Second. What's exactly the diference between using "controller tag" and "program tag"?

Share this post


Link to post
Share on other sites
This topic is kind of off the original subject but I'll talk about it here. 'controller' and 'program' refer to what is called tag scope. Scope refers to where a variable can be accessed from. A controller scope tag can be accessed and used in any of the logic in the plc, regardless of the program that logic is in. A program scope tag can only be used in the program in which it was created. Tag scope is not much of an issue unless: You have more than one 'program' in in you plc You are using an HMI that can only access controller scope tags. Now is a pretty good time to define 'program'. A ControlLogix processor has a multi-tiered logic file structure. The upper-most level is the controller. As far as I know you can ony have one of those in a given project. The next level down is the task. There are two types of task: continuous and periodic. The continuous task, as the name infers, runs continuously as fast as it can. A periodic task is like the SLC and PLC5 STI. You can only have one continuous task but you can have multiple periodic task running with different interrupt periods. The next level is the program level. You can have multiple programs. Here is where scope comes into play. Assume our multiple section machine again. Assume the three sections are identical from a control standpoint. There are limited logical differences between the sections. With ControlLogix you can write one program, copy it twice more and run each section off of it's own program. The nice thing is they would all have the same tagnames in the logic. However there is no tag conflict. If you make the tags program scope tags the tags are only seen in the program in which they were created. Now the downside. If you need to pass information between programs, you will need to either make those tags controller scope (so any program can see them) or you will need to make a controller scope tag and alias the program scope tags to the controller scope tag. Also, not all HMIs that can communicate to a ControlLogix processor can access program level tags. So unless you are absolutely sure the HMI can access program level tags, make all your HMI tags controller level and use them directly or alias into them. Keith

Share this post


Link to post
Share on other sites
ufffff, thanx man, was a truly complete answer.

Share this post


Link to post
Share on other sites
As I scanned through my last reply I noticed I forgot the lowest level of the logic file structure; the routine. Routines are where the actual code is written. There is a main routine in each program, from which you can call other routines that you create inside the same program. Routine calls can be nested. Sorry, I don't know the nesting level limit. All routines in a given program have access to the program level tags in that program. Keith

Share this post


Link to post
Share on other sites
To avoid confusion among those of us reading this many years later, this is incorrect. You can indirectly reference the bits of a DINT or INT using the notation Test.[bit] where Test is the DINT whose bits you want to look at and Bit is the array index. The original post forgot the dot; a small but crucial omission!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0