Short answer: put the lamp test in the PLC logic behind the keypad. Map one spare momentary key, stretch its pulse with a timer, and OR the test into each indicator's single final assignment. The panel never restarts and the process keeps running while every lamp lights for about a second. The automatic test at power-up still does its job; this adds a check you can run in January on a panel that has not been switched off since March. Set the timer to 500 ms when every lamp is steady. Use 1000 ms when any alarm lamp flashes at 1 Hz, so a full flash cycle always appears during the test.
What the startup self-test leaves out
A keypad HMI checks its own keys and lamps once, at power-up. A pilot LED that burns out in week three then stays dark until someone happens to look at that face of the panel. A runtime test puts the check in your hands: hold a key, every indicator lights, you walk the panel, you release, and live status returns. The scope is the lamps and the bits that drive them. The sensor behind each alarm keeps its own diagnostics; the lamp test shows you the light, and the alarm logic shows you the cause.
Choose the trigger: spare keypad key or door pushbutton
Both triggers end at the same place: a momentary BOOL inside the PLC.
| Trigger | PLC input | Enclosure work | Best when |
|---|---|---|---|
| Spare momentary keypad key | The HMI reports the key over its link, like a screen button | None | The keypad has a free key and the operator is already at the panel |
| Door pushbutton | One spare 24 V DC discrete input | A 22.5 mm [0.89 in] bore and a gasketed switch with an IP66 front | The keypad has no spare key, or the test belongs at the door next to the e-stop |
The keypad route needs no drilling; choosing an enclosure input without drilling covers that path. The pushbutton route cuts the door once. Check the bore against the switch before you order, the way the LCD keypad panel cutout dimensions checklist does for display cutouts. Then keep the door's rating, as mounting an operator panel in a cabinet door explains.
The display itself lives in the housing. A 15 in panel PC HMI housing in 304 stainless carries the keypad display on a VESA 100 rear panel with a gasketed rear cover, and a 10.4 in panel PC HMI housing suits a compact station. The front seal is an IP65-type seal with the display installed; the housing and our custom Type 4X boxes are manufacturer rated, not UL listed.
Write the logic: one final assignment per lamp
Find where each lamp's command is written. A lamp with two writers shows whichever coil ran last, and a test bit added to one writer loses that race. Consolidate first: one lamp, one coil. Then the test enters at that coil.
A steady pilot becomes Lamp_Cmd := Lamp_Normal OR LT_Pulse. An alarm lamp stays gated through its flash bit: Lamp_Cmd := (Lamp_Normal AND Flash_Bit) OR (LT_Pulse AND NOT Lamp_Normal). With Flash_Bit toggling at 1 Hz (500 ms on, 500 ms off), an alarm lamp blinks whether or not the test runs, and a healthy pilot lights steady for the test. Two- and three-color stacks pick one test color, usually amber: force that color's bit and leave the other color bits false. If your lamps share one status word instead of single bits, the same test becomes a masked OR across the word; masked move and compare logic page works through the bit-level operations.
Add the test in six steps
- List every indicator on the panel and find the coil that writes it. Move any lamp with two writers to a single coil first.
- Pick the trigger from the table above: a spare keypad key, or a 22.5 mm [0.89 in] door pushbutton on a spare 24 V DC input.
- Debounce the request for 20 ms and stretch it with an on-delay timer: 500 ms preset for steady lamps, 1000 ms when any alarm lamp flashes at 1 Hz.
- OR the stretched pulse into every lamp at its final coil, with the two formulas above.
- Leave process outputs, interlocks and safety logic untouched; the test writes lamp commands only.
- Watch the scan time once after the change: one OR and one timer add well under a millisecond to a 10 ms scan.
Worked example: 24 lamps, one spare key
The station is a machine panel behind a keypad HMI: 24 single-bit pilots, two of them alarm lamps that blink at 1 Hz. The tag names below are illustrative for any PLC, and three timing figures are typical values for a mid-size program, not datasheet limits: a 10 ms worst-case scan, a 100 ms worst-case key report over the HMI link, and 20 ms of debounce.
| Tag | Type | Initial value | Meaning |
|---|---|---|---|
| LT_Key_I | BOOL | FALSE | Spare keypad key, reported by the HMI each link update |
| LT_Pulse | BOOL | FALSE | Stretched test request; every lamp coil reads it |
| LT_Tmr | TON | preset 1000 ms | Holds the pulse for the preset time after the key releases |
| Lamp_Cmd[24] | BOOL array | all FALSE | The only place lamp commands are written |
The rule: the pulse lasts as long as the hold plus the timer preset, and every lamp ORs the pulse at its final coil.
For a 200 ms tap, the arithmetic runs:
- The key registers after 20 ms of debounce + 100 ms of link update + one 10 ms scan = 130 ms.
- The pulse ends one preset after release: 200 ms + 1000 ms = 1200 ms.
- The lamps stay lit from 130 ms to 1200 ms, a 1070 ms test window.
- One flash cycle at 1 Hz is 500 ms + 500 ms = 1000 ms, so the 1070 ms window always contains a complete cycle on both alarm lamps.
The decision: a 200 ms tap with the preset at 1000 ms guarantees one full flash cycle. Drop the preset to 500 ms when every lamp on the panel is steady. A longer hold just stretches the window: a 1.5 s walk-around hold lights the panel from 130 ms to 2500 ms, a 2370 ms test.
Checks when done
- Key released, before any test:
LT_Pulsereads FALSE and every lamp shows live status. - 200 ms tap: the timer runs out its full preset after the release, and the panel stays lit for the 1070 ms window.
- One failed pilot: pull its fuse or unplug its LED module, run the test, and 23 lamps light while that one stays dark — the failure the test exists to catch.
- Alarm active during the test: that lamp keeps its 500 ms on / 500 ms off blink instead of joining the steady test lights.
- Release: live status returns within one 10 ms scan, so a status change that happened mid-test is back on the panel at once.
Mistakes that hide an alarm or cost the rating
- A maintained test position masks every steady status lamp for as long as it is held. Keep the request momentary and let the timer, not your thumb, set the length.
- Output forces from the programming tool are a commissioning tool. A forgotten force overrides the lamp logic you just wrote and can hold a real output on.
- A test wired across process outputs runs the machine. Lamp commands only: the test belongs in the indication layer.
- An OR added inside three routines puts one lamp under three owners. Write the test once, at the final coil.
- A snap-in switch with an IP54 front turns a Type 4X door into an IP54 door, because the weakest device sets the assembly rating. Fit a gasketed 22.5 mm [0.89 in] pushbutton with an IP66 front, and take bore, gland and seal details from the cutouts, glands and HMI window guide.
- If the keypad sits behind a clear cover, run the whole test with the cover closed; the hinged clear cover over an operator panel covers the hardware.
Enclosures in this article
| Enclosure | Material | Outside H x W x D / display | Rating |
|---|---|---|---|
| 15" HMI enclosure | 304 stainless | 12.91 x 16.06 x 3.88 in | IP65-type front seal with the display installed, manufacturer rated; not UL listed |
| 10.4" HMI enclosure | 304 stainless | 10.2 x 12.44 x 3.6 in | IP65-type front seal with the display installed, manufacturer rated; not UL listed |
Questions
Can a lamp test run without restarting the HMI panel?
Yes. The startup self-test keeps running as the firmware performs it; the runtime test is your logic in the PLC: one spare momentary key, a 1000 ms pulse stretcher, and an OR into each indicator's final coil. The process keeps running and the panel lights for about a second per press.
How long should the lamp test pulse last?
500 ms when every lamp is steady. Use 1000 ms when any alarm lamp flashes at 1 Hz, because one flash cycle lasts 500 ms on plus 500 ms off, and the preset must cover a full cycle. A 200 ms tap is enough; the timer, not the hold, sets the test length.
Can the test hide an active alarm from the operator?
Not when the alarm lamps stay gated through the flash bit: they keep blinking at 1 Hz during the test. The only lamps masked are steady status lamps, for at most the timer preset, and live status returns within one 10 ms scan of release.
Can I mount the test pushbutton in the enclosure door and keep the rating?
Yes. Cut a 22.5 mm [0.89 in] bore, deburr it, and fit a gasketed pushbutton with an IP66 front. The weakest device sets the assembly rating, so an IP54-front snap-in switch drops a Type 4X door to IP54. Our Type 4X boxes are manufacturer rated, not UL listed.





