RS Logix5000 Arrays Using Variables to step through this

ryanweber101

Member
Join Date
Oct 2008
Location
Indiana
Posts
12
I am trying to use an array to save myself a lot of needless work. Unfortunately I need to have a variable inserted into the array name to step through the elements of the array. RSLogix 5000 will accept the array, Cure_Oven.S[1].Exhaust_Air_Flow_Interlock. I am creating two of the same ovens on this program so I thought I could put Cure_Oven.S[Current_Cure_Oven].Exhaust_Air_Flow_Interlock to simply cycle back and forth between the ovens (The Current_Cure_Oven would be a defined INT variable to control which oven I would be looking at). I am basing this assumption upon my experience with C++ programming using arrays. I would also like to note that it will accept the variable in the Data Structure as it capitalizes Current_Cure_Oven in the brackets [], but then fails to let me adjust any of the elements of that data structure.

Am I approaching this problem correctly, can this be accomplished, or is this something that is not possible with this program?

Respectfully,

Ryan
 
ryanweber101 said:
I am trying to use an array to save myself a lot of needless work. Unfortunately I need to have a variable inserted into the array name to step through the elements of the array. RSLogix 5000 will accept the array, Cure_Oven.S[1].Exhaust_Air_Flow_Interlock. I am creating two of the same ovens on this program so I thought I could put Cure_Oven.S[Current_Cure_Oven].Exhaust_Air_Flow_Interlock to simply cycle back and forth between the ovens (The Current_Cure_Oven would be a defined INT variable to control which oven I would be looking at). I am basing this assumption upon my experience with C++ programming using arrays. I would also like to note that it will accept the variable in the Data Structure as it capitalizes Current_Cure_Oven in the brackets [], but then fails to let me adjust any of the elements of that data structure.

Am I approaching this problem correctly, can this be accomplished, or is this something that is not possible with this program?

Respectfully,

Ryan

That should work. Can you post the section of code with a screen snap that you're having trouble with?
 
ScreenShot

Please notice the gray fields as they are not editable. When using the array index as a number [1] the preset timer fields are accessible(editable).
ScreenShot.jpg
 
Ryan,

That timer rung will function just fine. However, you can't enter the settings for preset and accumulator directly on the rung because your address doesn't resolve to a specific timer. Go into controller tags and enter the settings for each timer there.

Good luck,

Mike
 
Thanks so much; that helps me out immensely; like 500 lines of code overall. I'm going to plug in a variable for those presets and I'll be in business.

Enjoy the weekend guys.

-Ryan
 
Use a DINT

ryanweber101 said:
(The Current_Cure_Oven would be a defined INT variable to control which oven I would be looking at).
Make your index variable a DINT.
Because the CLX is natively 32-bit, every time you reference an INT causes generation of additional code to extract the 16-bit value from the 32-bit word that contains it. This impacts execution speed as well as memory usage.
 

Similar Topics

I created a tag called rack_and_contents which is a 13,1 array. I want to put into this array, a rack # (int) and its corresponding contents...
Replies
2
Views
2,917
Im pretty new to software and could use some advice please, I am trying to fire an output if any alarms on my software are on. I have a boolean...
Replies
16
Views
4,620
I'm trying to do my first ever structured text routine and failing miserably. Just to make things interesting, it's also my first foray into UDTs...
Replies
4
Views
3,011
Is there a single instruction or a simple way of OR'ing two arrays together? I want to avoid looping a bitwise OR, as it would require me to...
Replies
3
Views
2,578
I Have an array of udt tags of 4 members that I would like to sort in ascending order based on one of its members is there an easy way to do this...
Replies
0
Views
1,937
Back
Top Bottom