mrgees100peas
Member
for micrologix devices rslinx 5000
I am task with adding some static bars to one of our lines. The current code has 2 bars already in place. I'm going to add 7 more (9 total) so I figure that since the code repeats I'll create an add-on instruction that will do all the work neatly. The data comes from a controller which talks to the plc via ethernet. The controller stores all the data for all the bars in a single array of INT, size 117. For the add-on instruction I don't need all 117 entries, I just need 1 or 2 of those. For example, data[19] and data [22].
Here is my question. Since that data is an input to the add-on instruction do I pass in the whole array (117 elements) or just the part of the array I need? The thing is that I want to get away from knowing exactly which array element belongs to which bar. All the data is separated equally for example the status data for bar 1 is stored in data[19] and for bar 2 is in data[28] (9 addresses apart). I don't know how data is passed in a plc but it would seem to me rather wasteful to pass a whole array just to get 2 elements out of it.
I am task with adding some static bars to one of our lines. The current code has 2 bars already in place. I'm going to add 7 more (9 total) so I figure that since the code repeats I'll create an add-on instruction that will do all the work neatly. The data comes from a controller which talks to the plc via ethernet. The controller stores all the data for all the bars in a single array of INT, size 117. For the add-on instruction I don't need all 117 entries, I just need 1 or 2 of those. For example, data[19] and data [22].
Here is my question. Since that data is an input to the add-on instruction do I pass in the whole array (117 elements) or just the part of the array I need? The thing is that I want to get away from knowing exactly which array element belongs to which bar. All the data is separated equally for example the status data for bar 1 is stored in data[19] and for bar 2 is in data[28] (9 addresses apart). I don't know how data is passed in a plc but it would seem to me rather wasteful to pass a whole array just to get 2 elements out of it.