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

Overloading a function block for different input types

ert
2016-10-13
2016-10-15
  • ert - 2016-10-13

    Hello,
    Is there a possibility to overload a function block to accept a REAL, an INT or a BOOL variable type input?
    I mean 'one block to rule them all', so that no different FB names are required.

     
  • shooter - 2016-10-13

    You can make a function block with several inputs of different types, and internally knot them to something making sense, but it is impossible that one input accepts different types of variables.

    then it is just a matter of correct connecting, and you will have only one type of FB.

     
  • ert - 2016-10-14

    Your idea is completely opposite to my concept. If I wanted to do that, I would rather make multiple function blocks, one per each data type.
    But really the case is to have one function or function block that serves multiple data types, because the function/function block will not know which data is passed.

     
  • josepmariarams - 2016-10-15

    Use input type any.

     
  • shooter - 2016-10-15

    you can use a pointer to the input and jst grab anything that is on your pointer.

     

Log in to post a comment.