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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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).