Make an HMI button turn on a PLC output through a command bit

5 min read · Published November 9, 2026

The panel never writes the output. Give the button a tag that targets an internal bit such as C0, and let one ladder rung turn the output Y0 on from that bit. Prove the rung from the PLC programming software, then prove the button, then connect the load.

An HMI button turns on a PLC output by writing a bit the PLC program reads, never by writing the output itself. Give the button a tag that targets an internal bit, C0 in this setup, and let one ladder rung turn the output, Y0, from that bit. That is the whole trick, and it splits the job into three links you can test one at a time: panel to bit, bit to rung, rung to output.

The button writes a bit, and the rung drives the output

The ladder program owns the outputs. Ladder diagram is one of the languages defined in IEC 61131-3, the standard for PLC programming languages, and a program written in it evaluates every rung and writes the output image on each pass. A small controller clears a short program in under 10 ms per pass, so a value pushed straight at an output address such as Y2 survives one pass before the rung's own result replaces it. The reliable pattern is button, command bit, rung, output, in that order.

The tag is what tells the panel where to write. Its target address, C0 here, is the only point of the controller the panel project names, and the rung is what connects that point to Y0. Controllers name their internal memory differently; the pattern holds under any naming, one internal bit in, one output coil out.

The rung answers every scan, and where the panel's write lands inside that scan changes what the rung sees; what an HMI write changes in the PLC input scan covers that timing in detail.

What you need

  • The panel, its project software, and a driver set to the controller, port and station settings the installation actually uses.
  • The PLC programming software, online, watching C0 and Y0.
  • One internal bit (C0 in this setup) and one output (Y0).
  • A test load: an indicator lamp on Y0, or the output terminal with the machine load still disconnected.
  • Two paths into the controller where the hardware allows it: the programming software on one port and the panel on another, or one of them on the network. One serial port is one talker, so confirm any shared-port arrangement in the controller's own documentation before you rely on it.

Steps

  1. Write one rung in the PLC program: a normally open contact on C0 feeding the coil Y0. Change nothing else in the program for this test.
  2. Download the program to the controller and put it in run.
  3. From the programming software, change C0 to 1. Y0 turns on. Change C0 to 0. Y0 turns off.
  4. Repeat step 3 until both transitions are boring. If Y0 will not follow C0, stop here: the address, the rung or the output circuit is wrong, and no panel project will fix it.
  5. In the panel's project, set the driver to the actual controller and enter the port and station settings the installation uses.
  6. Create a tag whose target address is C0.
  7. Draw a button and bind it to that tag, with the action set to momentary: it writes 1 while the button is held and 0 when it is released. Keep set/reset and maintained styles out of the first test.
  8. Download the project to the panel and open the screen the button landed on.

How to check it worked

Hold the button down and watch C0 and Y0 in the programming software. While held, C0 reads 1 and Y0 reads 1, and the lamp on the test load is lit. On release, both return to 0.

Small controllers scan a short program in single-digit milliseconds, so Y0 trails the write by at most one scan. The larger part of any delay you see is the panel's poll interval for the tag, which the panel software sets and prints. A tag polled every 100 ms can add up to 100 ms at each end of the press.

When something misbehaves, the symptom sorts the fault:

  • C0 stays at 0. The write is not landing. Check the driver selection, the port and station settings, the tag target, and that the project on the panel is the one you edited.
  • C0 follows the button but Y0 stays off. The fault is on the PLC side: the rung is missing, the controller is out of run, or the output circuit is open.
  • C0 moves only when you lift your finger. Some panel software fires the button action on release because of how its touch handling works, so the write lands late by design. Press slowly and watch the bit to see which way yours behaves.

For how long a momentary bit lives across scans, see how many PLC scans a momentary button bit stays on.

Example: a bench lamp on Y0

A test bench: the lamp is wired to Y0 through its output circuit, the panel sits at the bench, and the program carries exactly one rung, C0 contact to Y0 coil. You press and hold the button for 2 seconds.

Moment C0 Rung Y0 Lamp
At rest 0 open 0 off
Button held 1 closed 1 on
Button released 0 open 0 off

The arithmetic: the lamp is on for exactly the hold time, 2 s, extended at the start by one scan, say 10 ms on a small controller, plus one poll cycle, say 100 ms, and trimmed the same way at release. Three watch items move in order, C0, then Y0, then the lamp. When both transitions repeat on demand, the path is checked link by link: panel to bit, bit to rung, rung to output.

Run this first test on the lamp or with the machine load disconnected; wire the real load in only after both transitions repeat, and bring the machine back under its normal restart procedure.

After the lamp test

Once the two-transition test repeats, the rung earns its real logic. Put the permissive contact, a guard switch or an enable input, in series with C0: the button can then turn Y0 on only while the input allows it, and the scan enforces that on every pass. Combining a physical input and the panel bit in one rung, so each source can turn the output off under its own conditions, is ordinary ladder work once the command bit pattern is in place.

When the output starts something that moves, keep the same order of operations: test writes to the PLC before anything moves.

The decision

Recommendation: tag the button to an internal command bit, C0 in this setup, and drive the output Y0 from one normally open contact on that bit. Prove both transitions from the PLC programming software before the panel is connected, put the panel on its own port or on the network, and run the first test on a lamp. Wire the machine load in only when the lamp test repeats on demand.

One boundary to keep straight: the operator panel is the machine's input device, and a signage screen is the opposite job. A digital signage display plays the content loaded on it and writes nothing to the controller, so it suits a wall notice board, not button presses. If the wall by the bench needs shift notes or status pages, our shop-floor screens are built for that.

Questions

Why does an output I write from the panel flip back off?

The value you write reaches the output address, then the next scan pass overwrites it with the rung's own result. A small controller finishes a pass in single-digit milliseconds, so a direct write shows for one pass at most before the ladder's answer returns. Write the bit the rung reads instead; the value holds because the rung agrees with it.

Do the programming software and the panel share one PLC port?

Treat the programming software and the panel as two separate talkers on the controller. Give each its own serial port, or put one of them on the network. One serial port serving two live masters is the arrangement to avoid unless the controller's own documentation provides for it. Keeping the programming software online to watch C0 and Y0 while you press the button is what makes the first test readable, so plan the ports before the test.

How does the panel know where Y0 is?

It never has to. The tag target is the only address in the panel project, C0 in this setup. The rung is what maps C0 to Y0, so moving the load to a different output is a ladder edit, and the panel project stays untouched.

Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.

Keep reading

Build your signAsk for a quote