Help - Search - Members - Calendar
Full Version: CompactLogix tagname referencing
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
Mo_AB_4EVER
Hi everybody!

Let's say I want to make one subroutine that will handle multiple similar pieces of equipment.

Seems to me that I must use the CPS instruction to copy each individual structure into a "multiplexed" structure, call the routine using the JSR with the multiplexed structure in argument, then CPS again the multiplexed structure into original structure of the equipment. And then repeat the three rungs for every similar equipment.

Am I doing this right, or is there a better way to do this?

Also, is there a way to "build" a tagname for indirect referencing?
As an exemple ,we used to do with adresses, N[N7:0]:[N7:1], where N7:0 is the file pointer and N7:1 is the item pointer.
Now with tagnames, can we use Machine.[Stringtag].Status, Where Stringtag would contain "Section1", "Section2", "Section3" and so on?

Thanks for your help!
AlThePal
QUOTE(Mo_AB_4EVER @ Nov 5 2007, 04:26 PM) [snapback]61231[/snapback]

Hi everybody!

Let's say I want to make one subroutine that will handle multiple similar pieces of equipment.

Seems to me that I must use the CPS instruction to copy each individual structure into a "multiplexed" structure, call the routine using the JSR with the multiplexed structure in argument, then CPS again the multiplexed structure into original structure of the equipment. And then repeat the three rungs for every similar equipment.

Am I doing this right, or is there a better way to do this?

Also, is there a way to "build" a tagname for indirect referencing?
As an exemple ,we used to do with adresses, N[N7:0]:[N7:1], where N7:0 is the file pointer and N7:1 is the item pointer.
Now with tagnames, can we use Machine.[Stringtag].Status, Where Stringtag would contain "Section1", "Section2", "Section3" and so on?

Thanks for your help!


Hi,

I'm only just starting out with CLX so I may be wide of the mark here, but I think you would do this with User-Defined types and arrays.

Say you created a User-Defined type with name 'Recipe' and members 'Length' and 'Weight'. You can then define a new variable of type 'Recipe' - call this 'Object' for example. At this point you can also choose whether to make it an array. If you set Dimension 0 to greater than 0, you would then have a number of independent data structures which you could fill with data using the same code, just by changing the offset value i.e. Object[0].Length, Object[1].Length etc.

The following document explains this in depth: 1756-PM001I-EN-P page 2-44.

Hope this helps.
Mo_AB_4EVER
Update on my issue:

I think what I'm looking for is an add-on routine.
Now the problem is a little bit different:

In the Add-on definition configuration window, In the Parameters tab, I can't define tag using a user-defined data type. Why? This would be so simple if I could! I would just call the Add-on routine with all the individual similar pieces of equipment with the UDT as an In/Out parameter.

This way, each time the Add-on would be called, the paramaters would be transfered and the values would follow to the routine and back from it.

Is there a way to work around this?
Mo_AB_4EVER
Found my problem. In fact, I didn't have a problem. Using UDT's as InOut parametes work. I just tried it again and it worked, don't know what I had done wrong.

Those controllers are SO great. notworthy.gif

See ya!

QUOTE(Mo_AB_4EVER @ Nov 5 2007, 02:12 PM) [snapback]61241[/snapback]
Update on my issue:

I think what I'm looking for is an add-on routine.
Now the problem is a little bit different:

In the Add-on definition configuration window, In the Parameters tab, I can't define tag using a user-defined data type. Why? This would be so simple if I could! I would just call the Add-on routine with all the individual similar pieces of equipment with the UDT as an In/Out parameter.

This way, each time the Add-on would be called, the paramaters would be transfered and the values would follow to the routine and back from it.

Is there a way to work around this?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.