How to Use Timer in Ladder Logic for PLC Programming
In ladder logic, use a
TIMER instruction to create delays or measure time intervals. You set a timer preset value and start it with a rung condition; when the timer reaches the preset, its done bit turns ON.Syntax
The basic syntax of a timer in ladder logic includes the timer instruction, a timer name or address, a preset time value, and an accumulated time value. The timer starts counting when the rung condition before it is TRUE.
- Timer Instruction: Usually
TON(Timer ON Delay) orTOF(Timer OFF Delay). - Timer Name: A unique identifier like
T1. - Preset Value: The target time in milliseconds or seconds.
- Accumulated Value: The current count of the timer.
ladder_logic
TON T1, 5000 // T1 is the timer name // 5000 is the preset time in milliseconds // Timer starts when rung condition is TRUE
Example
This example shows a simple timer that turns ON an output after a 3-second delay when a start button is pressed.
ladder_logic
(* Ladder logic example *) | Start_Button |----[ TON T1, 3000 ]----| | T1.DN |----( Motor_Output )----| // Explanation: // When Start_Button is pressed, timer T1 starts counting 3000 ms (3 seconds). // After 3 seconds, T1.DN (done bit) turns ON, activating Motor_Output.
Output
When Start_Button is pressed and held:
- Timer T1 counts up to 3 seconds.
- After 3 seconds, Motor_Output turns ON.
When Start_Button is released:
- Timer resets and Motor_Output turns OFF.
Common Pitfalls
Common mistakes when using timers in ladder logic include:
- Not holding the input condition long enough for the timer to reach the preset.
- Confusing the timer done bit (
DN) with the timer input. - Using incorrect time units for the preset value.
- Not resetting the timer properly before reuse.
Always ensure the rung condition stays TRUE for the full preset time to activate the timer done bit.
ladder_logic
(* Wrong way: input pulse too short *) | Start_Button |----[ TON T1, 3000 ]----| | T1.DN |----( Motor_Output )----| (* Right way: latch the input to hold timer *) | Start_Button |----[ SET M0 ]----| | M0 |----[ TON T1, 3000 ]----| | T1.DN |----( Motor_Output )----| | Stop_Button |----[ RST M0 ]----|
Quick Reference
| Term | Description |
|---|---|
| TON | Timer ON Delay instruction |
| TOF | Timer OFF Delay instruction |
| Preset | Target time for timer to count (ms or s) |
| Accumulated | Current timer count |
| DN (Done) | Bit set when timer reaches preset |
| Timer Name | Unique identifier for each timer |
Key Takeaways
Use the TON instruction to create a delay timer that starts when the rung is TRUE.
Set the preset time carefully and ensure the input condition stays TRUE long enough.
The timer done bit (DN) indicates when the timer has finished counting.
Reset or latch inputs properly to avoid timer misbehavior.
Timers help control delays and timed actions in PLC ladder logic.