Look up array from counter value

Lallers66

Member
Join Date
Jul 2017
Location
California
Posts
7
If this works it will save me a lot of work.
I have an array on number, 0-20.
I have 20 equal statement whit values from 0-20 (0 is excluded)
I have a counter counting up, and whatever the number is i want to be represented in the the source B of my equal statement as in array[number_from counter_accumulated]
In my case it's counter[0],
EQU Source A OH_power_average[0] Source B OH-power_average_sorted[0]

How do I do this?

I'm on a Allen Bradley processor 1756-L55, v15


Thank you everybody!

Counter.jpg
 
The trick is you cannot use Counter[0].ACC directly, Rockwell won't let you use complex tag structures in an indirect address. Move Counter[0].ACC into another tag, say "CounterIndex", then use CounterIndex: OH_power_average_sorted[CounterIndex]
 
*edit*

Move "Counter[0].ACC" to another tag and use that as the index into the array:

OH_power_average_sorted[someTag]
 
It's VERY IMPORTANT to make sure the Counter[0].ACC value NEVER goes above the last element number of array tag OH_power_average_sorted or below 0.

I'd recommend adding a rung just below the CTU, using limit checking logic and a move instruction to clamp the value of Counter[0].ACC or some other preventative measure.

Attempting to access a non-existent array element will fault the processor.
 

Similar Topics

Hello. Looking for the best way to load the preset and then do reset on a 144 position counter array in Controllogix? I'm monitoring 144...
Replies
1
Views
1,290
Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
1
Views
83
I am trying to copy an array of real numbers into a UDT with a real data type element. I have attached a snip below showing my COP instruction...
Replies
4
Views
200
I have an array of 55 REAL values. Is there a way to multiply based on the array location ? I have 55 transfer belts that are equally spaced...
Replies
3
Views
149
Hello everyone, I'm working on a project that involves controlling an array of nozzles within a CNC environment, where the nozzles travel along a...
Replies
5
Views
176
Back
Top Bottom