HMI toggle switch resets at PLC power up: pick the right fix

6 min read · Published November 7, 2026

The toggle is not broken: it redraws a PLC bit that returns off because nothing retains or sets it. Set the bit with first-scan logic for a known startup state, or move it into a configured retentive range to keep the last state, then verify with a power-cycle test that compares the online bit with the screen.

The switch on the screen is telling the truth. When an HMI toggle drops to off at every PLC power cycle, the bit behind it comes up off: the address is non-retentive and no startup logic sets it. The screen simply redraws whatever the PLC holds once the link returns. You have two fixes, and they answer different questions. If the machine must start in a known state, set the bit during the first scan. If the operator's last choice must survive a power cut, move the bit into a configured retentive range. Then prove the choice with a full power-cycle test that compares the online bit with the screen. Swapping the panel changes nothing, because nothing on the screen is broken.

Why the toggle shows off at power up

A toggle object stores nothing. It writes to one PLC address when pressed, and it redraws that address whenever communications are up. A regular coil address in a PLC powers up at off, and it holds off until some rung writes it. So the screen shows off, correctly, because the PLC value is off.

Three layers sit between the operator's finger and the machine: the screen object, the link and the PLC bit. The bit decides. When the screen and the online value disagree, watch the bit, because that is the value the logic uses.

What each symptom points to

  • The toggle drops to off after every power cycle and works normally otherwise: the bit is non-retentive and nothing sets it at startup. This is the common case, and both fixes below answer it.
  • The toggle comes back on with a value nobody selected: a startup rung already forces that bit. Decide the behavior you want and leave one writer on the address.
  • The toggle drops to off only now and then: on a controller that keeps retentive data in battery-backed RAM, suspect the battery first; on any controller, look for a rung that writes the same address on only some power-up paths.
  • The PLC bit reads on but the screen shows off: the toggle object is pointed at a different address, or the display has not refreshed since the link came up. Correct the address before touching retention.

First fix: set the bit on the first scan

Most PLC families expose a first-scan special relay. On a DirectLOGIC controller it is SP0, on for exactly one scan, the first pass of the program after power up. Put an SP0 contact in series with a set coil on the toggle bit:

|  SP0        C30
|---] [-------(S)---

C30 is the example address, the bit the toggle writes; use your own. The rung fires once per power up and imposes the programmed state. Write the intended value as a comment next to the rung so the initialization explains itself, and confirm no later rung resets the same bit before the operator sees the screen.

Use a set coil here; an out coil needs a seal-in to hold once SP0 drops out. A bit with two writers, one rung setting it and another resetting it, fights on every scan, which is its own diagnosis: see why a CODESYS toggle flip-flop sets and resets. And the behavior of a bit that lives for a single scan follows the same scan-count arithmetic as how many PLC scans an HMI momentary button bit stays on.

Second fix: move the bit into a retentive range

Retention keeps an address at its last value across power off and power on. Where the setting lives depends on the controller family:

  • DirectLOGIC, in DirectSOFT: open PLC > Setup > Retentive ranges, online. Pick a coil already inside a configured range, or adjust the range so it includes the toggle bit. The same ranges can be changed from the controller side with AUX 57.
  • Click: Setup > Software Setup, System tab, the Maintain Retentive option.
  • Other families: the same screen lives in the programming software under the controller's setup menu, named retentive memory or retain ranges.

With the toggle bit inside a retentive range, the address holds the operator's last choice and the screen redraws it once the link returns. Modern controllers keep retentive data in battery-backed RAM, so a toggle pressed a few times a shift wears nothing out. Where a family stores retention in EEPROM or flash instead, keep fast-changing bits out of it, because that storage tolerates a limited number of writes. The split is configured per family; one documented example of retentive versus non-retentive memory bits shows how another family draws the line.

Two things can undo retention. A battery-backed range holds only while the battery is alive, so replace the battery on the schedule in the controller manual and re-run the power-cycle test afterwards. And check what the HMI itself writes at startup, because a panel configured to push values when it boots can overwrite PLC retained variables: see why an HMI overwrites PLC retained variables at startup.

If the bit can start, move or release anything, restoring it unattended at power up is a machine-design decision: require a fresh operator confirmation at restart, and keep hard safety functions out of any HMI-retained bit.

Prove it with a full power cycle

  1. Watch the toggle bit online and press the toggle on. Confirm the bit reads on.
  2. Switch the PLC off and wait 30 s, long enough for internal supplies to discharge.
  3. Power up and time the gap from power on to the program running. Small controllers spend a few seconds on self-test before the first scan; write your number down.
  4. Read the bit during startup. With retention it still holds the pre-power value; with first-scan logic it takes the programmed value as soon as the program starts.
  5. Compare the final bit with the screen. The screen must match the bit, because the bit is what the logic uses.
  6. Press the toggle off and repeat, then run five full cycles before calling the fix done.

During the seconds before the first scan the program is not running, so outputs hold whatever state the hardware powers up in. That gap is where an unexpected restart hides, and it is the reason the safety rule above belongs to retention, not to the screen.

Example: two toggles on one bench

A test bench has an HMI toggle at C30 that switches a work light, and a second toggle at C31 that silences a warning horn. The light should come back the way the last shift left it. The horn must be silent at every startup, whatever yesterday's operator chose.

Fix C30 with retention: adjust the retentive range so it includes C30. Fix C31 with first-scan logic: keep C31 outside the retentive range and add a rung with an SP0 contact driving a reset coil on C31.

The verification run, timed with a stopwatch:

  • Toggle C30 on, confirm the bit and the screen both read on, then switch the PLC off for 30 s.
  • Power up: the program reached its first scan 4 s after power up on this bench, and C30 still read on. The screen showed on once the link returned.
  • C31 was off by the end of the first scan, which on this bench's 10 ms scan is 10 ms into the program, so the horn logic started silenced.
  • One cycle took 30 s off plus 4 s boot plus 20 s watching both toggles settle: 30 + 4 + 20 = 54 s. Five cycles, three with C30 left on and two left off, came to 5 x 54 = 270 s, about four and a half minutes at the panel.

After the fifth cycle both behaviors had held in both states, so the fix stayed: C30 retained, C31 reset on the first scan. The 4 s boot and the 10 ms scan are this bench's numbers; the test itself, power cycle, watch the bit, compare the screen, is what transfers to yours.

Recommendation: Decide the startup behavior first, then pick the fix. If the machine must start in a known state, set the toggle bit with first-scan logic, SP0 on a DirectLOGIC controller, and leave retention alone. If the operator's last choice must survive a power cut, move the toggle bit into a configured retentive range and check that nothing writes over it, neither PLC logic nor the HMI at boot. If the bit can start or move anything hazardous, keep it out of unattended restoration and demand a fresh operator confirmation at restart. Verify either fix with the full power-cycle test, both states, five cycles, before signing the panel off.

Questions

Can I use an ordinary out coil on the first-scan rung?

Yes, but it needs a seal-in. SP0 is off from the second scan, so an out coil driven only by SP0 writes the bit on during scan one and writes it back off during scan two. Branch a contact of the toggle bit itself around the SP0 contact so the coil holds itself on, or use a set coil, which needs no seal-in. The set coil also makes the startup write obvious to the next person reading the program.

Does the toggle reset if only the HMI loses power?

No. The switch's state lives in the PLC bit, and the screen redraws that address whenever the link comes back. Cycling panel power alone never touches the bit, so the toggle shows the same state it had. The reset you are chasing happens only when the controller itself powers down, because that is when a non-retentive address returns off.

How often should the PLC memory battery be changed?

Use the interval printed in your controller's manual, because it varies by model and storage design. A battery left past its interval can let the retentive range drop its values at the next power off, which looks exactly like the original fault. After any battery change, run the full power-cycle test again with the toggle left on and left off before trusting the panel.

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