IMDTouchKnowledge BaseShop main store

How-to

Activate Outputs From an HMI Screen Instead of Wired Inputs

HMI and touchscreens Published 6 min read

Short answer

Drive each output from its own controller output bit, written by the program or by a button object on the HMI touch screen — never by looping through a physical input. Use a motion-synchronized on command (M62) when the action must follow motion timing, an immediate command (M64) when it must switch now, and a toggle or momentary screen button for operator control. Wire buttons to inputs only where a function must work with the screen down.

On this page
  1. Why a wired button on an input is the wrong path
  2. Pick the control path for each function
  3. Build the button and the logic behind it
  4. Sizing the button panel for two clamps, a stop cylinder and six functions
  5. Commission before the valve carries load
  6. Questions asked

You do not need a wired button on an input for every output you want to switch by hand. Give each actuator its own controller output and drive that output from software: a motion-synchronized command (M62) or an immediate command (M64) in the machine program when the action belongs to the cycle, or a toggle or momentary button object on the HMI touch screen when an operator controls it. The screen button writes a state bit in the controller, the program gates the physical output from that bit, and the output drives the solenoid valve through a relay module. Nothing loops through an input. A wired button costs one input per output and only reports that a contact is made — on a panel that wants six output buttons, that is six inputs spent to switch six outputs you already own.

Why a wired button on an input is the wrong path #

A physical button wired to a controller input is a read, not a write. The input tells the program that a contact is made; it never activates anything, and your logic still has to do the work. Every manual function added this way consumes one input for an output you already own, and it only operates while the contact is physically made.

Writing that input from the screen is not an escape route either. The field device drives the input, so the screen's write loses the fight — the pattern is worked through in why an HMI toggle switch cannot write a physical PLC input. The supported paths all write in the other direction: program commands or screen buttons write bits, and bits drive outputs.

Pick the control path for each function #

Classify every actuator before you place a single object on the screen. A function that belongs to the machining cycle gets a program command; a function the operator triggers gets a screen button; a function that must work with the screen dark keeps wired hardware. Machine controllers that use this M-code set split the on commands in two: M62 turns a digital output on synchronized with motion, so the activation lands where the motion timing needs it, and M64 turns it on immediately, at the program line that executes it.

Control path Use it when It costs
M62, on synchronized with motion the action must line up with motion timing, such as a clamp closing during the approach 1 output, a program line
M64, on immediately the output must switch now, at that program line 1 output, a program line
Toggle button on the screen the operator sets a state and it holds until changed 1 output plus 1 controller bit
Momentary button on the screen the action runs only while the button is pressed 1 output plus 1 controller bit
Wired physical device the function must work with the screen off or the link down 1 input plus its output

Both M62 and M64 are on commands only. Define what turns each output off — a programmed off command, an unlatch in the logic, or a reset from the screen — and prove that off path on the bench before the valve carries a real load. A double-solenoid valve takes two outputs, so add one output for each such valve on the program and screen paths alike.

Build the button and the logic behind it #

  1. Give each actuator a state bit in the controller — a BOOL, not screen-local memory — retained if the state must ride out a power cycle. The screen button writes this bit, and the bit is what survives a screen or link failure.
  2. Choose the button action. A toggle object writes 1 on press and 0 on the next press, which suits clamps and stops. A momentary object writes 1 while pressed and 0 on release, which suits jog-type actions. Where you want explicit on and off controls, use two buttons in a set/reset pair on the same bit.
  3. Place one object per function and bind it to the bit. One object can act as button and lamp at once: configure its text and color from the bit state so the same square reports the state and changes it.
  4. Gate the physical output in the program: the output coil equals the state bit AND the interlocks AND not fault. The logic gates the output, so a screen mistake cannot fire a valve that a guard condition forbids. The output then switches the relay module, and the relay contacts carry the valve coil current.
  5. Point every indicator at the gated result, never at the button tag, or the lamp shows ON while the output is off. When one button must write one bit while a lamp reads another, use the pattern in how to make one HMI button read and write two PLC bits.
  6. Test each function with the actuator isolated — air dumped or load removed — before it does real work.

Sizing the button panel for two clamps, a stop cylinder and six functions #

The inputs come from the machine in question: two pneumatic clamp cylinders that hold the workpiece and one stop cylinder that centers it, each valve single-solenoid and driven through a relay module from one controller output. The panel is to carry buttons for six such functions, outputs 1 through 6. The one-output-per-valve assumption is stated because a double-solenoid valve would add an output to both paths equally.

The rule: a function on a wired button costs one input plus one output, because the button is a field device the controller must read. The same function on a screen button costs one output plus a state bit in controller memory, and no I/O at all.

The arithmetic at three functions:

  • Wired: 3 × (1 input + 1 output) = 3 inputs + 3 outputs = 6 I/O points.
  • Screen: 3 × (0 inputs + 1 output) = 0 inputs + 3 outputs = 3 I/O points.

At the six functions the panel wants:

  • Wired: 6 inputs + 6 outputs = 12 I/O points, half of them inputs.
  • Screen: 0 inputs + 6 outputs = 6 I/O points, none of them inputs.

The result: screen control costs exactly 1 output point per function, while the wired path costs 2 points per function, one of each type. The difference at six functions is 12 − 6 = 6, all of it inputs.

The decision: if the controller has the six spare outputs but not six spare inputs — the usual case on a machine panel — screen buttons are the only path that fits all six functions, and they free 6 inputs for real field devices. Keep wired hardware for the emergency stop and for any function that must operate with the screen dark.

Commission before the valve carries load #

Prove each output in this order. Confirm the on command lands where it should: an M62 function changes state at the motion point, an M64 function at its program line, a screen button within one write you can watch on the bit. Then confirm the off path — the output must return by the mechanism you defined, not because the on command reverses itself. Pull the screen offline mid-function on the bench and confirm the outputs hold their commanded states, because the bits live in the controller; then check what the screen writes to each bit at startup so a reboot cannot silently clear a clamp.

One safety rule outranks the whole scheme: IEC 60204-1 treats the emergency stop as a hardwired function that must not depend on screen software, so an emergency stop, a guard interlock or any function whose failure can hurt a person never lives on a screen button.

Questions asked

Do the screen buttons still work if the HMI link goes down?

No. A screen button needs the link to write the bit, so nothing can be switched while it is down. What the link failure does not touch is the state already set: the bit lives in the controller, so the outputs hold their last commanded state through a screen or link failure. That is exactly why the state bit belongs in the controller and not in screen memory.

Can I assign a keyboard key to an output instead of a touch button?

On a closed machine controller, only if its programming manual documents a way to bind keys to bits; many controllers ship with fixed key assignments and no such mapping, so the touch button is the supported operator path. On a PC-based HMI or panel PC you can bind a key or function key to the same write the button makes — the output logic does not care which one sent it.

Why does my button lamp show ON while the output is off?

The lamp is reading the button tag instead of the gated output. The button writes a state bit, the program gates the real output from that bit together with the interlocks, and the indicator must read that gated result. Point the lamp at the output bit, or at a status copy the logic writes every scan, and the lamp will agree with the valve.

What drives a pneumatic solenoid valve from a controller output?

Switch an interposing relay module with the output and let the relay contacts carry the valve coil current. Compare the coil's holding current, in amperes, against both the relay contact rating and the output point rating. Across a DC solenoid coil, fit a flyback diode or an RC suppression module so the inductive kick cannot pit the contacts or disturb the output electronics.

Keep reading

  • Troubleshooting

    Toggling PLC BOOLs from HMI screens across the display boundary

    An HMI button cannot toggle a Programming BOOL by name because Display and Programming are separate applications. Exchange the value through a commissioned register: define it in Commissioning, connect it to the BOOL in Programming, and drive it from Display with a bound field or a Video_SetParam and Video_GetParam event procedure, then verify with two presses per control.

    HMI and touchscreens

  • Troubleshooting

    Why HMI USB Downloads Fail and Touch Stops Responding

    A panel that drops USB downloads, shows question marks on numeric tags and ignores touches is usually not broken: fix the data cable, the selected COM port and the PC software installation first, and treat read-only PLC tags as a button write-action fault. In the reported case a clean reinstall restored downloads and cleared the display.

    HMI and touchscreens

  • Troubleshooting

    Why HMI Screens Fill With Question Marks After a Return Goto

    Question marks filling a screen after a return Goto mean the display's objects cannot resolve their tag values. The usual cause after adding a return button is a parameterized display opened without its parameters. Compare the failing route with a known-good route to the same display before touching communications.

    HMI and touchscreens