Why PLC Programs Need Timing and Events
A TRUE input tells a programmable logic controller (PLC) that a condition is present now. Many control jobs also need to know how long it has been present, whether it just changed, or how many times something has happened.
Timers, event detection, and counters give the program those extra pieces of information.
Three different questions
| Question | Tool | Example |
| How long? | Timer | Start a fan after its request has stayed on for 3 s. |
| Did it just happen? | Event or edge detection | Notice the moment a part begins blocking a photo-eye. |
| How many times? | Counter | Mark a box full after 12 part arrivals. |
These tools can work together. A machine might detect each arriving part, count the arrivals, and raise an alarm if the next part takes too long to arrive.
A scan is an update, not a new event
The PLC keeps scanning while a sensor stays on. If one part blocks a photo-eye for 20 scans, those are 20 observations of the same blocked condition. They do not necessarily mean 20 different parts arrived.
Edge detection notices a change between states, such as FALSE becoming TRUE. That gives the program a way to recognize a new arrival once instead of treating every scan of a held signal as another arrival. Some instructions, including the counters taught here, detect the relevant transition themselves.
Time and counts have different meanings
A timer measures elapsed time toward a chosen duration. A counter records occurrences toward a chosen quantity. 3 s of operation and 3 part arrivals describe different requirements, even if they happen to finish together in one run.
Use actual time for a duration requirement. Counting a fixed number of program scans is a different rule: if the scan period changes, that number of scans represents a different amount of time.
Also decide when the stored time or count should clear. Some jobs need an uninterrupted condition; others need to keep a total across several periods of operation. Later lessons let you compare those behaviors.
Check the requirement first
For each job, choose what the program needs to remember:
An alarm should turn on only after pressure has remained low for 3 s.
A held button should request a new batch only once per press.
A box is complete after 12 new parts arrive.
Check your choices
The pressure requirement needs a timer. A once-per-press request needs detection of a new press event. The box needs a counter that counts new part arrivals rather than repeated observations of a blocked sensor.
Start with TON: On-Delay Timer. You will see a condition held for a duration, then compare other timing, event, and counting behaviors as you continue through the lessons.
Enable JavaScript to run the embedded simulator and complete the interactive exercises.