Table of Contents
ToggleEvery ladder rung is a Boolean expression, so each gate maps to a simple pattern of contacts in series or parallel. Below you will find all seven patterns with truth tables, field examples and a quick checker for rung outputs.
See how each Boolean gate becomes a ladder rung made of normally open and normally closed contacts. You also get truth tables, a worked XOR example, a gate output checker and a troubleshooting flowchart.

What are logic gates in PLC ladder logic and how are they drawn?
Logic gates in PLC ladder logic are Boolean functions built from contacts on a rung. Contacts in series make AND, contacts in parallel make OR, and an XIO (normally closed) contact makes NOT. For example, A = 1 and B = 0 gives AND = 0, OR = 1 and XOR = 1. NAND, NOR, XOR and XNOR are combinations of these three basic patterns.
What Are Logic Gates in PLC Ladder Logic?
The term logic gates in PLC ladder logic means drawing Boolean functions such as AND, OR and NOT with contacts and coils instead of chip symbols. The PLC solves each rung like a relay circuit, and the coil turns on only when a continuous path of true contacts connects the left rail to the right rail.
- Series contacts give AND, parallel branches give OR.
- An XIO (examine if open) contact gives NOT.
- NAND, NOR, XOR and XNOR are built from those three patterns.
- A two input truth table has 4 rows; three inputs give 8 rows.
- The rung output is held in the output image until the next scan writes it again.
If you already know the chip version from digital logic gates, the ladder version is the same truth table drawn as switches. The table below maps each gate to its rung pattern and to the Boolean algebra expression the PLC is really solving.
| Gate | Ladder pattern | Boolean |
|---|---|---|
| AND | XIC A in series with XIC B | Q = A AND B |
| OR | XIC A in parallel with XIC B | Q = A OR B |
| NOT | Single XIO A | Q = NOT A |
| NAND | XIO A in parallel with XIO B | Q = NOT (A AND B) |
| NOR | XIO A in series with XIO B | Q = NOT (A OR B) |
| XOR | Two branches: A NOT B, NOT A B | Q = A XOR B |
| XNOR | Two branches: A B, NOT A NOT B | Q = NOT (A XOR B) |
Ladder diagrams copied the relay control drawings that electricians already used in the 1960s, which is why the first PLCs were sold as relay panel replacements. The rails still represent the control supply, even though the PLC only solves the logic in memory.
What Is the Difference Between XIC and XIO?
XIC (examine if closed) is true when its bit is 1, and XIO (examine if open) is true when its bit is 0. They test the bit in memory, not the field switch.
Rockwell names them XIC and XIO, while Siemens and the IEC 61131 3 standard call them normally open and normally closed contacts. You will find the same symbols in every vendor listed under IEC 61131 3 programming languages.
- True when the input or memory bit is 1
- Used for AND and OR building blocks
- Used with an NC stop button so a broken wire stops the machine
- Drawn as two plain vertical bars
- True when the bit is 0
- Used to make NOT, NAND and NOR
- Easy to confuse with a physical NC field contact
- Drawn with a slash across the bars
Before you choose XIC or XIO, look at the input LED with the switch in its normal state. If the LED is on when nothing is happening, the bit is 1 at rest and the logic must be written for that.
How Do You Write an AND Gate in Ladder Logic?
You write an AND gate by placing two XIC contacts in series on one rung so both must be true before the coil turns on. OR uses the same contacts on parallel branches, and NOT uses a single XIO contact in front of the coil.

These are the first rungs in most ladder logic for beginners lessons. Most of the PLC ladder logic examples you see in plant software are long AND chains with a few OR branches for alternatives.
How to Make an XOR Gate in Ladder Logic
You make an XOR gate with two parallel branches: XIC A with XIO B on the first, and XIO A with XIC B on the second. NAND, NOR and XNOR are built the same way, by mixing XIO contacts with series and parallel paths.
Two XIO contacts in parallel. The coil is on unless both inputs are 1.
Two XIO contacts in series. The coil is on only when both inputs are 0.
Branch 1 is XIC A and XIO B, branch 2 is XIO A and XIC B. The coil is on when the inputs differ.
Branch 1 is XIC A and XIC B, branch 2 is XIO A and XIO B. The coil is on when the inputs match.
XOR = (A AND NOT B) OR (NOT A AND B)
= (1 AND 1) OR (0 AND 0)
= 1 OR 0 = 1
NAND = NOT (1 AND 0) = NOT 0 = 1
NOR = NOT (1 OR 0) = NOT 1 = 0
De Morgan rules are why a NAND rung uses parallel XIO contacts and a NOR rung uses series XIO contacts. Many controllers also offer a word level XOR instruction, and Rockwell documents a bitwise XOR for comparing whole DINT tags in its general instructions manual.
Truth Tables for Every Ladder Gate
A truth table lists every input combination and the coil state for each one, which makes it the quickest way to prove a rung works. Two inputs give 4 rows, and each extra input doubles the rows because the count is 2 to the power n.

During each scan the PLC solves rungs from top to bottom and left to right. That order is explained in how the PLC scan cycle works and it decides which rung wins when two rungs write the same coil.
Field Examples of Each Gate
In plants the gates rarely appear alone, but each has a clear job. These examples come from pump skids, conveyors and valve stations.
The XNOR valve fault above needs a delay, so pair the rung with PLC timer instructions such as TON. When an alarm list grows, the NAND pattern combines nicely with a first out alarm rung that records which permissive dropped first.
Why Is a Stop Button Wired NC but Programmed XIC?
A stop button is wired normally closed so the input is 1 when everything is healthy, and the program uses XIC so the rung stays true until someone presses stop. If the wire breaks, the input drops to 0 and the motor stops, which is the safe direction.
This start stop rung is an OR (start or seal in) in series with an AND (stop healthy), so it is really a small gate circuit. Emergency stops must still follow emergency stop push button rules from ISO 13850, which call for direct opening contacts and a stop that does not depend only on standard PLC logic.
Troubleshooting Gate Rungs That Do Not Work
When a gate rung fails, the program is usually asking about the wrong bit state and the Boolean logic itself is fine. Work through the flowchart from the field device back to the coil.

| Symptom | Likely cause | Fix |
|---|---|---|
| Coil on when it should be off | XIO used where XIC was needed | Check input LED at rest and swap the contact |
| Coil flickers or ignores a rung | Same coil written on two rungs | Keep one OTE per coil, combine conditions with OR |
| Input LED on, tag stays 0 | Wrong address or module not configured | Compare the I/O tree with the wiring list |
| No input LED at all | Sinking and sourcing mismatch or no 24 V | Measure at the terminal and check the common |
A missing input LED is often a common wiring issue, so recheck sinking and sourcing before you blame the program. For the output side, compare the load with the PLC output module types to confirm the card can switch it.
When a rung must react to a button press only once, add a one shot instead of making the gate more complex. It keeps the Boolean logic easy to read during night shift faultfinding.
Ladder Gate Review Checklist
Run through this checklist before you download a new rung. Each item matches a fault we see on site.
- Each input checked at rest with the LED and the online tag value
- XIC or XIO chosen for the bit state, not for the switch symbol
- Only one output coil instruction per tag
- Truth table tested row by row with forces or a simulator
- Stop and trip inputs wired NC and programmed XIC
- Timers added where a gate checks moving equipment
- Rung comment states the Boolean expression in words
Once your gate rungs are clear, move to one shot instructions and compare instructions which feed bits into the same patterns. You can practise all of it for free with free PLC programming software.
Logic Gates in PLC Ladder Logic FAQ
XIC is true when its bit is 1 and XIO is true when its bit is 0. Neither instruction describes the field switch; they only test the bit stored in memory.
So an NC stop button that reads 1 when healthy is normally programmed with XIC, and the machine stops when the bit drops to 0.
Draw two parallel branches: XIC A with XIO B on top and XIO A with XIC B below. The coil turns on when the inputs differ.
With A = 1 and B = 0 the top branch is true, so XOR = 1. With both inputs at 1 neither branch is true and the coil is off.
Place two XIO contacts in parallel before the coil. By De Morgan, NOT (A AND B) equals NOT A OR NOT B, so the coil is on unless both inputs are 1.
A common use is an alarm that lights as soon as any one of two permissives is lost. Add more parallel XIO branches for more inputs.
A three input rung needs 8 rows because the count is 2 to the power n. Two inputs give 4 rows and four inputs give 16 rows.
Test each row online with forces or a simulator and write down the coil state. Any row that does not match the expected result points to a wrong contact type.
The most common cause is an XIO contact where an XIC was needed, so the rung is true while the input is 0. A second cause is the same coil written on another rung.
Check the input LED at rest, then search the program for every place that tag is used as an output coil.
Ladder is better for simple bit gates because maintenance staff can watch power flow online. Structured text suits long expressions and word level operations such as bitwise XOR.
Many plants use ladder for interlocks and permissives, then structured text for calculations. Pick what your site team can troubleshoot at night.
Related Articles
- Digital Logic Gates Explained
- PLC Ladder Logic Examples
- Ladder Logic for Beginners
- Boolean Algebra Explained
- How the PLC Scan Cycle Works
External References
- Rockwell Automation: Logix 5000 Controllers General Instructions Reference Manual (PDF)
- Automation Community: Gate Logic using PLC Program
- Wikipedia: Ladder logic
What We Learn Today
- We learned how logic gates in PLC ladder logic map to contacts: series rungs for AND, parallel branches for OR, XIO contacts for NOT.
- We built NAND, NOR, XOR and XNOR from those three patterns using De Morgan rules and a worked example with A = 1 and B = 0.
- We saw why a stop button is wired NC but programmed XIC, and how to troubleshoot a coil that stays off using a simple flowchart.

