How Do You Lock an HMI Button During a PLC Process?

Stefan Weidner6 min read
HMI ProgrammingOther ManufacturerTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

An HMI button writes M512The PLC then clearsM512, returning the button indication from “Processing” to “Start.” During that interval, bind the button’s element-lock address to M512. The PLC bit then serves two roles: process-state feedback and the condition that prevents another operator write.

Where does the button request travel?

Follow the packet. The operator presses the HMI button, the HMI sends a write request, and the PLC changes M512from 0 to 1. The HMI reads that result and updates the displayed state.

Stage Owner Value or action Expected result
Idle PLC M512 = 0 Button displays “Start” and accepts a press.
Start request HMI Writes M512 = 1 The process begins.
Active process PLC Holds or observes M512 = 1 Button displays “Processing” and rejects operator interaction.
Completion PLC Writes M512 = 0 Button returns to “Start” and becomes operable.

Layer one first when behavior is intermittent. Confirm the HMI remains connected to the PLC and that reads and writes reach the intended device address. A lock setting cannot behave reliably if the displayed value is stale or the start write is going to a different address.

Should you use an element lock or a macro?

Approach Decision logic Maintenance impact Fit for this case
Element-lock address Disable the button while M512 = 1. Configuration remains attached to the button and follows the PLC state directly. Recommended.
HMI macro Run additional HMI logic after a press or state change. Adds another state path that must remain synchronized with the PLC. Unnecessary for a single existing lock condition.
PLC-only rejection PLC ignores duplicate requests while the process is active. Protects the process but may leave the HMI appearing operable. Useful as a logic safeguard, but it does not provide the requested HMI behavior by itself.

The element-lock approach is the direct solution because the lock condition already exists. No timer or duplicate HMI state is required. The button becomes unavailable when the PLC reports M512 = 1 and becomes available only after the PLC clears the bit.

Why does the lock follow the PLC bit?

The PLC owns process completion, so it must also own the state that releases the control. If the HMI starts its own approximately 10-second timer, the two timers can diverge because of scan timing, communication delays, a process fault, or a process that finishes earlier or later than expected. A locally timed lock could release the button while the PLC is still busy or keep it locked after the process has ended.

Binding the lock directly to M512 closes that gap. The control reads the same bit used for its displayed 0 and 1 states. When the read value is 1, the HMI blocks interaction. When the read value returns to 0, the HMI permits the next request.

The button display and the button lock are separate behaviors even when they share an address. The state text changes what the operator sees; the element-lock condition determines whether an input event can issue another write. Configure both explicitly.

How do you configure the button lock?

  1. Open the existing start-button properties in the HMI project.
  2. Locate the element-lock, interlock, enable, disable, or operator-input condition supported by that HMI editor. The exact label depends on the HMI platform.
  3. Assign M512 as the lock-condition address.
  4. Select the polarity that locks the element when M512 = 1 and unlocks it when M512 = 0. If the editor exposes an enable condition instead of a lock condition, configure the logical inverse: enable the element only while M512 = 0.
  5. Keep the existing state mapping: value 0 displays “Start,” and value 1 displays “Processing.”
  6. Configure the locked appearance, if the editor provides one, so the operator can distinguish a busy control from a failed touchscreen press.
  7. Download the revised HMI project and test it against the PLC process.
M512 Displayed state Input permission
0 Start Enabled
1 Processing Locked

Some editors interpret the configured address as “enable when true,” while others interpret it as “lock when true.” Check the property description or perform an online test; selecting the wrong polarity produces the exact opposite behavior.

How do you verify the complete state sequence?

  1. Monitor M512 in the PLC programming software while viewing the HMI button.
  2. With M512 = 0, verify that the button displays “Start” and accepts one press.
  3. Press the button once and confirm that the HMI write changes M512 to 1.
  4. While the process is active, confirm that the display reads “Processing” and repeated touches do not issue another effective command.
  5. Allow the PLC to finish its approximately 10-second process and clear M512.
  6. Confirm that the HMI reads 0, restores “Start,” and unlocks the button without an HMI restart or manual reset.

Also test a communication interruption during the active state. A stale display can hide the PLC’s current value. Check the HMI platform’s behavior for an unavailable lock address and select a fail-safe interaction policy appropriate to the machine: loss of valid state feedback should not create an unintended new start request.

Which recurring pitfalls cause an ineffective lock?

Symptom Likely cause Check
Button locks while idle Lock polarity is reversed. Verify that 1 means locked, or that 0 means enabled.
Text changes but the button still accepts touches Only the state display was configured. Assign M512 to the element-lock condition.
Button stays locked after completion The PLC did not clear M512, or the HMI did not receive the updated value. Monitor the bit in the PLC, then inspect the communication path.
Button unlocks before the process finishes M512 is being cleared before process completion. Trace every PLC write to M512 and make completion the release condition.
Operation differs from the monitored PLC value The display, write, and lock fields may reference different devices or addresses. Compare all three address definitions character for character.

Do not use display text as the source of truth. Text is a presentation result; the PLC bit is the control state. Where the machine logic permits it, the PLC should also reject a new start while the process is active. The HMI lock guides the operator, while PLC logic prevents duplicate execution if another interface or delayed message attempts a start.

FAQ

Why does the HMI button still work when it says Processing?

The 0/1 state text controls appearance, not input permission. Assign M512 to the button’s element-lock condition and lock the element when the bit equals 1.

Why does the button lock in the Start state?

The lock polarity is reversed. Configure the button to lock when M512 = 1, or configure an enable-type property so it enables only when M512 = 0.

Monitor M512 in the PLC first. If it remains 1, correct the PLC completion logic; if it is 0, check whether the HMI is receiving the updated value and whether the lock uses the same address.

Why use M512 instead of an HMI timer?

M512 represents the PLC-owned process state. An HMI timer can expire independently of the actual process, while the PLC bit releases the button only when the PLC clears it.

How do I confirm the HMI lock is working?

Start with M512 = 0, press once, and confirm it changes to 1 and blocks further touches. Complete the final verification by watching the PLC clear M512 to 0 and confirming that the HMI returns to “Start” and accepts the next command.

Back to blog