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

COMPOSER

ert
2014-06-10
2014-06-10
  • ert

    ert - 2014-06-10

    Hi, I am interested in what really the COMPOSER is, i.e. what happens when I drag and drop a composer to CFC and wire it to a structure?

    The reason I am asking is I want to use a composer to expand a Function Block structure declared as VAR_IN_OUT. Then I would like to wire in several structure fields so that they are fixed at certain values. I would like to wire several other structure fields to some VAR_IN_OUT variables which are configurable. The last step is I would like to embed everything described above into a Function Block and use that chosen VAR_IN_OUT fields from the VAR_IN_OUT structure outside of that main Function Block (but not the whole structure of the internal FB, which is too big!).

    So the question is: what the COMPOSER is (does it create any variable etc.) and is it a good practice to do things as described above?
    I noticed that if a VAR_IN_OUT structure is left unconnected I cannot build a project. But when I wire a COMPOSER without anything wired in I can build it (so I guess it can create a structure of VAR_IN_OUT).

     
  • timvh

    timvh - 2014-06-10

    The composer in CFC can be used to write the individual variables into a structure. Therefore the output of the composer is of the type of the structure you selected.
    This cannot be used (not good practice) if you want to connect the output of the composer to the VAR_IN_OUT of the function block, because the purpose of the VAR_IN_OUT is to be able to also write back to this structure, but this is then not possible.

    You need to assign a variable to a VAR_IN_OUT, because it is a reference to the address of the variable. If it is not assigned, then it is refering to nothing and the compiler doesn't accept this.

     

Log in to post a comment.