PLC timer examples: TON on-delay
Delayed lamp example
A fictional inspection lamp should turn on after its request stays true for 2,000 milliseconds. If the request drops before the delay finishes, the lamp stays off and the next request starts a fresh delay.
| Request history | Expected lamp state |
|---|---|
| False throughout | Off |
| True for less than the preset | Off |
| True continuously through the preset | On |
| False after the delay has completed | Off |
A nonretentive on-delay loses elapsed time when the input becomes false. CODESYS documents this behavior for its TON function block. Other timer types have different retention and reset rules.
Interrupted input test
Start the request, let part of the delay elapse and switch it off. Turn it on again. The earlier interval must not shorten the new delay. A program that turns on too soon may be using stored elapsed time or the wrong timer type.
This table describes logical timing. A cyclic program observes a completed delay on a scan; it doesn’t promise a physical output change at an exact wall-clock instant. The course uses simulated time so you can repeat the same input sequence.
Compare the result with the contact and branch reference. Continue in the PLC course to count events and trace machine faults.