Module 06 · Ladder logic basics

Start/stop, latching & interlocks

A push button is only pressed for a moment, but the motor must keep running. This module builds the most important circuit in industrial control, the seal-in, then set/reset coils and the interlocks that stop two outputs fighting each other.

≈ 40 min6 lessons1 hands-on labQuiz · pass 80 %Free

By the end of this module you can

  • Build a start/stop seal-in circuit with a fail-safe NC stop button
  • Choose between stop-dominant and start-dominant logic
  • Use latch and unlatch (set/reset) coils, and predict which wins
  • Add interlocks so that forward and reverse can never be on together
  • Write these circuits on Siemens, Rockwell, Mitsubishi and IEC PLCs

Put a contact of the output itself in parallel with the start button. Once the motor is on, that contact keeps the rung true after START is released: the rung seals itself in. The stop button, in series, breaks the seal.

Here the STOP button is a real NC device: its input Stop_PB_OK is 1 while nobody presses it, so the program uses a normally open contact (module 05). The trace shows the last 10 seconds.

Why NC?If the stop button's wire breaks, Stop_PB_OK drops to 0 and the motor stops, exactly as if STOP were pressed. With an NO stop button a broken wire would leave you with no way to stop the motor from that button.

What should happen if START and STOP are pressed at the same time? Where you put the stop contact decides it:

Machine control is almost always stop-dominant (A). Start-dominant logic has niche uses, such as a fire pump that must run while its start signal is present.

Instead of a seal-in, you can use two coils on the same bit: a latch (set) coil turns the bit on and leaves it on, an unlatch (reset) coil turns it off. Neither writes anything when its rung is false.

  • Put the reset rung after the set rung so that stop/reset wins when both are true.
  • A latched bit stays on even if the PLC goes through power-off, if its memory is retentive. Rockwell OTL bits in a normal tag keep their value through a power cycle; Siemens bits keep their value only if the memory area or DB is set retentive; Mitsubishi M relays are cleared at power-on but L (latch) relays are kept. Logivyx Soft-PLC tags are retentive by default. Decide on purpose what a latched output does after a power failure: usually it should not restart by itself.
  • Seal-in or latch? The seal-in drops out by itself when any condition in series fails, which is safer for motors. Latches are handy for alarms ("remember until acknowledged") and for sequence flags.

A reversing motor has two contactors. If both close, they short-circuit two phases. The program must make that impossible: each direction gets a normally closed contact of the other in series, an interlock. (The real panel also has a mechanical interlock and auxiliary-contact interlocks in the contactor wiring; the program is the third layer.)

The XIO contacts on the opposite push button give "push-button interlocking": pressing REV drops forward, and because rung 1 is solved first, reverse starts in the same scan. That direct reversal is fine for a demo but hard on gearboxes and contactors: real machines add a pause before reversing, which you can build with a timer after module 08.

// Seal-in
Motor := (Start_PB OR Motor) AND Stop_PB_OK;

// Set / reset with function blocks
Latch1(SET := PB_Set, RESET1 := PB_Reset);   // RS instance: reset dominant
Pump := Latch1.Q1;

IEC 61131-3 has SR (set dominant: inputs SET1, RESET) and RS (reset dominant: inputs SET, RESET1) function blocks; the input with the 1 wins. In the Logivyx Ladder Designer use Coil — Latch (OTL) and Coil — Unlatch (OTU); rung order decides which wins. In Logivyx ST write IF PB_Set THEN Pump := TRUE; END_IF; and IF PB_Reset THEN Pump := FALSE; END_IF;.

   "Start_PB"    "Stop_PB_OK"     "Motor"
--+---| |---+------| |---------( )--
  | "Motor" |
  +---| |---+

   "PB_Set"                       "Pump"
-----| |-----------------------( S )--
   "PB_Reset"                     "Pump"
-----| |-----------------------( R )--

TIA Portal LAD has Set output -(S)- and Reset output -(R)-, plus the flip-flop boxes SR (reset dominant) and RS (set dominant): the letter written last wins. Note this is the opposite naming to the IEC SR/RS blocks. Also SET_BF/RESET_BF for bit fields. In SCL: IF "PB_Set" THEN "Pump" := TRUE; END_IF;

BST XIC Start_PB NXB XIC Motor BND XIC Stop_PB_OK OTE Motor
XIC PB_Set OTL Pump
XIC PB_Reset OTU Pump

OTL/OTU bits are retentive: after a power cycle or a program-to-run change, a latched bit is still 1. Clear such bits on the first scan (S:FS first-scan bit) if the machine must not restart by itself.

LD   X0          ; Start_PB
OR   Y0          ; seal-in with Motor
AND  X1          ; Stop_PB_OK (NC button)
OUT  Y0          ; Motor

LD   X2          ; PB_Set
SET  M10         ; Pump flag
LD   X3          ; PB_Reset
RST  M10

SET/RST on M relays are cleared at power-on; on L relays (latch relays) they survive power loss. The last executed of SET and RST wins.

Use PLC_Trainer. PB1 = START, PB3 = FORWARD, PB4 = REVERSE, PB2 = alarm test, and SW1 stands for the NC stop circuit: switch on = healthy, stop not pressed. Rename the widget captions to match.

Lab

L06_Motor

  1. New ladder routine L06_Motor. Rung 1: Parallel Branch (XIC PB1 / XIC Q1), then XIC SW1 → OTE Q1. Comment: "Motor seal-in, SW1 = stop circuit OK".
  2. Rung 2 (forward/reverse): forward = PB3 with seal-in on Q2, XIC SW1, XIO PB4, XIO Q3 → OTE Q2.
  3. Rung 3: the mirror image for reverse with PB4 → OTE Q3.
  4. Rung 4: XIC PB2 → Coil — Latch Q4. Rung 5: XIO SW1 → Coil — Unlatch Q4. (Q4 is an alarm lamp that stays on until the stop circuit is opened.)
  5. In Main, call L06_Motor instead of the previous lab. Validate, save.
  6. Run (F5) with SW1 on. Check: PB1 starts Q1 and it keeps running; switching SW1 off stops it; Q2 and Q3 can never be on together.
  7. Swap rungs 4 and 5 (drag or cut/paste), run again and hold PB2 with SW1 off. Explain what changed.