AND and OR use in FBD
FBD provides two instructions that can add and remove logic flow inputs. The F4 key or toolbar button drops an AND box with two input logic flows. The F6 key or toolbar button drops an OR box with two input logic flows. Each has one logic flow output.
Adding Logic Flow Inputs
Unlike other instructions, you can change the number of inputs for AND and OR boxes. Logic flows can be added one at a time with the + key or toolbar button. The box is expanded such that the newly added logic flow is aligned with a logic flow indicator. The box and its parameter assignments remain otherwise unchanged.
In the example above, a third comparison instruction is added to the network. A logic flow input is added to the AND box and is automatically aligned with the logic flow output of the new box.
Removing Logic Flow Inputs
Logic flows can be removed from AND and OR boxes as well. The - key or toolbar button will remove the most recently added logic flow input. The box and its parameter assignments remain otherwise unchanged.
In the example above, a third input in not used and is removed.
A 1 input AND box is supported. The 1 input AND box is the FBD program view of a single STL LD instruction or a single LAD contact. To place a 1 input AND box in your program, use a 2 input box and then delete 1 input with the remove input button.
Switching Between AND and OR
FBD makes it easy to switch between AND and OR logic. This is performed in Overstrike Mode by overwriting AND with OR or vice versa. The instruction label is updated to reflect the newly dropped instruction, and the parameters are retained, but the key feature is that the expansions of the box are left unchanged. In all other overwrites, the box would be re-expanded based on the current network.
In this example, it is determined that OR is needed rather than AND, but since the box is otherwise correct, a switch is performed. Note that the OR box retains the parameters and the expansions.
Updating AND and OR Instructions
When the expanded shape of an instruction no longer matches the network, the instruction can be updated. This is performed in Overstrike Mode by placing the same instruction directly upon the existing reference. The instruction is expanded based upon the current network, and the parameter assignments are inherited.
While available for all instructions, this technique is especially useful when working with AND and OR boxes, because it effectively removes unused logic flow inputs from the middle of the box. In the example above, the second input is no longer needed and must be removed. By updating the OR box, the box is re-expanded and the unused logic flow input is moved to the bottom of the box, where it can be easily removed.