HMI Engineering · Lab Manual

HMI Buttons, Status Lamps and Auto/Manual Mode in TIA Portal: Lab Manual

Buttons send requests; the PLC decides; lamps tell the truth. This lab manual builds a pump faceplate through all six stages: field selector, overload and level switches, input mapping, a UDT command interface with mode handling and a feedback status word, the HMI tags and animations, and a live simulator where a failed contactor exposes a lamp that lies.

2,500+ engineers trained 4.9/5 Google rating 21+ years, Chinchwad, Pune Next batch: contact for dates
Quick answer

Send every HMI command into an interface data block, never to an output. Use SetBit for commands the PLC clears after one evaluation, SetBitWhileKeyPressed for hold-to-run, SetValue for mode requests. Keep the active mode in the PLC and drive lamps from a status word built from feedback, never from the command bit.

  • Commands go from the panel into an interface DB; the PLC decides what to do with them.
  • A lamp that follows the command bit lies to the operator; drive it from feedback.
  • Mode is a machine state: requested by the HMI, decided and echoed back by the PLC.

The HMI to PLC Command Interface

A panel should never write directly to a physical output. If a button writes to %Q2.0, the machine loses every interlock in the PLC program, and a communication fault can leave the output in an unknown state. Instead, each device gets an interface data block built from one UDT: a Cmd part written by the HMI and a Sts part written by the PLC.

System functionBehaviourUse for
SetBitSets the bit; the PLC clears it after evaluatingStart, Stop, Reset
SetBitWhileKeyPressedBit true only while the button is heldJog, inch, hold-to-run
ResetBitSets the bit to falseClearing a latched request
InvertBitToggles the bit each pressLamp test, screen options – never machine start
SetValueWrites a fixed numberMode request, speed preset

Lab Flow: From Field Selector to a Tested Faceplate

Lab manual flow: field input to tested HMI screenSix stages: field device and PLC tag, input mapping to DB_IO, PLC logic, HMI tags, graphics linking, and perform and test.1Field + tags%I5.0 .. %I5.4selector, OL, levels2Input mappingFC_InputMapping→ DB_IO3LogicFB_Pumpmode, one-shot, status4HMI tagsDB_P1_Cmd / _StsUDT_MotorHMI5GraphicsFaceplatebuttons, lamp6Perform + testSimulatorlocal, trip, K20Address rule for every lesson: %I only in FC_InputMapping, %Q only in FC_OutputMapping, symbolic DB members everywhere else – including the HMI.
Figure 1 – Six-stage lab flow for buttons, lamps and auto/manual mode.

Stage 1Field Wiring and PLC Tag Table

PLC tagAddressTypeDevice
S50_Remote%I5.0BoolLocal/remote selector, 1 = REMOTE (HMI control)
P1_Running%I5.1BoolContactor K20 auxiliary, 1 = pulled in
LSL_Low%I5.2BoolLow level switch, 1 = level below
LSH_High%I5.3BoolHigh level switch, 1 = level reached
P1_Overload_OK%I5.4BoolMPCB auxiliary, NC, 1 = healthy
K20_P1%Q2.0BoolPump contactor coil

Stage 2Input Mapping into DB_IO

// FC_InputMapping – pump P1
"DB_IO".S50_Remote     := "S50_Remote";
"DB_IO".P1_Running     := "P1_Running";
"DB_IO".LSL_Low        := "LSL_Low";
"DB_IO".LSH_High       := "LSH_High";
"DB_IO".P1_Overload_OK := "P1_Overload_OK";

Stage 3Logic: Interface UDT, Mode and Status Word

// UDT_MotorHMI – one interface per device, reused for every motor
Cmd : Struct          // written by the HMI, cleared by the PLC after evaluation
    Start, Stop, Reset : Bool;
    ModeReq            : Int;    // 1 = AUTO, 2 = MANUAL, 0 = no request
END_STRUCT;
Sts : Struct          // written by the PLC, read by the HMI
    ModeActive         : Int;    // 1 = AUTO, 2 = MANUAL
    RunCmd, Running, Faulted, Ready : Bool;
    StatusWord         : Int;    // 0 stopped, 1 running, 2 fault, 3 local, 4 starting
END_STRUCT;
// DB_P1 (DB70) : UDT_MotorHMI
// FB_Pump – instance "IDB_P1"; STAT: tFb : TON_TIME; FaultCode : Int;
IF "DB_IO".S50_Remote THEN                                   // HMI commands only in REMOTE
    IF "DB_P1".Cmd.ModeReq <> 0 AND NOT "DB_P1".Sts.RunCmd THEN
        "DB_P1".Sts.ModeActive := "DB_P1".Cmd.ModeReq;       // mode change only when stopped
    END_IF;
    IF "DB_P1".Cmd.Reset AND "DB_IO".P1_Overload_OK THEN #FaultCode := 0; END_IF;
    IF "DB_P1".Sts.ModeActive = 2 THEN                        // MANUAL
        IF "DB_P1".Cmd.Start AND #FaultCode = 0 THEN "DB_P1".Sts.RunCmd := TRUE; END_IF;
        IF "DB_P1".Cmd.Stop THEN "DB_P1".Sts.RunCmd := FALSE; END_IF;
    END_IF;
END_IF;
"DB_P1".Cmd.Start := FALSE;  "DB_P1".Cmd.Stop := FALSE;      // one-shot: PLC clears the commands
"DB_P1".Cmd.Reset := FALSE;  "DB_P1".Cmd.ModeReq := 0;

IF "DB_P1".Sts.ModeActive = 1 AND "DB_IO".S50_Remote THEN    // AUTO: fill between LSL and LSH
    IF "DB_IO".LSL_Low AND #FaultCode = 0 THEN "DB_P1".Sts.RunCmd := TRUE; END_IF;
    IF "DB_IO".LSH_High THEN "DB_P1".Sts.RunCmd := FALSE; END_IF;
END_IF;

IF NOT "DB_IO".P1_Overload_OK THEN #FaultCode := 1; END_IF;
#tFb(IN := "DB_P1".Sts.RunCmd AND NOT "DB_IO".P1_Running, PT := T#2S);
IF #tFb.Q THEN #FaultCode := 2; END_IF;
IF #FaultCode <> 0 THEN "DB_P1".Sts.RunCmd := FALSE; END_IF;

// Status for lamps – from FEEDBACK, never from the command
"DB_P1".Sts.Running := "DB_IO".P1_Running;
"DB_P1".Sts.Faulted := #FaultCode <> 0;
"DB_P1".Sts.Ready   := NOT "DB_P1".Sts.Faulted AND "DB_IO".S50_Remote;
IF "DB_P1".Sts.Faulted THEN "DB_P1".Sts.StatusWord := 2;
ELSIF "DB_P1".Sts.Running THEN "DB_P1".Sts.StatusWord := 1;
ELSIF "DB_P1".Sts.RunCmd THEN "DB_P1".Sts.StatusWord := 4;
ELSIF NOT "DB_IO".S50_Remote THEN "DB_P1".Sts.StatusWord := 3;
ELSE "DB_P1".Sts.StatusWord := 0;
END_IF;

// FC_OutputMapping
"K20_P1" := "DB_P1".Sts.RunCmd;

The overload fault could also be one bit of the alarm word from HMI alarm configuration, and the start condition can include the permissives from PLC interlocks and permissives.

Stage 4Link DB_P1 to HMI Tags

HMI tagPLC memberUsed by
DB_P1_Cmd_Start, _Stop, _Reset"DB_P1".Cmd.*Buttons ⑤ ⑥
DB_P1_Cmd_ModeReq"DB_P1".Cmd.ModeReqAUTO / MANUAL buttons ④
DB_P1_Sts_StatusWord"DB_P1".Sts.StatusWordLamp ①, status text ② (text list TL_Status)
DB_P1_Sts_ModeActive"DB_P1".Sts.ModeActiveMode field ③, button highlight
DB_P1_Sts_Ready"DB_P1".Sts.ReadyControl enable animations

Stage 5Buttons, Lamps and Animations

Pump faceplate layoutStatus lamp, status text, active mode, mode buttons, command buttons and reset on a faceplate.Pump P1RUNStatusRunning (feedback confirmed)Mode (from PLC)AUTOAUTOMANUALSTARTSTOPRESET123456
Figure 2 – Pump P1 faceplate. Build it once as a faceplate in the project library and reuse it for every motor.
#ObjectAnimation / propertiesTag / event
①Circle + text field lampAppearance, multiple ranges on StatusWord: 0 white STOP, 1 dark RUN, 2 red outline TRIP (flashing), 3 grey LOCAL, 4 white STARTDB_P1_Sts_StatusWord
②Symbolic output fieldText list TL_Status with the five statesDB_P1_Sts_StatusWord
③Symbolic output fieldText list AUTO / MANUALDB_P1_Sts_ModeActive
④Buttons AUTO / MANUALAppearance: highlighted when active; Control enable when REMOTEClick: SetValue ModeReq = 1 / 2
⑤Buttons START / STOPSTART enabled only in MANUAL and ReadyClick: SetBit Cmd_Start / Cmd_Stop
⑥Button RESETAuthorisation OperatorClick: SetBit Cmd_Reset

Colour rules for running, stopped and fault states follow HMI screen design best practices: red stays reserved for the fault, running is shown by fill and text.

Stage 6Perform and Test: Animated Pump Faceplate

Pump P1 fills a tank. In AUTO the PLC runs it between the low and high level switches; in MANUAL the operator uses START and STOP. Switch the field selector to LOCAL and the HMI commands are ignored. Trip the overload or make the contactor fail, then compare a lamp driven by the command with a lamp driven by feedback.

Tank, pump and PLC
HMI · Pump P1 faceplate
Pump P1No active alarms
STOP
Status
Mode (from PLC)
AUTO mode: the pump fills the tank whenever the level falls to LSL and stops at LSH.

Troubleshooting Buttons and Lamps

SymptomLikely causeFirst check
Start works once, then never againPLC does not clear Cmd.Start, or HMI uses InvertBitOne-shot clearing in FB_Pump
Lamp shows RUN but pump standsLamp linked to the commandLink to StatusWord / feedback
Mode jumps back after panel restartMode stored on the HMIModeActive must live in the PLC
Buttons do nothing in the fieldSelector in LOCALDB_IO.S50_Remote
Lamp blank in one stateA range missing in the appearance animationOne range per StatusWord value

Hands-On Lab: Pump Faceplate with Auto/Manual Mode

Hands-on
Before you start
  • TIA Portal with WinCC Comfort and a panel or PLCSIM + HMI simulation
  • Selector switch and push buttons on the trainer kit, or simulated inputs
  • Estimated time: 75 minutes
1

Wire the pump signals and map PLC tags

Declare S50_Remote, P1_Running, P1_Overload_OK, LSL_Low and LSH_High as inputs and K20_P1 as output in the PLC tag table.

Every pump signal appears once in the tag table.
2

Map inputs into DB_IO

Copy the five inputs into DB_IO in FC_InputMapping.

DB_IO follows each field contact.
3

Create UDT_MotorHMI, DB_P1 and FB_Pump

Define the command and status structure, then write mode handling, one-shot command evaluation, auto level control, fault latching and the status word.

Commands are cleared by the PLC in the scan they are evaluated.
4

Link DB_P1 to HMI tags

Drag DB_P1 into the HMI tag table and create the text list for the status word.

HMI tags such as DB_P1_Sts_StatusWord exist with the right data types.
5

Build the faceplate graphics

Add AUTO, MANUAL, START, STOP and RESET buttons with SetValue and SetBit events, a lamp with a multi-range appearance animation on the status word, and Control enable animations.

The lamp shows five distinct states and buttons are disabled when not allowed.
6

Perform and test

Run AUTO and MANUAL, switch LOCAL, trip the overload and fail the contactor; confirm the lamp always shows what the pump really does.

With K20 failed the lamp never shows RUN; after a fault only RESET with a healthy overload restarts.
Checkpoint—how to know you did it right

Commands only reach the pump through the PLC, mode is decided in the PLC, the lamp always shows what the pump is really doing, and LOCAL disables every HMI command.

Frequently asked questions

Should an HMI button write directly to a PLC output?

No. Write to a command bit in an interface data block and let the PLC program apply interlocks and mode conditions before it drives any output.

What is the difference between SetBit and SetBitWhileKeyPressed?

SetBit sets the bit and leaves it set until something resets it. SetBitWhileKeyPressed holds the bit true only while the operator keeps the button pressed, which suits jog and hold-to-run functions.

Why does my lamp turn on even though the motor did not start?

The animation is almost certainly linked to the command bit. Link it to the running feedback or to a status word the PLC sets after confirming the contactor auxiliary contact.

Where should the auto and manual mode be stored?

In the PLC. The panel sends a request and displays the active mode returned by the controller, so a communication loss or a panel restart cannot leave the machine in an unclear state.

Who clears an HMI command bit?

The PLC, in the same scan in which it evaluates the command. The panel uses SetBit, the PLC acts once and resets the bit, so a command can never stick on after a communication drop.

What does a local/remote selector do for HMI control?

It is a field switch that decides who may command the device. In LOCAL the PLC ignores all HMI commands and the panel disables the buttons; in REMOTE the HMI commands are evaluated.

Reviewed by Bhawesh Kumar SinghIndustrial Automation Trainer and Industry 4.0 Consultant · Softwell Automation · 21+ years industry experience

Get the full syllabus + free demo class

Share your details—a Softwell training advisor will contact you with batch dates, fees and hardware-practice options.

No spam. Used only to share course details for this enquiry.

Learn with practical industrial examples

Join live online, Pune classroom or corporate in-plant automation training.

Request Course Details
Verified learning pathway

Discuss HMI Buttons and Lamps

Explore practical curriculum, software, hardware and batch options for this technology.

Content reviewed: 16 October 2026

Siemens PLC & TIA Portal Learning Path

Continue with the related Siemens PLC tutorials in this practical learning series.

  1. SCL vs Ladder Logic
  2. Upload PLC Program
  3. TIA Selection Tool
  4. Analog Input Scaling
  5. PLC Counters
  6. PLC Timers
  7. Addressing & Data Types
  8. Hardware & PLC Tags
  9. OB, FB, FC & DB
☎ Call WhatsApp ✉ Email Enquire Now