Digital Logic Primer

The Core Idea

Digital logic combines TRUE/FALSE conditions into a decision. AND, OR, and NOT are the basic operations you can use to describe that decision before drawing its ladder rung.

What You Will Learn

  • The three fundamental logic operations: AND, OR, NOT

  • How logic gates process binary signals

  • How digital logic maps directly to ladder logic contacts and coils

  • Why understanding gates makes ladder programming intuitive

Why This Matters

Ladder logic is digital logic drawn as a circuit diagram. Every contact is a logic gate input, every coil is a gate output, and every rung is a logic equation. If you understand the three fundamental operations (AND, OR, NOT), you can read the decision in any rung — timers, counters, and math instructions build on the same TRUE/FALSE paths.

The Three Fundamental Operations

AND — All conditions must be true

AND produces TRUE only when ALL of its inputs are TRUE. If any input is FALSE, the output is FALSE.

In ladder logic: Contacts in series. Power must flow through ALL contacts to reach the coil.

OR — Any condition is sufficient

OR produces TRUE when ANY of its inputs is TRUE. The output is FALSE only when ALL inputs are FALSE.

In ladder logic: Contacts in parallel branches. Power can flow through ANY branch to reach the coil.

NOT — Inversion

NOT produces the opposite of its input. TRUE becomes FALSE, FALSE becomes TRUE.

In ladder logic: A normally-closed (NC) contact. It passes power when the tag is FALSE.

Combining Operations

Real logic combines AND, OR, and NOT. The expression:

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

means: the output is TRUE if (A is TRUE and B is TRUE) OR (C is FALSE).

In ladder: two parallel branches — one with A and B in series (AND), one with an NC contact for C (NOT). Either branch can energize the coil (OR).

The Key Insight

Every ladder rung IS a Boolean equation:

  • The left power rail is the "input" to the equation

  • Each contact is a variable being tested: a normally open (NO) contact tests for TRUE, an NC contact for FALSE

  • Series = AND, Parallel = OR

  • The coil is the "output" — the result of the equation

Once you see this, ladder logic stops being mysterious diagrams and becomes readable Boolean math drawn as a circuit.

Three-Variable Examples

Real control systems rarely have just two inputs. Here are common patterns with three or more variables.

AND with Three Inputs

Output = A AND B AND C

ALL three must be TRUE. In ladder: three contacts in series.

Notice: only ONE row is TRUE — the row where every input is TRUE. This is the signature of AND.

OR with Three Inputs

Output = A OR B OR C

ANY one is sufficient. In ladder: three parallel branches.

Notice: only ONE row is FALSE — the row where every input is FALSE. This is the signature of OR.

Mixed: AND-OR (Permissive with Override)

Output = (A AND B) OR C

The output is TRUE if both A and B are true (normal path), OR if C alone is true (override). In ladder: two parallel branches — one with A and B in series, one with just C.

Real-world example: A pump runs if (Level_High AND Valve_Open) OR Manual_Override.

Mixed: AND-NOT (Permissive with Inhibit)

Output = A AND B AND (NOT C)

All permissives must be met AND the inhibit must be clear. In ladder: A and B as NO contacts in series, plus C as an NC contact in series.

Real-world example: Fan runs if (Temp_High AND Auto_Mode AND NOT Fault).

Mixed: OR-AND (Redundant Sensors with an Enable)

Output = (A OR B) AND C

Either sensor is sufficient (redundancy), but the enable condition must also be TRUE. In ladder: a parallel branch (A or B) followed by C in series.

Real-world example: Alarm sounds if (Smoke_Detector_1 OR Smoke_Detector_2) AND System_Armed.

Reading Complex Expressions

When you see a complex expression, break it into groups:

  1. Identify the OR groups — these are parallel branches

  2. Within each group, identify the AND chain — these are series contacts

  3. Look for NOT — these are NC contacts

Example: Output = (A AND NOT B) OR (C AND D AND NOT E)

This is two parallel branches:

  • Branch 1: A (NO) in series with B (NC)

  • Branch 2: C (NO), D (NO), E (NC) all in series

Either branch energizes the output.

Key Takeaways

  • AND, OR, NOT are the only three operations you need — everything else is built from them

  • Series contacts = AND (all must be true)

  • Parallel branches = OR (any is sufficient)

  • NC contact = NOT (inverts the condition)

  • Every ladder rung is a Boolean equation in circuit form

  • De Morgan's theorem: NOT(A AND B) = (NOT A) OR (NOT B) — useful for simplification

Enable JavaScript to run the embedded simulator and complete the interactive exercises.