Ladder logic: contacts, coils, timers and counters

Ladder logic: NO/NC and edge contacts, output and set/reset coils, Boolean equivalence, seal-in and interlock rungs, IEC TON/TOF/TP/retentive timers and CTU/CTD counters with timing-diagram examples.

Drafted with Aria, reviewed by the AiCanCode.org team. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Ladder Diagram (LD) is still the most widely used PLC language because it reads like the relay wiring diagrams electricians already know. Start/stop circuits, interlocks, delays and batch counts — the bread and butter of machine control — are all written with contacts, coils, timers and counters, and interviewers routinely ask candidates to draw them and trace their timing.

Key ideas

Structure. Two vertical power rails with horizontal rungs between them. Each rung has conditions (contacts) on the left and an action (coil or function box) on the right. The PLC evaluates rungs top to bottom, each from left to right, once per scan, using the input image table.

Contacts examine bits; they are not the field device.

  • Normally open (NO) contact, "examine if closed": passes power when its bit is 1.
  • Normally closed (NC) contact, "examine if open": passes power when its bit is 0.
  • Edge contacts (P / N, or one-shots): pass power for one scan on a 0→1 or 1→0 transition. The same bit can be used in any number of contacts.

Coils write bits.

  • Output coil: bit = 1 while the rung is true, 0 when false.
  • Set (latch) / Reset (unlatch) coils: set holds the bit at 1 until a reset coil clears it — retained even when the set rung goes false.
  • Use each ordinary output coil only once in a program; if it appears on two rungs, the last rung executed decides the output.

Logic. Contacts in series = AND; in parallel = OR; NC contact = NOT. Any Boolean expression can be drawn as a ladder rung.

Seal-in (latching) circuit. Start (NO) in parallel with a contact of the motor's own output bit, in series with Stop and overload conditions: Motor = (Start + Motor) · Stop_OK · OL_OK Pressing Start energises Motor; the Motor contact holds it after Start is released; opening the stop circuit drops it. The stop push-button is wired normally closed in the field (fail-safe: a broken wire stops the machine), so its input bit is 1 when healthy and the program uses an NO contact for it.

Interlocks. Forward and reverse contactors each carry an NC contact of the other in their rung so they can never be on together (backed up by mechanical/electrical interlocks in the panel).

Timers (IEC 61131-3 names). Inputs IN and PT (preset time); outputs Q and ET (elapsed time).

  • TON (on-delay): Q becomes 1 when IN has been continuously 1 for PT; IN going 0 resets ET and Q at once.
  • TOF (off-delay): Q becomes 1 as soon as IN = 1, and stays 1 for PT after IN goes 0; if IN returns before PT ends, the timing restarts later.
  • TP (pulse): on a rising edge of IN, Q is 1 for exactly PT, whatever IN does meanwhile.
  • Retentive on-delay (RTO/TONR): accumulates time over several ON periods; only a reset instruction clears it. Older PLCs give presets as a number of time-base units (e.g. preset 50 with 0.1 s base = 5 s). Timer resolution is limited by the time base and the scan time.

Counters. Count rising edges of their count input (not the time the input is on).

  • CTU: CV increases on each rising edge of CU; Q = 1 when CV ≥ PV; R resets CV to 0.
  • CTD: CV decreases on each rising edge of CD; Q = 1 when CV ≤ 0; LD loads PV.
  • CTUD: up and down inputs, with QU (CV ≥ PV) and QD (CV ≤ 0). Counting is limited by the scan time — fast pulses need a high-speed counter.

Formulas

Rung = AND of series contacts, OR of parallel branches

  • e.g. Y = (A + B) · C̄: A and B in parallel, then an NC contact of C in series.

Motor = (Start + Motor) · Stop_OK · OL_OK

  • Seal-in equation; Stop_OK = 1 when the NC stop button is not pressed.

t_set = PV × t_base

  • Timer delay (s) = preset value (counts) × time base (s).

Q_TON = 1 when IN has been 1 continuously for t ≥ PT Q_TOF = 1 from IN↑ until PT after the last IN↓ Q_CTU = 1 when CV ≥ PV

Worked examples

Example 1 (standard). Write the rung for a lamp L that is on when (A OR B) is on and C is off. Then find the output for A = 0, B = 1, C = 0 and for A = 1, B = 0, C = 1.

  1. Equation: L = (A + B) · C̄.
  2. Ladder: NO contacts A and B in parallel, in series with an NC contact of C, driving coil L.
  3. A = 0, B = 1, C = 0: (0 + 1) · 1 = 1 → lamp on.
  4. A = 1, B = 0, C = 1: (1 + 0) · 0 = 0 → lamp off.

Example 2 (GATE level). Input I is ON from t = 0 to 8 s, OFF from 8 to 10 s, and ON from 10 to 20 s, then OFF. It drives (a) a TON with PT = 5 s, (b) a TOF with PT = 3 s, (c) a TP with PT = 4 s, (d) a retentive on-delay timer with PT = 10 s (never reset), (e) a CTU with PV = 2. Find when each output is ON.

  1. TON: ON at 0 + 5 = 5 s until I drops at 8 s; reset; ON again at 10 + 5 = 15 s until 20 s. → Q = 1 for 5–8 s and 15–20 s.
  2. TOF: Q = 1 from 0 s. At 8 s timing starts, but I returns at 10 s (only 2 s < 3 s), so Q stays 1. At 20 s timing restarts; Q drops at 23 s. → Q = 1 from 0 to 23 s.
  3. TP: rising edges at 0 s and 10 s → Q = 1 for 0–4 s and 10–14 s.
  4. Retentive: 8 s accumulated by t = 8 s; holds 8 s during the gap; needs 2 s more → Q = 1 from 12 s onward (until reset).
  5. CTU: rising edges at 0 s (CV = 1) and 10 s (CV = 2 ≥ PV) → Q = 1 from 10 s (until reset).

Common mistakes

  • Using an NC program contact for a stop button that is already wired NC in the field — the machine then cannot start.
  • Thinking an NO contact means "the field switch is NO"; it only tests whether the bit is 1.
  • Writing the same output coil on more than one rung.
  • Forgetting that a TON resets completely if IN drops before PT — only retentive timers accumulate.
  • Mixing up TOF and TP behaviour.
  • Expecting a counter to count while its input stays ON; it counts rising edges only.
  • Latching an output with Set and never providing a Reset path, including after power failure.

For GATE ME

Expect conversion between Boolean expressions and ladder rungs, tracing outputs of a given rung for input combinations, and timing-diagram questions on on-delay, off-delay and pulse timers and up/down counters. Practise drawing timing diagrams for timers with interrupted inputs and writing seal-in and interlock rungs from a verbal description.

Quick check

  1. Write the Boolean equation of a seal-in motor circuit.
  2. A TON has preset 50 with a 0.1 s time base. What is the delay?
  3. A TON (PT = 6 s) sees its input ON for 4 s, OFF, then ON for 7 s. When does Q first come on?
  4. A CTU (PV = 5) input pulses 7 times. What are CV and Q?
  5. Which timer keeps its output ON for a fixed time after the input turns OFF?

Answers: 1. Motor = (Start + Motor) · Stop_OK · OL_OK 2. 5 s 3. 6 s into the second ON period 4. CV = 7, Q = 1 5. TOF (off-delay)

Try answering each one aloud before you open it.

  1. 1.What is ladder logic and where is it commonly used?Concept

    Ladder logic is a programming language used to develop software for programmable logic controllers (PLCs) used in industrial automation. It is called 'ladder' logic because the program resembles a ladder with two vertical rails and a series of horizontal rungs between them. Each rung represents a rule or operation. It is commonly used in manufacturing and process control industries due to its simplicity and ease of understanding for those familiar with electrical control systems.

  2. 2.Explain the function of contacts and coils in ladder logic.Concept

    In ladder logic, contacts represent the conditions that need to be met for an action to occur. They can be normally open (NO) or normally closed (NC). Coils represent the outputs or actions that occur when the conditions are met. When the logic flow reaches a coil, it energizes or de-energizes an output device, such as a motor or light. Contacts and coils together form the basic building blocks of ladder logic programs.

  3. 3.How do timers work in ladder logic, and what are their types?Concept

    Timers in ladder logic are used to introduce delays in the operation of a control system. They can be used to delay the activation or deactivation of an output. The main types of timers are ON-delay timers, which delay the activation of an output, and OFF-delay timers, which delay the deactivation of an output. Timers are crucial for processes that require precise timing sequences.

  4. 4.What is the purpose of counters in ladder logic?Concept

    Counters in ladder logic are used to count events or operations. They can count up, count down, or do both. Counters are often used in applications where a specific number of operations need to be performed before an action is taken, such as counting the number of items on a conveyor belt before packaging. They help in managing repetitive tasks efficiently.

  5. 5.Why is ladder logic preferred in industrial automation over other programming languages?Application

    Ladder logic is preferred in industrial automation because it is easy to understand and resembles electrical relay logic diagrams, which many technicians and engineers are familiar with. This makes it easier to troubleshoot and modify. Additionally, ladder logic is highly visual, which aids in understanding complex control processes. Its widespread use in PLCs also ensures compatibility and ease of integration in industrial environments.

  6. 6.What happens if a normally closed contact is used instead of a normally open contact in a ladder logic program?Application

    If a normally closed (NC) contact is used instead of a normally open (NO) contact, the logic of the program will be inverted for that particular condition. An NC contact allows current to flow until the condition is met, at which point it opens and stops the current flow. This could lead to unintended operations, such as an output being deactivated when it should be activated, potentially causing process errors or safety issues.

  7. 7.How can you implement a simple start-stop motor control circuit using ladder logic?Application

    To implement a start-stop motor control circuit using ladder logic, you would use a start button (NO contact), a stop button (NC contact), and a motor coil. The start button is connected in parallel with a holding contact (also NO) that is controlled by the motor coil. Pressing the start button energizes the motor coil, which closes the holding contact, maintaining the circuit even after the start button is released. Pressing the stop button breaks the circuit, de-energizing the motor coil and stopping the motor.

  8. 8.An ON-delay timer in a ladder program is set to 5 s. How long after its input turns ON does the output turn ON, and how accurate is that?Numerical

    Nominally 5 s: the TON's output turns on only after its enable input has been continuously true for the preset, and if the input drops earlier the elapsed time resets. In practice the delay is quantised by the timer's time base (e.g. preset 50 × 0.1 s) and by the scan, because the timer is updated and its output acted on only when the rung is scanned, so the real delay can be up to about one time base plus one or two scans longer. For tight timing use a faster time base, a periodic task or a hardware timer.

  9. 9.If a counter in a ladder logic program is set to count up to 10, what happens when it reaches this count?Application

    When a counter in a ladder logic program is set to count up to 10, it will activate its output once the count reaches 10. This means that the counter has counted 10 events or operations, and the output condition associated with the counter will be met. The counter can then be reset to start counting again, depending on the program's requirements.

  10. 10.A ladder logic program uses an OFF-delay timer set to 3 seconds. What is the effect of this timer on the output?Application

    An OFF-delay timer set to 3 seconds will keep the output active for 3 seconds after the input condition is no longer met. This means that even if the input condition changes to deactivate the output, the output will remain active for an additional 3 seconds before turning off. This is useful in applications where a delayed shutdown is required.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?