Basic Projects #3 – Start/Stop with One Button – Set/Reset Logic on Siemens PLC

Controlling an output with a single button — press once to turn ON, press again to turn OFF — is a classic and very practical function in PLC programming. In this article, we’ll build exactly that: a Start/Stop toggle using one button, with a Set/Reset memory structure in TIA Portal on a Siemens S7-1200 PLC.


🔍 Why Use One Button for Start/Stop?

Using a single button to switch a device ON and OFF is:

  • ✅ Space-saving
  • ✅ Cost-effective (only one input needed)
  • ✅ Common in HMI screens, touch panels, and even physical controls

It requires a bit more logic than the basic LED-on-when-pressed example, but it’s a great intro to edge detection and memory bits.


🧰 What You’ll Need

  • Siemens S7-1200 CPU (e.g., 1212C or 1215C)
  • 24V pushbutton 🔘
  • 24V indicator light 💡 (or just use output LED on PLC)
  • 24V power supply ⚡
  • TIA Portal (V16 or newer) 💻

Wiring Setup

  • Button (Input): Connect to %I0.0
  • LED or Lamp (Output): Connect to %Q0.0

🧠 How the Logic Works

We will use:

  1. Edge detection → So the PLC only reacts when the button is pressed, not while it’s held down
  2. Memory bit (M) → To remember the ON/OFF state
  3. Set/Reset output → To turn the output ON or OFF based on memory state

🧑‍💻 TIA Portal Ladder Logic (LAD)

Step 1: Create a positive edge detection

| %I0.0 (Button) | ——[ ]——+——[R_TRIG]—— M0.0 (Button_Trigger)
  • R_TRIG is the rising edge detection (from the “Bit Logic” section).
  • Output: %M0.0 → We’ll use this as a trigger.

Step 2: Toggle memory bit with XOR (flip-flop)

| M0.0 (Trigger) | ——[ ]——+
|                |         |
| M0.1 (State)   |——[XOR]——+——( )—— M0.1 (Toggle_State)
  • %M0.1 is a memory bit that stores ON/OFF state.

Step 3: Control the output with memory bit

| M0.1 (Toggle_State) | ——[ ]——+——( )—— Q0.0 (LED)

Boom! 🎉 Press once → LED turns ON. Press again → LED turns OFF.


🧪 How It Works in Action

  • First press → Edge detected → memory bit %M0.1 becomes 1 → LED turns ON
  • Second press → Edge detected again → %M0.1 becomes 0 → LED turns OFF

This is the basis of many toggle functions in automation — from turning on a conveyor, to switching machine modes.


💡 Bonus Tips

  • You can use this logic for motors, pumps, or any actuator that needs ON/OFF toggle.
  • Want to add a reset after power loss? Use a retentive memory (%MR) instead of %M.
  • You can also extend this to an HMI by linking a screen button to %M0.0.

Conclusion

Using one button for Start/Stop toggle is a smart and flexible solution in automation. With edge detection and a simple XOR flip-flop, your Siemens S7-1200 can now handle smart ON/OFF control with ease. 💪

Next time we’ll look at:

  • ⏲️ Adding a delay (TON) before output activates
  • 🔐 Adding safety interlocks to this logic
  • 📱 Controlling it from an HMI or remote panel

Previous Article

Basic Projects #2 - LED Control with Button on Siemens PLC 💡

Next Article

Basic Projects #4 -Start/Stop with Two Buttons on Siemens PLC 🟢🔴

Write a Comment

Leave a Comment

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Subscribe to our Newsletter

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨