How to reference a DINT in RSLogix 5000?

Join Date
Nov 2021
Location
United States
Posts
31
Hi! I had a little problem yesterday regarding how to link two DINTs together, but after some time thinking, I feel my question is actually, “How do I reference a DINT and not the actual value of said DINT”. For example, if I had a tag “A” that was 128 DINTs, how would I reference DINT 35?
Like post says, I’m using RSLogix 5000 trying to program an L71 Allen Bradley processor.
 
When using arrays, the element number would be in brackets. So if you had an array called Storage that contained 128 DINTS, they would be identified as elements 0 -127. Element #35 would be "Storage[35]"

OG
 
That, I know. I’m sorry let me try to clarify some more. I’m trying to program 128 different push buttons with a tag of PB[128] that each correlate to a tag “A” of 128 DINTs as well. I’m trying to use Indirect Addressing so I won’t have to make a different rung for each set of tags. I have a tag of index1, and my thought is have a line that goes somewhat like, XIC-PB[Index1]->MOV 1 to A[Index1]. If I were to press PB[35], how would I move the value of 35 to the tag “Index1”
 
What have you tried? For school help, most of us require that you take a stab at it. The software has help and typically has examples, including example programs. I would start there.
 
OK I am going to make a few assumptions here. I am assuming that the 128 PB tags are in a BOOL type array. Then I am assuming your "A" is an array of 128 DINTS. I feel safer on that second assumption. Please advise if these are incorrect assumptions.

OG
 
I put “MOV 1 -> A[0]-[128], and it faulted the controller. Also, I’m not exactly sure what indirection is. I only started working with PLCs about two months ago.
 
Indirection allows you to dynamically change which element of an array you are referencing. You have a DINT (CountValue), which stores a number +- ~2billion
You have an array of a type, in your case, BOOL's (MyBools)(my nemesis).

Let's say that my array of BOOL's is a recipe, which represents box orientation, 1 = rotate, 0 = don't rotate. I need to rotate the first 4 boxes, the next 4 do not rotate. So my array from [0] - [7] looks like [1, 1, 1, 1, 0, 0, 0, 0]

I have a sensor that triggers a counter, counts up each time it triggers. You move the counters ACC into your DINT. So each count, your DINT will now contain the accumulated value of your counter.

Code:
XIC MyBOOLS[CountValue] OTE TurnBox

So now when the counter is 0, you will be referencing MyBOOLS[0] because your CountValue DINT = 0. When CountValue = 1 you are now referencing MyBOOLS[1] and so on.

Your controller faulted because your array is 128 (0-127). If you indirectly try to point to [128], it doesn't exist and will fault the controller. You must make sure the value in your indirect address doesn't go beyond the boundaries of your array.
 
I put “MOV 1 -> A[0]-[128], and it faulted the controller.
Tag A is a DINT[128], right? If so, it has elements A[0] through A[127]. If you try to address A[128] (or higher) you will get a major fault type 4 code 20 because the array ends at 127. The address of the final element of an array is always one lower than its size, since the first element is numbered 0 rather than 1.

Also, IÂ’m not exactly sure what indirection is.
In general, indirection is using a pointer to a value instead of the value itself. In your earlier example "XIC-PB[Index1]->MOV 1 to A[Index1]" involves indirection by using 'Index1' instead an actual value.
 
Your controller faulted because your array is 128 (0-127). If you indirectly try to point to [128], it doesn't exist and will fault the controller. You must make sure the value in your indirect address doesn't go beyond the boundaries of your array.


Btw, on some brands of PLC, when you write to array element A[128] and the array elements only run from A[0] to A[127], then although A[128] "logically" points to somewhere off the end of the array - i.e. to a location at 128 element sizes from A[0] - the program will still write to that somewhere. Wheee!
 
Btw, on some brands of PLC, when you write to array element A[128] and the array elements only run from A[0] to A[127], then although A[128] "logically" points to somewhere off the end of the array - i.e. to a location at 128 element sizes from A[0] - the program will still write to that somewhere. Wheee!

I did this in my very first Controllogix program back around 2000 and it did not fault the PLC, it just corrupted some data used by a sequencer. I don't remember what version of RSLogix 5000 I was using but it was one of the earliest.
 
Thank you everyone for all the help! Regarding dmroederÂ’s response, I understand the counter and how it counts up, but what if I only wanted to do boxes 3 & 4?


Count from 0 to 1, then

XIC MyBOOLS[counter.ACC+3] OTE TurnBox


might work on some platforms, otherwise summat like

ADD counter.ACC 3 CountValue XIC MyBOOLS[CountValue] OTE TurnBox


or even

BST LIM 3 CountValue 4 XIC MyBOOLS[CountValue] NXB LIM 5 CountValue 2 XIC TurnBox BND OTE TurnBox


 
Last edited:
Thank you everyone for all the help! Regarding dmroederÂ’s response, I understand the counter and how it counts up, but what if I only wanted to do boxes 3 & 4?

Well, knowing the details of what you are doing and why you are doing it would be helpful. You may be using the wrong tool for the job.

Whatever is determining when/why you are indirectly switching between Bool[3] and Bool[4] needs to be limited to the values of 3 and 4.

What may make more sense is something like:

Code:
BST XIC Condition XIC Bool[3] NXB XIO Condition XIC Bool[4] BND OTE DoSomething

If you are unfamiliar with what I posted above, add a new rung and double click the rung number. This a text box that gives you the text version of the rung, you can paste what I have above there to construct the rung. The tags won't exist, but you will be able to see the psudo-code a san actual rung.
 

Similar Topics

Hello guys, I am new to this forum and have some problems with my PowerFlex755 EENET frequency inverter. I want to do a point to point...
Replies
9
Views
383
I have a FactoryTalk View Se project, Is it possible to export Direct Reference tags to edit in a CSV file or Excel? I know I can export HMI...
Replies
1
Views
288
Hey, I'm trying to do the following, I have some experience with Citect but can't seem to figure this out. I/O Tag: BoxPos1_ProdNum (Data Type...
Replies
0
Views
576
OK I'm ashamed that I'm here asking this as I think in 23 years I would have ran into this before. But here we are. Created an AOI to manipulate...
Replies
6
Views
1,996
Studio 5000 & PF 525, Ethernet Comms, Encoder FB, Using Motor RPM as speed reference I'm trying to figure out how to send a speed reference in...
Replies
6
Views
933
Back
Top Bottom