If Then Else and Case in FBD

  • JayDeeTech

    JayDeeTech - 2020-01-24

    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

    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.