Add Inst and Pointers

chavak

Member
Join Date
Jul 2002
Posts
750
Hi,

Does RSLogix 5000 support Add instruction with pointers. I was trying something like this, but the software do not buy in,

I was trying to capture inspection failures per track number /jig. The machine have 20 jigs and each jig with 4 tracks

I created a two dimensional array - Fail_Count[4,20], a tag to hold the Track Numbers as - Track_Number[5], and Jig_Number[21]. Planned not to use the first data field [0] from both tags for better readability.

and tried to add as shown, but not successful, what am I doing wrong?


--------------------------------------------|
| Add |
| Fail_Count[Track_Number[1],Jig_Number[1]] |
| |
| 1 |
| |
| Fail_Count[Track_Number[1],Jig_Number[1]] |
|--------------------------------------------





Best Regards
___________
 
No true pointers in RSL5K but you can use tags to index into arrays.

If I'm following you correctly, I would:

Define Fail_Count as [21, 5] (4 tracks for each of 20 jigs, 0 indexes not used) or (20 jigs each with 4 tracks)
Define Jig_Number as integer (valid range would be 1-20 for index purposes)
Define Track_Number as integer (valid range would be 1-4 for index purposes)

Then the ADD becomes
ADD Fail_Count[Jig_Number, Track_Number] 1 Fail_Count[Jig_Number, Track_Number]

If jig_Number = 14 and Track_Number = 3 then the ADD would resolve to:
ADD Fail_Count[14, 3] 1 Fail_Count[14, 3]
 
Last edited:
I understand an individual add command for each jig/track will work. But it will take 80 add instructions in total, [4 add instructions per jig].

I was trying to reduce it to 4 by using indirect addressing[each track are inspected individually, but I track the jig number on the indexer].

As this is nothing to do with the sequence and no trouble shooting required I guess it is neat to use indirect addressing.

Any thoughts

Thank You
_________
 
I suppose that RSLogix5000 does not use 2-dimensional and 3-simensional matrix arrays and matrix arithmetic as used in high-school algebra.

Oh, well, maybe Rockwell will add matrices in the next program revision.
 
I understand an individual add command for each jig/track will work. But it will take 80 add instructions in total, [4 add instructions per jig].

I was trying to reduce it to 4 by using indirect addressing[each track are inspected individually, but I track the jig number on the indexer].

As this is nothing to do with the sequence and no trouble shooting required I guess it is neat to use indirect addressing.

Any thoughts

Thank You
_________

I set up a looping jump with a counter, about 2 to 5 rungs will do it.
 
Managed to solve it, thankyou for everybody sharing the thoughts, especially jstolaruk.

I created a tag called Jig_At_Station and moved the Jig_Number[x] to it first, then performed the add instruction.

Learned something today - Add instruction do not accept array inside an array, which gives an error of "Invalid Array Subscript"

Now for track 1 fail counter the instruction looks as follows,


--------------------------------------------|

| Add |
| Fail_Count[1,Jig_At_Station ] |

| |

| 1 |

| |

| Fail_Count[1,Jig_At_Station ] |

|--------------------------------------------




Now with 4 rungs I am able to populate 80 fail counters. The second, third and fourth add instruction is similar except the second dimension element is 2, 3 & 4 and first one is same - Jig_At_Station.

Thank You
Best Regards
____________
 

Similar Topics

Hi, I have questions. I have Analog Input that need to put into Ignition Designer. But I don't know how to put?
Replies
1
Views
118
I have just installed Studio 5000 V30.11 on my Windows 11 Pro machine. First I had an "Invalid Pointer" error that required me to update Factory...
Replies
2
Views
117
Im trying to create a level indicator for water Tank i have used the ADD function while the pump is on and level increasing everything works...
Replies
33
Views
1,021
We are trying to poll data coming from a PLC for remote monitoring we have the IP address of the PLC and the default port number and the path is...
Replies
25
Views
577
Back
Top Bottom