Jump to content

Using pointers in GX IEC Developer


Recommended Posts

Guest cmulder
Posted
Hi all, The thing I'm trying to achieve is actually quite difficult to explain, but since there's no use posting this topic if I can't explain, I'll give it a go anyway... I have created a DUT ("DUTDigitalInput") consisting of 4 BOOL's. The DUT represents one digital input, with extra information that can be used to "overrule" the input via software, for instance during commissioning. In the GVL I have defined a number of digital inputs, each of the type DUTDigitalInput. Now I would like to create an FB where I can address each variable defined in the GVL one-by-one to check whether it has to be overruled or not. Of course I would prefer not to call them by name or even address. Instead I would like to input the startaddress and number of inputs in the FB, and internally in the FB I can then address the correct variable. My guess is I have to use pointers for this, but I do not really know how to create and use these in GX IEC Developer. Any help would be much appreciated. My apologies if it isn't exactly my explanation isn't exactly clear. I have tried to explain as good as possible. Thanks in advance, Caspar

Posted
if your data types are all the same, you can use arrays, move your DUT defined variables into an array of the same dimension, this array can then be moved into your user defined function blocks as a single addressable element. Hope this answer matches your question!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...