Skip to content
Tutorials Center
My learning

Topics

Lesson 11 of 37 ยท Ladder Logic

Latching and Seal-In Circuits

Learn how PLCs remember: the seal-in (holding) rung, set and reset coils, SR and RS flip-flops, stop priority and power-loss behaviour, with runnable C simulations.

A push button is momentary: you press it and release it. But a motor must keep running after you let go of Start. The program therefore needs memory, a way to hold an output on until something tells it to stop. This is the most fundamental ladder pattern, and you will use it in nearly every machine.

This lesson covers the two ways to latch (the seal-in rung and the set/reset coils), how to decide which input wins when both are active, and what happens after a power loss.

The seal-in rung

The classic start/stop rung comes straight from relay panels. A contact of the output itself is placed in parallel with the Start button, so once the output is on, it holds itself on.

TEXT
|--+--[ Start ]--+--[ Stop_OK ]--( Motor )--|
|  |             |
|  +--[ Motor ]--+

Here Stop_OK is a normally-closed stop button seen as 1 at rest (an NO contact in the program). The logic:

Motor = (Start OR Motor) AND Stop_OK

Step by step:

  1. Press Start: the top path is true, Motor turns on.
  2. Release Start: Motor's own contact is true, so the path stays closed.
  3. Press Stop: Stop_OK becomes 0, the rung breaks, Motor drops, and the seal-in contact opens. Releasing Stop does not restart the motor.

Seal-in, step by step

Press Start Motor turns on
Release Start Motor holds itself on
Press Stop Rung breaks, motor off

The output feeds its own rung

1 / 2
C Stand-in: seal-in start/stop over several scans (C)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

In scan 6 both buttons are pressed together and the motor stays off. Because the Stop contact is in series with everything, Stop has priority. That is the safe default.

Set and reset coils

Many PLCs also give you set (latch) and reset (unlatch) coils. ( S ) turns a bit on and leaves it on when the rung goes false; ( R ) turns it off.

TEXT
|--[ Start ]--( S Motor )--|
|--[/ Stop_OK ]--( R Motor )--|

Two separate rungs, one for each action. Which one wins if both rungs are true in the same scan? The one that comes later in the program, because the second write overrides the first. So placing the Reset rung after the Set rung gives Stop priority; reversing them gives Start priority.

C Stand-in: set/reset priority depends on rung order (C)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

SR and RS flip-flops

IEC 61131-3 offers ready-made function blocks: SR (set dominant) and RS (reset dominant). They have two inputs and one output Q1.

TEXT
(* Reset dominant: RS *)
Latch(SET := Start, RESET1 := Stop);
Motor := Latch.Q1;
  • SR: if both inputs are 1, the output is 1 (Set dominates).
  • RS: if both are 1, the output is 0 (Reset dominates). Prefer RS for motors.
C Stand-in: SR and RS flip-flop behaviour (C)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Row 4 (both inputs on) is where they differ.

Seal-in or set/reset?

Style Strength Weakness
Seal-in rung Easy to read, no extra instructions, one coil The bit follows the rung, so a power-up with Start held may restart
Set/Reset Clear "events", good for states and alarms Two places write the bit; order decides priority; harder to trace

A common team rule is: use seal-in for motors and outputs, use set/reset for alarms, mode flags and step states.

Latches and power loss

A normal bit loses its value on power loss, so a seal-in motor stays off after power returns, which is usually what you want (no unexpected restart). If you make the latch bit retentive, the machine can restart by itself. Do that only on purpose and with a safe restart procedure, see PLC memory and tags.

An unexpected restart can injure people. Never use retentive latches for motors or hazardous machinery unless a risk assessment says it is safe.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In a seal-in rung, what keeps the motor on after Start is released?

    The output's own contact forms a holding path.
  2. 2. A reset-dominant latch with both inputs on gives:

    Reset dominates, so the output is off.
  3. 3. Set and reset rungs are both true. Which wins in ladder?

    The last write in the scan decides, so rung order sets the priority.
  4. 4. Why is a retentive motor latch risky?

    After a power cycle the retained bit is still on, which can restart machinery unexpectedly.

Summary

  • A seal-in rung holds an output with its own contact: Out = (Start OR Out) AND Stop_OK.
  • Set/reset coils and SR/RS blocks latch too; rung order or block type decides priority.
  • Give Stop priority, and avoid retentive motor latches.
  • Next you will detect a button press rather than a button state.

Next: Edge Detection and One-Shots