Ladder Diagram Tutorial: From First Rung to Full Motor Control Program
This is a free printable ladder diagram tutorial: download the diagram as SVG or open it and print to paper or PDF.
This ladder diagram tutorial teaches you to read and write PLC ladder logic from scratch — no prior programming experience needed, only a basic understanding of electrical circuits (voltage, current, normally-open and normally-closed switches). By the end you will have built a complete 10-rung motor control program covering Boolean logic, seal-in circuits, forward/reverse interlocks, on-delay and off-delay timers, a batch counter, and a process alarm — the exact patterns that appear on every industrial plant floor.
## Prerequisites — What You Need to Know First
You need to understand three electrical concepts before ladder logic makes sense. First: a normally-open (NO) contact passes current only when its actuating coil or mechanism is energised. Second: a normally-closed (NC) contact passes current in its rest state and opens when energised — this is the basis of fail-safe wiring. Third: a contactor coil is an electromagnet that closes the main power contacts when energised. These physical concepts map directly to XIC, XIO, and OTE instructions in ladder logic.
You do not need to know any programming language. Ladder logic uses graphical symbols, not text, and the logic is the same boolean algebra an electrician learns on day one.
## PLC Ladder Diagram Basics: Rails, Rungs, Contacts, Coils
Every ladder program lives inside a PLC (Programmable Logic Controller), which continuously reads its inputs, evaluates the program, and writes its outputs in a repeating loop called the scan cycle. A ladder program is organised into **rungs** — horizontal lines that span from a left power rail to a right power rail, exactly like the rungs of a ladder.
On each rung, **contacts** represent conditions: the state of physical inputs (buttons, sensors, limit switches) or internal memory bits. An **XIC (Examine If Closed)** contact, drawn -| |-, is like a normally-open switch: TRUE when its bit is 1. An **XIO (Examine If Open)** contact, drawn -|/|-, is like a normally-closed switch: TRUE when its bit is 0. Logic flows from left to right: if a continuous TRUE path exists across the rung, the **output coil** on the right is energised.
The **OTE (Output Energize)** coil -( )- sets its bit to 1 while the rung is TRUE and automatically clears to 0 when the rung goes FALSE. The **OTL/OTU (Latch/Unlatch)** pair — also called SET/RESET — is retentive: OTL sets the bit and it stays set until OTU clears it, regardless of rung state. This is used when an output must stay energised after the command signal disappears.
## Complete Ladder Logic Symbols Reference Table
See the specifications section for a full 15-entry symbol reference covering XIC, XIO, OTE, OTL, OTU, TON, TOF, RTO, CTU, CTD, ONS, GEQ, EQU, ADD, and RES — each with its symbol, full name, and truth behaviour.
## How the PLC Scan Cycle Executes Your Program
The PLC scan cycle is the heartbeat of ladder execution and has four phases:
**Input Scan** — The processor reads every physical input terminal into an input image table. This snapshot is frozen for the rest of the scan.
**Program Scan (Logic Solve)** — Every rung is evaluated top to bottom. The processor reads the input image table, executes the boolean logic, and writes results to the output image table. This is the Result of Logic Operation (RLO) on Siemens platforms. No physical output changes yet.
**Output Scan** — The output image table is copied to the physical output terminals, energising or de-energising field devices.
**Housekeeping** — Internal diagnostics, network communications, and online-edit processing.
Typical scan times are 1–20 ms for industrial programs. The practical consequence: a sensor signal must be present for at least one full scan to be reliably detected. Signals shorter than the scan time require hardware interrupts or one-shot (ONS/OSR) instructions.
## How to Read Ladder Logic in 5 Steps
Step 1: Identify the output. Look at the rightmost instruction on the rung — this is what the rung controls.
Step 2: Read conditions from left to right. Each -| |- contact asks 'is this bit 1?' and each -|/|- asks 'is this bit 0?'.
Step 3: Identify series vs parallel structures. Contacts in a straight horizontal line are AND (all must be TRUE). Contacts on stacked parallel branches are OR (any one path TRUE is enough).
Step 4: Look for cross-references. The output bit of one rung often appears as an XIC contact on a downstream rung — this is how timer outputs, counter outputs, and internal flags chain together.
Step 5: Read the comments. Well-written industrial programs comment every rung with a plain-language description of what it does. Trust the comment; verify the logic.
## Tutorial Part 1 — Boolean Logic: AND, OR, NOT Rungs
**AND rung example:** A safety interlock requires both a guard closed limit switch (I:0/2) AND the start pushbutton (I:0/0) to be active before the output (O:0/0) can energise. Rung: XIC I:0/0 [series] XIC I:0/2 — OTE O:0/0. Both contacts in series — both must be TRUE.
**OR rung example:** A process alarm should fire if either a high-temperature sensor (I:0/3) OR a high-pressure sensor (I:0/4) activates. Rung: XIC I:0/3 [parallel branch over] XIC I:0/4 — OTE Alarm B3:0/1. Either parallel branch TRUE energises the output.
**NOT rung example:** An output should de-energise when a fault bit (B3:0/7) is set. Rung: XIO B3:0/7 — OTE Enable O:0/5. The XIO evaluates TRUE only when the fault bit is 0 — as soon as the fault bit sets to 1, the XIO opens and the output de-energises.
## Tutorial Part 2 — The Seal-In (Latch) Circuit
The start/stop seal-in circuit is the most important pattern in all of ladder logic. The I/O allocation is: I:0/0 = Start (NO pushbutton), I:0/1 = Stop (NC pushbutton, wired NC to input), I:0/2 = Overload relay contact (NC, wired NC), O:0/0 = Motor contactor.
Rung 1 (Motor Run): XIC I:0/0 [parallel branch: XIC O:0/0] — XIO I:0/1 — XIC I:0/2 — OTE O:0/0.
Operation: Pressing Start (I:0/0 = 1) gives a TRUE path; Motor (O:0/0) energises. The seal-in contact XIC O:0/0 immediately closes in parallel — now there are TWO paths to keep the rung TRUE. Releasing Start (I:0/0 = 0) does not matter because the seal-in path is still TRUE. Pressing Stop temporarily drives I:0/1 = 0 (NC button opened), so XIO I:0/1 sees bit 0 — TRUE — wait, this needs clarification: the Stop button is physically wired NC to the input. When NOT pressed: field circuit is closed → input module reads 1 → I:0/1 bit = 1. XIO I:0/1 is TRUE when bit = 0. When Stop IS pressed: field circuit opens → I:0/1 bit = 0 → XIO I:0/1 opens → rung FALSE → motor de-energises. If the Stop button wire breaks: I:0/1 bit = 0 → XIO opens → motor stops. This is the fail-safe principle — a broken wire produces a safe state.
## Tutorial Part 3 — Forward/Reverse Interlock
A forward/reverse motor control is one of the most common industrial patterns. The interlocking prevents the Forward and Reverse contactors from energising simultaneously — if both closed, you would create a three-phase short circuit.
Rung 1 (Forward): XIC Fwd_Start (I:0/3) [parallel: XIC Fwd_Run B3:0/0] — XIO Stop (I:0/1) — XIO Reverse_Run (B3:0/1) — OTE Fwd_Run (B3:0/0) — OTE Fwd_Contactor (O:0/1).
Rung 2 (Reverse): XIC Rev_Start (I:0/4) [parallel: XIC Rev_Run B3:0/1] — XIO Stop (I:0/1) — XIO Forward_Run (B3:0/0) — OTE Rev_Run (B3:0/1) — OTE Rev_Contactor (O:0/2).
The XIO Forward_Run contact on the Reverse rung — and the XIO Reverse_Run contact on the Forward rung — are the software interlocks. If Forward is running (B3:0/0 = 1), the Reverse rung's XIO B3:0/0 is FALSE, making it impossible to energise the reverse contactor while forward is active. Most industrial panels add a mechanical interlock on the contactors as a second, hardware-level safety measure.
## Tutorial Part 4 — Timers (TON and TOF) with Worked Examples
**TON — Pump start delay (10 seconds):** A pump must not start until 10 seconds after a high-level sensor activates, to confirm the reading is genuine and not a float bounce.
Rung 4: XIC Level_High (I:0/5) — TON T4:0 PRE=10000 (10,000 ms = 10 s, time base 1 ms). Rung 5: XIC T4:0/DN — OTE Pump (O:0/1).
While I:0/5 is TRUE, T4:0.ACC counts up each scan (approximately 1 ms per count). At 10,000 counts the DN (Done) bit T4:0/DN sets to 1, energising the Pump output on Rung 5. If Level_High goes FALSE before the 10 seconds elapses, the TON resets ACC to 0 and the pump never starts.
**TOF — Cooling fan run-on (30 seconds):** The cooling fan must continue running for 30 seconds after the motor stops, to prevent heat build-up in the motor enclosure.
Rung 6: XIC Motor_Run (O:0/0) — TOF T4:1 PRE=30000. Rung 7: XIC T4:1/DN — OTE Fan (O:0/2).
While Motor_Run is TRUE, T4:1/DN is immediately 1 (TOF's DN is ON while rung is TRUE). When Motor_Run goes FALSE, the TOF starts counting. After 30 seconds the DN bit clears, and the fan stops on Rung 7. During those 30 seconds the fan remains running even though the motor is off.
## Tutorial Part 5 — Counters (CTU/CTD) with Worked Example
**CTU — Batch counter, stop conveyor after 100 parts:**
Rung 8: XIC PartSensor (I:0/7) — CTU C5:0 PRE=100. Rung 9: XIO C5:0/DN — OTE Conveyor (O:0/3). Rung 10 (Reset): XIC CycleStart (I:0/6) — RES C5:0.
Every time a part breaks the photosensor beam (FALSE-to-TRUE transition of I:0/7), C5:0.ACC increments by 1. When ACC reaches 100, C5:0/DN sets to 1. On Rung 9, XIO C5:0/DN opens, de-energising the Conveyor. On Rung 10, when the operator presses the CycleStart button for the next batch, the RES instruction clears C5:0.ACC to 0 and resets the DN bit, allowing the conveyor to start again.
## Tutorial Part 6 — Comparison and Math Instructions
Comparison instructions allow analog sensor values (temperature, pressure, level as 0–32767 integer counts from an analog input module) to be used as ladder logic conditions.
Example — Temperature ON/OFF controller: Turn on a chiller (O:0/4) when temperature analog input N7:0 ≥ 750 counts (equivalent to 75.0°C on a 0–100°C / 0–10V transmitter with 10-bit ADC).
Rung: GEQ Source A=N7:0, Source B=750 — OTE Chiller (O:0/4).
The GEQ instruction evaluates TRUE when N7:0 is greater than or equal to 750, energising the chiller output. Add hysteresis by using a second rung with LEQ and a lower threshold (e.g., 700 counts) to turn the chiller off, preventing rapid cycling.
## Full Worked Program: 10-Rung Motor Control
I/O Table: I:0/0=Start (NO), I:0/1=Stop (NC), I:0/2=OL_Contact (NC), I:0/3=Fwd_Btn (NO), I:0/4=Rev_Btn (NO), I:0/5=Level_High, I:0/6=CycleStart, I:0/7=PartSensor, N7:0=Temp_AI; O:0/0=Motor, O:0/1=Fwd_Contactor, O:0/2=Rev_Contactor, O:0/3=Conveyor, O:0/4=Chiller; T4:0=Pump_Delay(PRE=10000), T4:1=Fan_Runon(PRE=30000); C5:0=PartCount(PRE=100); B3:0/0=Fwd_Run, B3:0/1=Rev_Run.
Rung 1 — Motor seal-in: XIC I:0/0 [||XIC O:0/0] — XIO I:0/1 — XIC I:0/2 — OTE O:0/0. (Comment: START/STOP with overload protection)
Rung 2 — Forward direction: XIC I:0/3 [||XIC B3:0/0] — XIO I:0/1 — XIO B3:0/1 — OTE B3:0/0 — OTE O:0/1. (Comment: FWD with reverse interlock)
Rung 3 — Reverse direction: XIC I:0/4 [||XIC B3:0/1] — XIO I:0/1 — XIO B3:0/0 — OTE B3:0/1 — OTE O:0/2. (Comment: REV with forward interlock)
Rung 4 — Pump delay timer: XIC I:0/5 — TON T4:0 PRE=10000. (Comment: 10 s confirmation delay on level sensor)
Rung 5 — Pump output: XIC T4:0/DN — OTE Pump O:0/1. (Comment: Pump starts after 10 s timer)
Rung 6 — Fan run-on timer: XIC O:0/0 — TOF T4:1 PRE=30000. (Comment: Fan run-on 30 s after motor stops)
Rung 7 — Fan output: XIC T4:1/DN — OTE O:0/2. (Comment: Fan remains on during run-on period)
Rung 8 — Part counter: XIC I:0/7 — CTU C5:0 PRE=100. (Comment: Count parts on conveyor)
Rung 9 — Conveyor run: XIO C5:0/DN — OTE O:0/3. (Comment: Stop conveyor when 100 parts reached)
Rung 10 — Counter reset: XIC I:0/6 — RES C5:0. (Comment: Reset count on cycle start)
This 10-rung program demonstrates every fundamental pattern: seal-in, interlock, TON, TOF, CTU, and reset. Practice it in circuitdiagrammaker's free ladder editor or OpenPLC — open the tool, build each rung, and simulate before you ever connect to real hardware.
## Ladder Logic Software: TIA Portal, Studio 5000, OpenPLC
For learning: **OpenPLC** is completely free, open-source, and runs in any browser or on a Raspberry Pi. It supports IEC 61131-3 ladder logic and includes a simulator. Download from autonomylogic.com.
**Siemens TIA Portal** is the professional environment for all S7-1200, S7-1500, and S7-300/400 controllers. The ladder language is called LAD. A 21-day full trial is available; PLCSIM allows simulation without hardware.
**Allen-Bradley Studio 5000** (ControlLogix / CompactLogix) is the dominant platform in North America. RSLogix Emulate provides software simulation. RSLogix 500 covers the older MicroLogix and SLC 500 platforms.
For documentation and quick drawings without installing any software, circuitdiagrammaker.com provides a free browser-based ladder diagram editor — draw rungs, label contacts and coils, and export to SVG or PDF for your project binder.
How to wire ladder diagram tutorial
- Start with a blank I/O table Before writing any rungs, build your I/O allocation table. List every physical input (pushbuttons, sensors, limit switches) and output (contactors, solenoids, indicator lights) with its PLC address, tag name, and whether it is wired NO or NC. This forces you to think about fail-safe wiring before you touch the software.
- Write a single AND rung As your first exercise, create one rung: XIC I:0/0 — XIC I:0/1 — OTE O:0/0. Simulate it. Confirm that O:0/0 only energises when BOTH I:0/0 AND I:0/1 are 1. This is AND logic — the foundation of series contacts.
- Add a parallel branch for OR logic Modify the rung to add a parallel branch: XIC I:0/2 in parallel with XIC I:0/0. Now O:0/0 energises if (I:0/0 OR I:0/2) AND I:0/1. Step through all four input combinations to verify.
- Build the start/stop seal-in circuit Create Rung 1 with XIC Start in series with XIO Stop, XIC OL_Contact, OTE Motor, plus XIC Motor in parallel with XIC Start as the seal-in. Test: press Start → motor ON; release Start → motor stays ON; press Stop → motor OFF. This is the most critical pattern in industrial PLC programming.
- Add a forward/reverse interlock Add two rungs — one for Forward, one for Reverse. Each rung must have an XIO contact referencing the other direction's output bit. Test that you cannot simultaneously energise both Forward and Reverse outputs under any combination of button presses.
- Add a TON timer Add a rung with a TON instruction. Set a meaningful preset (e.g., 5000 ms = 5 s). Add a second rung using the timer's DN bit as an XIC contact to drive an output. Observe the DN bit taking 5 seconds to set after the enable condition becomes TRUE. Monitor the ACC value to see it counting up.
- Add a CTU counter with reset Add a counter rung that increments on each sensor pulse. Add a second rung that XIO C5:0/DN to hold the conveyor output ON until the count is reached. Add a third rung with a RES instruction on the cycle-start button. Test full count cycle and reset.
- Document every rung with a comment In your programming software, add a plain-English comment above every rung before you declare the program complete. A rung comment like 'MOTOR RUN: Start seal-in with Stop NC and OL protection' lets any technician understand the logic without reading the contacts. This is a professional requirement, not optional.
- Simulate all failure modes Force individual input bits to 0 (simulating a broken wire or failed sensor) and verify that the machine goes to a safe state in every case. Force the Stop button to 0 — motor must stop. Force the OL contact to 0 — motor must stop. Force both Forward and Reverse start signals TRUE simultaneously — only one contactor should energise due to the interlock.
Specifications
| -| |- | XIC — Examine If Closed. Normally-open contact. TRUE when bit = 1. |
|---|---|
| -|/|- | XIO — Examine If Open. Normally-closed contact. TRUE when bit = 0. |
| -( )- | OTE — Output Energize. Non-retentive coil. Bit = 1 while rung TRUE, 0 when FALSE. |
| -(L)- | OTL — Output Latch (SET). Retentive. Sets bit to 1; remains 1 when rung FALSE. |
| -(U)- | OTU — Output Unlatch (RESET). Clears bit to 0 when rung TRUE. |
| TON | Timer On Delay. DN bit sets when ACC ≥ PRE (while rung continuously TRUE). ACC resets when rung goes FALSE. |
| TOF | Timer Off Delay. DN immediately ON when rung TRUE. Starts timing when rung FALSE; DN clears when ACC ≥ PRE. |
| RTO | Retentive Timer On. Accumulates time while rung TRUE; holds ACC when rung FALSE. Requires RES to clear. |
| CTU | Count Up. Increments ACC on each FALSE-to-TRUE rung transition. DN sets when ACC ≥ PRE. |
| CTD | Count Down. Decrements ACC on each transition. DN sets when ACC ≤ 0. |
| -|P|- | ONS / OSR — One-Shot Rising. TRUE for one scan per FALSE-to-TRUE transition. Prevents multi-scan counting. |
| GEQ | Greater Than or Equal. TRUE when Source A ≥ Source B. Used for analog setpoint comparisons. |
| EQU | Equal. TRUE when Source A = Source B. |
| ADD | Add. Computes Source A + Source B → Destination when rung TRUE. |
| RES | Reset. Clears ACC of timer (RTO) or counter (CTU/CTD) to 0 and resets DN bit when rung TRUE. |
Safety warnings
- Always implement E-stop and Stop circuits in both hardware AND software. A software-only stop can be defeated by a PLC program fault, communication failure, or online edit error. Safety-rated E-stops must pass through certified safety relays (e.g., Pilz PNOZ, Schmersal SD, Allen-Bradley GuardMaster) that directly cut power to the output circuit, independent of PLC logic.
- Never wire E-stops or safety guards as normally-open contacts at the field level. The NC fail-safe wiring principle is not optional — it is mandated by IEC 60204-1 (Electrical equipment of machines) and ISO 13849 for safety functions. A broken wire on an NC circuit produces a safe state; on an NO circuit, a broken wire is indistinguishable from a 'safe' condition.
- Test all failure modes in simulation before commissioning. Specifically: simulate a broken Stop button wire (force input bit to 0), simulate a failed sensor (force input to last known state), and simulate simultaneous competing commands (both Forward and Reverse pressed). The machine must go to a safe state in every scenario.
- When performing online edits on a live PLC, communicate with all operators at the machine. Online edits take effect at end of scan — outputs can change state unexpectedly. Isolate the machine to a safe state (motor stopped, valves closed) before editing any rung that controls a moving mechanism.
Tools needed
- Free ladder logic simulator: OpenPLC (autonomylogic.com) — IEC 61131-3 compliant, runs on Windows, Linux, macOS, and Raspberry Pi. Ideal for learning all examples in this tutorial without purchasing hardware.
- circuitdiagrammaker.com — free browser-based ladder diagram drawing tool. Draw rungs, label contacts and coils, and export SVG or PDF for documentation without installing any software.
- Siemens TIA Portal (21-day trial) or Allen-Bradley Studio 5000 (Rockwell Automation) — professional PLC IDEs with built-in simulation (PLCSIM / Emulate). Required for deploying to real Siemens or Allen-Bradley hardware.
- Spreadsheet application (Excel, Google Sheets, LibreOffice Calc) — for building I/O allocation tables. Every professional PLC project starts with a documented I/O list.
- Digital multimeter — for commissioning, verifying that physical input signals match PLC input image values, and for diagnosing field wiring faults during troubleshooting.
Common mistakes
- Placing the Stop button XIC (NO) instead of XIO (NC). A NO Stop button that fails open leaves the machine with no software stop capability — pressing the button opens the NC field circuit, driving the bit to 0, and the XIC contact opens — correct behaviour. Reversing the contact type inverts the logic entirely.
- Forgetting the seal-in contact on the Start rung — the motor only runs while the Start button is held, because as soon as it is released, the rung goes FALSE and the output de-energises.
- Missing the cross-interlock contacts on forward/reverse rungs — without XIO Fwd_Run on the Reverse rung (and vice versa), simultaneous button presses can energise both contactors, creating a phase-to-phase short circuit in the power circuit.
- Using TON timers with incorrect time-base units. Modern PLCs default to milliseconds; entering a preset of 10 when expecting 10 seconds gives 10 milliseconds. Always verify the time base in the instruction documentation and enter PRE=10000 for a 10-second delay on a 1 ms time base.
- Not resetting counters at the start of each production cycle. If the RES rung is missing, the counter accumulates across cycles, and the conveyor stops much sooner than expected after a restart.
- Ignoring first-scan initialisation. Latched outputs (OTL) that survived a power cycle from the previous run may energise immediately on PLC restart. Use a first-scan rung (S:1/15 in AB, StartupOK in TIA Portal) to reset all latched outputs to a known safe state.
Troubleshooting
- Rung shows TRUE in online monitoring but output field device does not activate
- Cause: The PLC logic is correct but the physical hardware circuit is faulty. Possible causes: blown output fuse, failed output transistor/relay on the I/O module, broken field wire, or the field device itself (contactor coil, solenoid) is open-circuit. Fix: Force the output bit to 1 in the data table using your programming software. If the field device still doesn't activate, the fault is outside the PLC. Measure voltage at the output terminal with a multimeter; check the output module status LED; verify field wiring continuity.
- Motor will not start — Start button pressed but rung stays FALSE
- Cause: One or more contacts in the Start rung are FALSE. Most common: Stop button wired as NO instead of NC (so its bit is 0 at rest, XIO opens), or overload relay contact wired NO (so its bit is 0 at rest, XIC opens). Fix: Online monitor shows contact states as shaded (TRUE) or unshaded (FALSE). Identify the unshaded contact blocking the path. Verify field wiring: is the Stop button NC? Is the OL contact NC? Correct the wiring or the contact type to match your intended logic.
- Timer done (DN) bit never sets
- Cause: The enable rung is not staying TRUE continuously. If any contact goes FALSE during the delay, the TON resets its ACC to 0 and restarts. The timer never accumulates enough time to reach PRE. Fix: In online monitoring, watch the timer's EN (enable) bit and ACC value simultaneously. If ACC resets mid-count, identify which contact goes FALSE and eliminate the intermittent condition — this may require a latch (OTL) on the timer enable signal.
- Forward/reverse interlock fails — both outputs energise simultaneously
- Cause: The XIO interlock contacts are missing from one or both rungs, or the wrong bit address was used (e.g., XIO referencing an input bit rather than the opposite output bit). Fix: Verify that the Forward rung has XIO Rev_Run (the Reverse output or flag bit) and the Reverse rung has XIO Fwd_Run. Use the cross-reference function to confirm both XIO contacts reference the correct tag. Add mechanical interlocks on the contactors as a hardware-level backup.
Frequently asked questions
What is the best way to learn ladder diagram programming?
Learn by doing. Install OpenPLC (free) or use circuitdiagrammaker's free ladder tool. Start with a simple start/stop seal-in circuit, then add timers, then counters. Write each program from an I/O table, not from an example — this forces you to design, not copy. Practice simulating failure modes: force Stop wires to open, force overload contacts, and verify the machine goes to a safe state.
How long does it take to learn ladder logic?
Most electrical technicians with basic relay-logic knowledge can write competent ladder programs for straightforward motor control within 2–4 weeks of focused practice. Mastering advanced topics — timers, counters, comparison instructions, state machines, and safe programming practices — typically takes 3–6 months of regular hands-on work. The learning curve is significantly shorter than software programming languages because the visual metaphor is rooted in electrical diagrams.
What are the 5 rules of ladder logic?
1. Logic flows left to right across a rung; power flows left to right. 2. Contacts in series implement AND logic; contacts in parallel branches implement OR logic. 3. Each rung must have exactly one output instruction (in basic programs); multiple outputs sharing the same address are forbidden with OTE. 4. The NC Stop button must be wired NC at the hardware level AND represented as XIO in the ladder for fail-safe operation. 5. The scan cycle evaluates rungs top to bottom — order matters for state machines and interlock logic.
What is the difference between XIC and XIO?
XIC (Examine If Closed) is the normally-open contact: it evaluates TRUE when its associated bit is 1 — i.e., when the physical device (button, sensor) is activated or energised. XIO (Examine If Open) is the normally-closed contact: it evaluates TRUE when its associated bit is 0 — i.e., when the physical device is at rest. Stop buttons and E-stops are always wired so their bit = 1 at rest, then the XIO contact passes current. When pressed, bit = 0 and XIO opens, cutting the rung.
Why must the stop button be wired normally closed?
When a Stop button is wired NC, the field circuit is closed (complete) under normal operation, and the PLC input reads 1. The Stop button's XIO contact is TRUE (passes) when bit = 1. If the wire breaks, the PLC input reads 0, the XIO contact opens, and the machine stops — a safe outcome. If you wired Stop as NO: a wire break leaves the bit at 0, the XIC contact stays open, and the stop circuit appears perpetually 'pressed' — but the real problem is that you have no way to stop the machine if the wire actually breaks.
What happens if I have two OTE coils with the same address?
Only the last OTE rung scanned determines the bit state. The first OTE rung's result is overwritten every scan. This means the first rung appears to do nothing, leading to confusing behaviour. The bug is subtle because online monitoring shows the first rung as TRUE, yet the output doesn't respond. Fix by using the programming software's cross-reference / duplicate-output report to detect conflicts, then merge conditions into one rung or use OTL/OTU pairs.
What is a rung in ladder logic?
A rung is a single horizontal logic statement in a ladder diagram — equivalent to one row of a truth table or one line of code. It spans from the left power rail to the right power rail and contains a combination of contacts (conditions tested) and an output instruction (action taken if conditions are met). Programs can have hundreds or thousands of rungs organised into routines (subroutines). Best practice is one output per rung for clarity.
Can I use ladder logic for motion control?
Basic motion control — start/stop a conveyor, energise a solenoid valve — is straightforward in ladder logic. For multi-axis coordinated motion (servo drives with position profiles, interpolated movement), ladder logic becomes impractical. Those applications use Function Block Diagram (FBD) with PLCopen motion control function blocks (MC_MoveAbsolute, MC_MoveVelocity, etc.) or Structured Text. Ladder logic is widely used to command motion states — start, stop, home, enable — while the servo drive handles the actual trajectory internally.
What PLC software is free to learn on?
OpenPLC (autonomylogic.com) is fully free and open-source, supports IEC 61131-3 including ladder logic, and includes a software simulator. CODESYS Runtime is free for personal use and runs on Windows or Linux. Siemens TIA Portal V18 offers a 21-day trial with PLCSIM simulation. For drawing and documenting ladder diagrams without a programming environment, circuitdiagrammaker.com's free browser-based editor is the quickest option.
What is the difference between ladder diagram and structured text?
Ladder diagram (LD) is a graphical language: you place contacts and coils visually on rungs. Structured text (ST) is a text-based language similar to Pascal: you write IF/THEN/WHILE statements. LD excels for discrete on/off control and is easily read by electricians during troubleshooting. ST excels for complex math, PID algorithms, array processing, and large programs. Both are defined by IEC 61131-3 and can coexist in the same PLC project. Most professionals recommend learning LD first.