Learn › Tutorials
Tutorial: the start/stop seal-in circuit
Press Start and a motor runs. Let go and it keeps running. Press Stop and it stops. This one rung, the seal-in circuit, is the most important pattern in ladder logic, and in this tutorial you'll build it and run it on a conveyor.
The problem it solves
Industrial push buttons are momentary: they're only "on" while your finger is on them. If you wire a Start button straight to a motor output, the motor runs only while the button is held, which is fine for a jog but useless for a conveyor that should run all shift.
The circuit needs a memory: once Start has been pressed, it should remember that the motor is supposed to run, until Stop is pressed. In the days of relay panels, electricians did this with an extra contact on the motor starter that "sealed in" around the Start button. Ladder logic copies the same idea, which is why it's still called a seal-in (or holding, or three-wire control) circuit.
What you need
Open the Playground. The conveyor scene's starter program is this exact circuit, so you can either study it or press New and build it yourself. These are the pieces:
| Tag | Type | Used for |
|---|---|---|
Start | BOOL | Green push button, normally open |
Stop | BOOL | Red push button, normally open (we'll change this later) |
Motor | BOOL | The conveyor's Forward bit |
In the simulator, place two push buttons and a conveyor. Give the green button the tag Start and the red one Stop, both set to Normally open (on while pressed). Select the conveyor and type Motor as its Forward bit. Add a box spawner on the first cell of the conveyor with an auto-drop interval of a few seconds, so you have something to watch.
Step 1: Start and Stop
Start with the obvious part: the motor should run when Start is pressed and Stop is not.
| Start Stop Motor |
|----] [---------]/[--------------------------( )----|
XIC Start is true while the button is pressed. XIO Stop is true while the Stop tag is off, that is, while nobody is pressing Stop. The two in series make an AND: Start pressed AND Stop not pressed. Run this and you'll see the conveyor only moves while you hold Start down.
Step 2: Seal it in
Now add the memory. Put a branch around the Start contact and, on the lower branch, an XIC Motor:
| Start Stop Motor |
|----] [----+----]/[--------------------------( )----|
| Motor | |
|----] [----+ |
To build the branch, select the Start contact and add a Branch (or press B), then drop an XIC on the new branch and type Motor as its tag. Make sure the branch closes back into the rung before the Stop contact, not after it.
How it works, scan by scan
- Idle. Start is off and Motor is off, so neither branch passes power. Motor stays off.
- You press Start. The top branch is true, Stop isn't pressed, so the rung is true and
OTE Motorturns Motor on. - The next scan. Now the
XIC Motoron the lower branch is true too, because Motor was turned on in the last scan. The rung has two paths to power. - You let go of Start. The top branch goes false, but the lower branch still passes power through Motor's own contact. The motor holds itself on. That's the seal.
- You press Stop.
XIO Stopgoes false, which breaks the rung no matter which branch has power. Motor turns off, so on the next scan its own contact is false too, and the seal is broken. Releasing Stop doesn't restart anything.
Notice that Stop wins if both buttons are pressed at once, because the Stop contact is in series with everything. That's deliberate: in a real machine, stop should always beat start.
The order the PLC solves things in is what makes this work. The output written on one scan is what the contacts read on the next. If that's fuzzy, read How a PLC scan cycle works.
Making Stop fail-safe
The circuit works, but real control panels wire the Stop button normally closed. Its contacts are closed (the input is on) when nobody touches it, and pressing it opens them. The reason is safety: if the wire to a normally open Stop button breaks, pressing Stop does nothing and the machine can't be stopped. If the wire to a normally closed Stop breaks, the input goes off, which looks exactly like pressing Stop, so the machine stops. A failure makes things safer, not more dangerous.
Try it: select the red button and change it to Normally closed (off while pressed). Run the program. The motor won't start at all, because the Stop tag is now on whenever the button isn't pressed, and XIO Stop is false.
The fix is to change the contact, not the wiring. Double-click the XIO Stop and type XIC:
| Start Stop Motor |
|----] [----+----] [--------------------------( )----|
| Motor | |
|----] [----+ |
This trips up a lot of beginners. XIC and XIO don't describe the physical button; they describe what state of the tag lets power through. A normally closed button's tag is on when it's healthy and not pressed, so you examine it for on. There's more about this in XIC and XIO.
Try it in the Playground
- Open the Playground with the conveyor scene and press Run.
- Click the green Start button once. Boxes start moving and keep moving after you let go.
- Click Stop. The belt stops with the boxes on it. Watch the rung's highlighted power flow change as you press each button.
- Hold Start and Stop together and confirm that Stop wins.
Extensions to try
- Automatic stop. Place a photo eye near the end of the belt with the tag
PE1and add anXIO PE1in series with Stop. The line now stops when a box reaches the end, like an accumulation point. Press Start again to release it. - A jog button. Add a third button,
Jog. Put anXIC Jogon another branch in parallel with Start, and anXIO Jogin series with theXIC Motorseal contact. Holding Jog runs the belt, but because Jog also opens the seal branch, the motor stops as soon as you let go. - Latch version. Rebuild the same behaviour with
OTL Motoron a Start rung andOTU Motoron a Stop rung, then compare the two (see OTL and OTU).
Common mistakes
- Branch around the wrong contact. If the seal branch also goes around Stop, Stop can never break the circuit.
- Sealing with the Start tag. The holding contact must read the output (
Motor), not the button. - Writing Motor on two rungs. A second
OTE Motorfurther down overwrites the first one every scan. Keep one output per tag.