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

Using Output variables of a function block

ljean
2008-01-09
2008-02-13
  • ljean - 2008-01-09

    Here are 2 different ways to access the output variable of a FB. It looks similar but it seems that the 2nd one cause crash.

    I had the problem with REAL variables. It is Ok with the 1st method.

    I am using the Coldfire compiler.

    Is the 2nd way correct?

    MyFunctionBlock(VarInput1:='aa', VarInput2:=22, VarOutput1=>LocalVar1, VarOutput2=>LocalVar2);
    IF LocalVar1 THEN
    Β  x := LocalVar2 * 3;
    Β  ...
    END_IF
    ...
    
    MyFunctionBlock(VarInput1:='aa', VarInput2:=22);
    IF MyFunctionBlock.VarOutput1 THEN
    Β  x := MyFunctionBlock.VarOutput2 * 3;
    Β  ...
    END_IF
    ...
    
     
  • Ralph Holz - 2008-01-09

    Both codes look correct and should be possible. Did you check your project by changing the Target to another type of PLC PLCWinNT for example?

    Regards Ralph

     
  • ljean - 2008-02-13

    This problem has been fixed with CoDeSys 2.3.9.0

    Thanks

     

Log in to post a comment.