Back to all lessons

Lesson 14

De Morgan's Laws in Logic Diagrams

Transform NOT, AND, and OR expressions, verify equivalence with a truth table, and apply De Morgan's laws in FBD.

logicintermediateschooluniversityengineerANDORNOTEQ

1. De Morgan's Laws

De Morgan's laws transform logic expressions that negate a group of conditions. For the AND operation, the first law is:

NOT(A AND B) = NOT A OR NOT B

In other words, “A and B are not both true” is equivalent to “A is not true or B is not true.”

The second De Morgan law is:

NOT(A OR B) = NOT A AND NOT B

When negation moves through a group, AND changes to OR, OR changes to AND, and each individual condition is negated.

2. Verification with a Truth Table

The first law can be checked for all four combinations of inputs A and B.

ABA AND BY1 = NOT(A AND B)NOT ANOT BY2 = NOT A OR NOT B
0001111
0101101
1001011
1110000

Y1 and Y2 match in every row, so the two expressions and their FBD branches are logically equivalent.

3. Practical Example

Suppose a machine may run only when both of these conditions are true:

  • A — the safety door is closed;
  • B — air pressure is within the permitted range.

The run permission can be written as:

RunPermit = DoorClosed AND PressureOK

A blocking signal can be obtained by negating the whole permission:

Block = NOT(DoorClosed AND PressureOK)

De Morgan's law gives the equivalent expression:

Block = NOT DoorClosed OR NOT PressureOK

The second form is often easier to diagnose because it shows directly that the machine is blocked by an open door or insufficient pressure.

4. Verifying the Law in the FBD Simulator

The lesson program implements both equivalent branches. The upper branch calculates Y1 = NOT(A AND B), while the lower branch calculates Y2 = NOT A OR NOT B. The EQ block compares them and writes the Y_EQUAL output.

1. Open the program in the simulator. 2. Start simulation mode. 3. Set A = FALSE and B = FALSE, then execute a scan. 4. Repeat the check for FALSE/TRUE, TRUE/FALSE, and TRUE/TRUE. 5. Compare Y1 and Y2 with the truth table. 6. Confirm that Y_EQUAL remains TRUE for all four combinations.

If Y_EQUAL becomes FALSE, the branches are no longer equivalent. Check the connections and the positions of the NOT blocks.

5. Applications in Larger Logic Diagrams

Permissive and Interlock Chains

Starting a mechanism in an industrial program often depends on several conditions:

Permit = SafetyOK AND DriveReady AND PressureOK AND ProductPresent

Negating the combined permission produces an OR expression of individual failures:

NotPermit =
    NOT SafetyOK
    OR NOT DriveReady
    OR NOT PressureOK
    OR NOT ProductPresent

This form is easier to reuse for a common fault and for individual diagnostic messages.

Normally Closed Signals

Emergency-stop circuits, safety doors, and some sensors are commonly wired with normally closed contacts. Their PLC programs therefore contain many inverted signals. De Morgan's laws help move negation through AND and OR groups without changing the algorithm.

Common Fault Generation

For example, system readiness can be written as:

SystemReady = Drive1Ready AND Drive2Ready AND RobotReady

The common fault state is:

CommonFault = NOT SystemReady

which is equivalent to:

CommonFault =
    NOT Drive1Ready
    OR NOT Drive2Ready
    OR NOT RobotReady

6. Simplification and Normalization

De Morgan's laws are used for:

  • simplifying complex logic expressions;
  • converting algorithms between FBD and LD;
  • analyzing truth tables;
  • constructing Karnaugh maps;
  • compiling logic diagrams automatically;
  • removing unnecessary inversions.

Equivalent branches are useful for learning and testing, but they do not provide safety-rated redundancy. Both branches use the same input data and are logically dependent on one another.

7. Summary

De Morgan's laws move negation through a group of conditions without changing the result:

NOT(A AND B) = NOT A OR NOT B
NOT(A OR B)  = NOT A AND NOT B

In FBD, these transformations help convert permissives into diagnostic blocking conditions, handle inverted signals, and verify equivalent representations of the same logic.

Practice block

Open the related example in the editor, run the simulation, and repeat the exercise from the article. The JSON is also available as a direct download.