Variable Declaration

hegde
2011-07-17
2011-07-20
  • hegde - 2011-07-17

    Hello,
    I am new to CoDeSys...

    What is the difference between VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT

     
  • shooter - 2011-07-18

    variables are in different status available:
    normal vars only work within a function block (or program)
    inputs are used to get data from outside the block
    outputs are used to give data to other blocks.
    in/out can be used in both directions.
    just give it a try.

    if any questions just ask here no problem.

     
  • Anonymous - 2011-07-20

    Originally created by: Captive Engineer

    May I respectfully add that variables listed under the VAR_IN_OUT declaration are passed by reference rather than by value. This fact means that a programmer can address large pieces of data (arrays, structures) inside a function or function block without needlessly increasing actual consumed memory by the implicit copy that is performed when using VAR_INPUT and VAR_OUTPUT.

    Kind regards,
    The Captive Engineer

     

Log in to post a comment.