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

If Then Else and Case in FBD

JayDeeTech
2020-01-24
2020-01-24
  • JayDeeTech

    JayDeeTech - 2020-01-24

    Hi,
    First steps in codesys...
    Is there an equivalent to IF-Then-Else or Case in the FBD language? It seems to exist in the ST and I naively assume the you could do in FBD the same as in ST.
    thanks, J.

     
  • sgronchi

    sgronchi - 2020-01-24

    For IF-THEN-ELSE:
    SEL is an idiomatic way, if (and only if) the two branches do not have side effects.
    An ugly way is using a chain of boxes each with EN/ENO.
    But please, even if you can write a FOR loop in Ladder, it does not mean it is a good idea. If you are unable to avoid side effects in branches, it is better to stay in ST: the resulting code will be more clear to others (including your future self).

     

Log in to post a comment.