PLC start/stop in Ladder (seal-in circuit)
The start/stop circuit is the "hello world" of PLC programming. A Start button switches a motor contactor on, it stays on after the button is released, and a Stop button switches it off. With relays this is the self-holding circuit. On a PLC the same logic is written as one Ladder rung, and the buttons and the contactor are only wired to inputs and outputs.
In this tutorial you wire a Siemens S7-1200 CPU 1214C in Virtuino Circuits, write the rung, and test it in simulation. The same steps work for LOGO!, S7-200 and Modicon M221: only the address spelling changes (see the table at the end).
Open the ready-made circuit in the simulator
Inputs and outputs
| Device | Contact | PLC address (S7-1200) |
|---|---|---|
| S0 Stop | NC push button | %I0.0 |
| S1 Start | NO push button | %I0.1 |
| F2 Overload | NC contact 95-96 | %I0.2 |
| K1 Motor contactor | coil | %Q0.0 |
| H1 Run lamp | lamp | %Q0.1 |
Step 1: wire the PLC
- Place the PLC. Open the app, start a blank drawing, open the PLC group and place a PLC. In its properties choose S7-1200 CPU 1214C. The symbol shows the real terminal blocks and LEDs.
- Supply. Connect the supply terminals of the PLC to L1 and N (230 V AC).
- Input supply. The digital inputs need 24 V DC. Place L+ and M (24 V DC) and connect the input common 1M to M.
- Buttons. From L+, wire S0 (NC) to input .0, S1 (NO) to input .1, and the overload contact 95-96 to input .2.
- Outputs. The outputs are relay contacts. Connect the output common 1L to L1 (through a fuse), then output .0 to the coil of K1 and output .1 to lamp H1. Wire the other ends to N.
Step 2: write the Ladder rung
Double-click the PLC (or click Ladder program… in its properties) to open its Ladder editor. Draw this rung:
%I0.1 Start %I0.0 Stop %I0.2 OL %Q0.0 K1
|-----| |-------+-----------| |-----------| |-------------( )---|
| |
%Q0.0 K1 |
|-----| |-------+
%Q0.0 K1 %Q0.1 H1
|-----| |---------------------------------------------( )---|
- Place a NO contact with address %I0.1 (Start).
- Below it, place a NO contact with address %Q0.0, and wire it in parallel with Start. This is the seal-in (latching) contact: the output keeps itself on.
- In series, place a NO contact %I0.0 (Stop) and a NO contact %I0.2 (overload).
- End the rung with a coil %Q0.0. Add a second rung with a NO contact %Q0.0 and a coil %Q0.1 for the lamp.
Step 3: simulate
- Press
F5. Input LEDs .0 and .2 light, because S0 and the overload contact are closed. - Click S1. Input .1 lights, the rung conducts and is drawn in red in the Ladder window, output .0 switches K1, and the motor contactor pulls in. Release S1: %Q0.0 keeps itself on through the seal-in contact.
- Click S0: input .0 goes to 0, the rung opens and K1 drops out.
- Change the Stop contact in Ladder to NC and try again, to see the mistake described above.
The same with Set and Reset
Instead of a seal-in contact you can use two rungs: %I0.1 → (S) %Q0.0 and NOT %I0.0 → (R) %Q0.0. Both are correct. Put the Reset rung last, so that Stop wins when both buttons are pressed: the PLC executes the rungs from top to bottom, and the last write in the scan decides the output.
Addresses on other PLCs
| PLC | Stop | Start | Motor |
|---|---|---|---|
| S7-1200 | %I0.0 | %I0.1 | %Q0.0 |
| S7-200 | I0.0 | I0.1 | Q0.0 |
| LOGO! 8 | I1 | I2 | Q1 |
| Modicon M221 | %I0.0 | %I0.1 | %Q0.0 |
LOGO! 230RCE inputs take 230 V AC instead of 24 V DC; the simulator reports a wrong input voltage if you mix them up.
Next steps
- Forward/reverse on a PLC with an interlock in Ladder.
- The Ladder editor: all instructions and models.
