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

difference of Var_in_out in function & function_block

sarathbabu
2014-09-02
2014-09-05
  • sarathbabu - 2014-09-02

    What is the difference between function & function block in terms of using var_in_out in codesys v2?

    function no need to instantiate & it returns a value in Version2.

    In version3 function can have outputs also.

     
  • shooter - 2014-09-02

    a function can have only one output (this can be a structure) and a FB can have more vars.

     
  • sarathbabu - 2014-09-03

    Yes function returns a value.

    I need info about using var_In_Out in function

    Thanks

     
  • shooter - 2014-09-03

    here you go
    as a function can only give one variable back (or a structure) i have to put all outs in one structure.
    in a function block you can have several in and out

    WERK.zip [475 Bytes]

     
  • sarathbabu - 2014-09-04
    var_In_Out 
    test:bool;
    test2:int;
    end_var
    

    shooter hat geschrieben:
    here you go
    as a function can only give one variable back (or a structure) i have to put all outs in one structure.
    in a function block you can have several in and out

    Try the above in function declaration

    Am asking about var_in_out in declaration

     
  • shooter - 2014-09-04

    in a function it is impossible to have in-out,
    start a new function and you will not be able to select it from the assistant.

     
  • sarathbabu - 2014-09-05

    pls check the attached pgm

    function allows in_out

    func.pro [33.93 KiB]

     
  • shooter - 2014-09-05

    you declared it yes , but how do you get the result from internal to external?
    ie you do not use over (which is the output of the function.)

     

Log in to post a comment.