Followers 0

# Equivalent of indirect addressing in CL?

## 23 posts in this topic

Hey guys, I'm wondering if there is an equivalent to indirect addressing with the compact logix. I'm not sure exactly how to approach this, but in the micro logix I think it would have been with indirect addressing. What I need to do is start a number of conveyors based on the order that the operator has indicated. This order is stored integers (integer1 is slot 1) so whatever conveyor number is in slot 1 will start first. Ok, now let's say that the order of my conveyors will be 5,3,1,4,2. 5 will start first, then 3, then 1, then 4, and finally 2. I've got all this logic working fine, but what I'd like to add is this: Let's say there is a problem with conveyor 1, and the overload trips. I want 3 and 5 to stop also. I had this program written for the ML1500, but I had to rewrite it in rslogix 5000 because I will be using CL instead. This is my first time using rs5000 and I'm not sure if what I want to do is possible. I think it has to be some type of indirect addressing equivalent because the order could be different every time. Can anyone recommend how I can solve this problem? Thanks in advance :)

##### Share on other sites
Can you give an example of the indirect reference in the ML1500 version that you wish to duplicate in the CompactLogix?

##### Share on other sites
LOL no sorry I didn't have that feature included when I was doing this on the 1500. But here is a little bit better explaination, maybe.... Integer 1=5, Integer 2=3, Integer 3=1, Integer 4=4, Integer 5=2 If slot 3 fails, look to see what slot 2 was, and stop it also. when slot 2 fails, look to see what slot 1 is and stop it also, etc... Now what I mean by fail, is start will have aux contacter going to plc input, so when that drops out, the starter has released and plc knows this. So if overload trips, or even pull cord estop will cause starter to release coil, etc.

##### Share on other sites
How do you know the conveyor is tripped? Just take that feedback (input) and tie it into the either conveyor as a condition to run...Your done...

##### Share on other sites
Well, no that's not it really because the order could be different. The operator inputs the order that the conveyors are arranged in through HMI. That order is then stored in integers. So that's why I was saying integer 1=5, etc.. that's the order that the conveyors are THIS time. Next time they could be different and static values that I put as conditions in the rung will not work correctly.

##### Share on other sites
CL supports everything (and more) that ML has. indirect addressing is one example. the only restriction is that index for indirect addressing must be tag (not the element of tag that is array for example). In ML: MOV N7:0 N17:[N7:1] In CL MOV my_value my_array[my_index]

##### Share on other sites
That's cool, so any ideas on how I can actually implement this into my program?

##### Share on other sites
Post the RSLogix 500 code from your old system and members could see how it was done and come up with a similar solution to what your used to

##### Share on other sites
Sure, it's here. N7:1 through N7:9 keep the order that the operator chose from the HMI. What I need is for basically N7:5 to "watch" N7:4, N7:4 needs to watch N7:3, etc. Whatever conveyor number is in N7:5 needs to stop if the conveyor in N7:4 stops.

##### Share on other sites
i must have misread it, i don't see indirect addressing anywhere in it.

##### Share on other sites
I don't see the indirect address either, but may I suggest the following: 1. Create a UDT called Conveyor with the following elements 1A. StartButton BOOL 1B. StopButton BOOL 1C. RunFlag BOOL 1D. OverloadInput BOOL 1E. InterlockFlag BOOL 1F. RunOutput BOOL 2. Create a Tag Called ConveyorArray which is array of UDT Conveyor Note : ConveyorArray[1] is mapped to conveyor 1 hardware Note : ConveyorArray[2] is mapped to conveyor 2 hardware Note : ConveyorArray[3] is mapped to conveyor 3 hardware 3. Create a Tag Called ConveyorPointerArray which is array of DINT 4. Create a Tag Called ConveyorPointerA which is DINT 5. Create a Tag Called ConveyorPointerB which is DINT 6. Write Code similiar to following to interlock conveyors 6A. Move ConveyorPointerArray[0] to ConveyorPointerA 6B. Move ConveyorPointerArray[1] to ConveyorPointerB 6C. You can write your code to like XIC ConveyorArray[ConveyorPointerA].RunOutput OTE ConveyorArray[ConveyorPointerB].InterlockFlag 7. You'll also need code to load ConveyorPointerArray from your HMI. 8. BTW the base code looks like SOR BST XIC ConveyorArray[X].StartPB NXB XIC ConveyorArray[X].RunFlag BND XIO ConveyorArray[X].StopPB XIO ConveyorArray[X].OverloadInput OTE ConveyorArray[X].RunFlag EOR 9. BTW the base code looks like SOR BST XIC ConveyorArray[X].RunFlag XIX ConveyorArray[X].InterlockFlag OTE ConveyorArray[X].RunOutput EOR

##### Share on other sites
Ok Bob, once again, you have made me realize how inexperienced I am with this stuff... I have a few questions: 1. What is UDT? This is my first experience with 5000, I barely know 500, but am getting used to it. Now that I'm messing with 5000 I'm completely in the dark. In my program tags I have created everything as BOOL, except for Integers, I made that DINT with 50 elements, and I have my timers of course. I'm not sure what UDT is though, is that another element type like BOOL and INT? 2. The conveyor array you speak of, will be like the N7:1 - N7:9 in my previous program? Like storage for the sequence order? If that's true, then I think I have a glimpse of what you're trying to tell me... But I'm also not sure of what SOR BST means, I know XIC is another way of saying normally closed contacts right? XIX, no clue... and OTE, and EOR also no clue. If you or someone else could give me a quick run down of basic definitions in that area I would appreciate it, as well as possibly clarrifying the things I specified. Thanks.

##### Share on other sites
UDT= User data type or user defined data type, look under data types in the left window under there you will see user defined.

##### Share on other sites
I have created a UDT for the conveyor, and entered the elements as you stated (start, stop, overload, etc...) I then created an array using that UDT and have all of them listed. My problem now is that I cannot assign an alias to any of these tags. The alias for field is greyed out, what am I doing wrong? how can I map these to my actual outputs and such?

##### Share on other sites
There are several ways to do this, but our preferred way is to create a ladder file called I/O mapping and Map UDT Outputs to real outputs and Real inputs to UDT inputs. IT is a lot of XIC OTE rungs but it gets the job done. it also assures that inputs and outputs don't change state mid scan.

##### Share on other sites
To expand and hopefully lay this out a little clearer. Let's assume we have 10 Conveyors with real i/o as follows. Conveyor 1 it attached to Local:1:I.Data.0 thru Local:1:I.Data.7 for inputs and Local:2:O.Data.0 thru Local:2:O.Data.7 for outputs Conveyor 2 it attached to Local:1:I.Data.8 thru Local:1:I.Data.15 for inputs and Local:2:O.Data.8 thru Local:2:O.Data.15 for outputs Conveyor 3 it attached to Local:3:I.Data.0 thru Local:3:I.Data.7 for inputs and Local:4:O.Data.0 thru Local:4:O.Data.7 for outputs Conveyor 4 it attached to Local:3:I.Data.8 thru Local:3:I.Data.15 for inputs and Local:4:O.Data.8 thru Local:4:O.Data.15 for outputs Conveyor 5 it attached to Local:5:I.Data.0 thru Local:5:I.Data.7 for inputs and Local:6:O.Data.0 thru Local:6:O.Data.7 for outputs Conveyor 6 it attached to Local:5:I.Data.8 thru Local:5:I.Data.15 for inputs and Local:6:O.Data.8 thru Local:6:O.Data.15 for outputs Conveyor 7 it attached to Local:7:I.Data.0 thru Local:7:I.Data.7 for inputs and Local:8:O.Data.0 thru Local:8:O.Data.7 for outputs Conveyor 8 it attached to Local:7:I.Data.8 thru Local:7:I.Data.15 for inputs and Local:8:O.Data.8 thru Local:8:O.Data.15 for outputs Conveyor 9 it attached to Local:9:I.Data.0 thru Local:9:I.Data.7 for inputs and Local:10:O.Data.0 thru Local:10:O.Data.7 for outputs Conveyor 10 it attached to Local:9:I.Data.8 thru Local:9:I.Data.15 for inputs and Local:10:O.Data.8 thru Local:10:O.Data.15 for outputs Now looking at ConveyorArray[1] we have mapping code like this: XIC Local:1:I.Data.0 OTE ConveyorArray[1].StartButton XIC Local:1:I.Data.1 OTE ConveyorArray[1].StopButton XIC Local:1:I.Data.2 OTE ConveyorArray[1]. OverloadInput XIC ConveyorArray[1].RunFlag OTE Local:2:O.Data.0 XIC ConveyorArray[1].RunOutput OTE Local:2:O.Data.1 Now looking at ConveyorArray[2] we have mapping code like this: XIC Local:1:I.Data.8 OTE ConveyorArray[2].StartButton XIC Local:1:I.Data.9 OTE ConveyorArray[2].StopButton XIC Local:1:I.Data.10 OTE ConveyorArray[2]. OverloadInput XIC ConveyorArray[2].RunFlag OTE Local:2:O.Data.8 XIC ConveyorArray[2].RunOutput OTE Local:2:O.Data.9 Hopefully you can map the other 8 Now lets say that we have 5 conveyor positions and any of the 10 can be in each position. For our example we'll use them as follows Conveyor 3 in position 0 ; Conveyor 5 in position 1 ; Conveyor 7 in position 2; Conveyor 9 in position 3 ; Conveyor 1 in position 4 To achieve this we load the following from the HMI into the ConveyorPointerArray as follows: ConveyorPointerArray[0] = 3 ConveyorPointerArray[1] = 5 ConveyorPointerArray[2] = 7 ConveyorPointerArray[3] = 9 ConveyorPointerArray[4] = 1 This allows us to load 0 into ConveyorPointerA and by using ConveyorArray[ConveyorPointerA].?? to manipulate the controls of whatever physical conveyor hardware {1 thru 10} is in position 0. Hope this clears it up some for those still trying to figurte out this post.

##### Share on other sites
Could someone please clarify what BST and NXB mean? I'm assuming that is some type of lingo for a branch? But I'm not positive. Thanks. Edited by CanaanP

##### Share on other sites
BST is branch start and NXB is next branch. I suggest you take your graphic editor and create a rung with a branch in it and then look at the mnemonics. Having cut my teeth back in the 8080 assembly language days I still tend to think and write code in mnemonics as much as I do graphically.

##### Share on other sites
Ok that helps out quite a bit, thanks. On step 9 in post 11, did you mean for the runflag and interlockflag to be in series or in parallel? The way it's written they are in series, and there is a branch with nothing on it. Would this be the way it is meant to be: BST XIC ConveyorArray[0].RunFlag NXB XIC ConveyorArray[0].InterlockFlag BND OTE ConveyorArray[0].RunOutput Does this page look anywhere near where I need to be? I haven't gotten to where I can test it yet, so I'm not sure... the way I've been learning things lately is to be able to watch it run and try to see what went wrong and I can't do that just yet with this one. If this is correct for doing one of the conveyors I can manage it from there to adapt to the others. Thanks for the help :) RSLogix_5000_Report_s_.pdf Edited by CanaanP

##### Share on other sites
Your PDF looks right to me. I typo'd due to cut/paste in post 11. There was no need for the branch. The RunFlag indicates I want to run if the other conveyor will let me. The Run interlock then ties the other copnveyor into the acutal run output. You've got a good start to what you want. Keep plugging at it.

##### Share on other sites
Sorry to drag this out, but I have some confusion about something(again)... When I move ConveyorPointerArray[1] to ConveyorPointerA, and ConveyorPointerArray[2] to ConveyorPointerB, and then the rung that links A's output to B's interlock flag - at first I assumed I would re-use this over and over and just move the different values into A and B, but now I'm not sure. What happens to the interlocking when I move ConveyorPointerArray[3] to A and [4] to B? I need Do I need to just create ConveyorPointerC and D, E and F, etc? This way the values would not be changing until the next time they load values into the array. Does this make sense? Or am I looking at this wrong?

##### Share on other sites
Secret Rockwell Handshake about to be disclosed here. Values written into the data table remain there until updated by another PLC scan or manipulation by an outside data source. Let's see how that plays out. Loaded from HMI ConveyorPointerArray[0] = 3 ConveyorPointerArray[1] = 5 ConveyorPointerArray[2] = 7 ConveyorPointerArray[3] = 9 ConveyorPointerArray[4] = 1 PASS 1 ----- ConveyorPointerA = ConveyorPointerArray[0] MEANS ConveyorPointerA= 3 ConveyorPointerB = ConveyorPointerArray[1] MEANS ConveyorPointerB= 5 XIC ConveyorArray[ConveyorPointerA].RunOutput OTE ConveyorArray[ConveyorPointerB].InterlockFlag MEANS XIC ConveyorArray[3].RunOutput OTE ConveyorArray[5].InterlockFlag PASS 2 ----- ConveyorPointerA = ConveyorPointerArray[1] MEANS ConveyorPointerA= 5 ConveyorPointerB = ConveyorPointerArray[2] MEANS ConveyorPointerB= 7 XIC ConveyorArray[ConveyorPointerA].RunOutput OTE ConveyorArray[ConveyorPointerB].InterlockFlag MEANS XIC ConveyorArray[5].RunOutput OTE ConveyorArray[7].InterlockFlag NO REFERENCE TO ConveyorArray[5].InterlockFlag THIS PASS MEANS IT REMAINS UNCHANGED PASS 3 ----- ConveyorPointerA = ConveyorPointerArray[2] MEANS ConveyorPointerA= 7 ConveyorPointerB = ConveyorPointerArray[3] MEANS ConveyorPointerB= 9 XIC ConveyorArray[ConveyorPointerA].RunOutput OTE ConveyorArray[ConveyorPointerB].InterlockFlag MEANS XIC ConveyorArray[7].RunOutput OTE ConveyorArray[9].InterlockFlag NO REFERENCE TO ConveyorArray[5].InterlockFlag THIS PASS MEANS IT REMAINS UNCHANGED NO REFERENCE TO ConveyorArray[7].InterlockFlag THIS PASS MEANS IT REMAINS UNCHANGED Hope you get the idea.