ivvi
ivvi

Reputation: 5310

Connect outputs from separate boxes to two different inputs on one box in CODESYS Function Block Diagram

In CODESYS FBD, is it possible to connect outputs from two separate boxes to different inputs on one box, like in the image? If so, how?

The reason I wish to do this is to not repeat the logic that outputs some_output which may depend on many input signals.

FBD illustration

Upvotes: 0

Views: 127

Answers (1)

Ludo
Ludo

Reputation: 11

This is (partially) possible. Start with the AND function. Get the 2nd OR function and connect this to the AND function

enter image description here

Now get the 1st OR function and connect it FIRST to the 2nd connector of the 2nd OR function. Then you will see the '+' sign and it add's as desired. enter image description here

And connect the 'some_output' variable to both inputs. enter image description here

But creating it as in your example is a 'challenge'. I tried adding a branch in front, but then I can not connect it anymore, or only via a intermediate variable.

enter image description here

So when you have a output from a previous block, consider to devide it into two branches. The desired functionality is possible in a PLC, but I think that the editor is not 'smart' enough to handle this.

But as already mentioned. If there is no reason that you 'HAVE TO' use FBD, try the code in Structured Text (ST) language. It is much easier to monitor and you can add inline comments.Here an example: enter image description here

Upvotes: 0

Related Questions