Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Is it possible to create extensible Parameters in CODESYS ST function blocks?

pcs-1282
2021-09-17
2021-09-17
  • pcs-1282 - 2021-09-17

    My requirement is that the number of input/output parameters to the FB should be a variable and when instantiating the FB, the required number of parameters can be specified. So one instance of the FB can have 2 IOs, another can have 10 etc. Thanks!

     
  • hermsen

    hermsen - 2021-09-17

    Hi,

    I think so using an array of [ * ] elements as input.
    The mainnidea is to have 1 to n elements as input this way.

    Within the FB you should loop over the 1..n elements using a FOR loop or something.
    be sure to read help onnthis topic for further hints on using this mechanism.

     
    • pcs-1282 - 2021-09-17

      I will check this out, thanks!

       

Log in to post a comment.