Sign in to follow this  
Followers 0
Mo_AB_4EVER

CompactLogix tagname referencing

4 posts in this topic

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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. See ya!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0