In industrial automation, human-machine interfaces (HMIs) like WinCC are essential for controlling and monitoring PLCs efficiently. One common requirement is the ability to toggle outputs using simple ON and OFF buttons. In this tutorial, we will guide you through creating two mutually exclusive buttons in WinCC 7.5: pressing the ON button will activate a signal and automatically deactivate the OFF button, and vice versa. This approach ensures clear, intuitive control and reduces the risk of errors in operation.

Logic Overview for ON/OFF Buttons in WinCC 7.5
1. SCADA Side (WinCC 7.5)

  • The HMI will have two buttons: ON and OFF.
  • Each button sets its corresponding variable in the PLC when pressed.
  • The button color changes based on the variable feedback, giving a visual confirmation of the current state.

2. PLC Side (TIA Portal)

Since the control comes from the SCADA, the PLC only handles the mutual reset of the opposite button:

  • When the ON button is pressed (RTrig detected for ON), the PLC resets OFF → False.
  • When the OFF button is pressed (RTrig detected for OFF), the PLC resets ON → False.

This ensures that only one button is active at a time, preventing conflicting commands while keeping the SCADA interface intuitive.

PLC Side Implementation (TIA Portal) – DemoButton FB

1. Global DB Variables

Add two variables on a Global DB

  • on – Bool
  • off – Bool

These variables will receive signals from SCADA (WinCC) when the buttons are pressed.

2. Create a new Function Block (FB)

  • Create a new FB, e.g., demoButton.
  • Add a static array for the R_TRIGs

3. Call R_TRIG in SCL

  • For each element of the array, assign the corresponding variable to the CLK input:

4. Logic to reset the opposite button

With this setup:

  • Pressing the ON button automatically sets OFF to FALSE.
    Pressing the OFF button automatically sets ON to FALSE.
  • The R_TRIG ensures that the change occurs only when the button is pressed, not continuously.

5. Call demoButton Function Block in Main


If you found this helpful, please consider supporting with a small donation. Thank you!

Posted in

Leave a Reply

Discover more from PLC Steps - Your Guide to Industrial Automation

Subscribe now to keep reading and get access to the full archive.

Continue reading