PLC Timers and Counters: TON, TOF, CTU and CTD
Back to Knowledge Hub
PLC PROGRAMMING

PLC Timers and Counters: TON, TOF, CTU and CTD

Timers and counters are fundamental PLC instructions, but correct use involves more than placing a block in the program. Input behavior, outputs, instance memory, reset and restart conditions all matter.

10 MIN READElecnic technical guide
01 / ELECNIC KNOWLEDGE

TON: On-delay timer

When IN becomes true, TON starts timing. Q remains false until elapsed time reaches PT. If IN becomes false before completion, the timer resets.

Example: after Start, wait five seconds before enabling an auxiliary device. Protective conditions must remain independent of the delay.

02 / ELECNIC KNOWLEDGE

TOF and TP: Off-delay and pulse

TOF turns Q on while IN is true and keeps it on for PT after IN becomes false. A ventilation fan may continue running briefly after a machine stops.

TP generates a pulse of configured duration from an input edge. Check the instruction documentation for repeated input events and CPU-specific behavior.

03 / ELECNIC KNOWLEDGE

CTU, CTD and CTUD: Counting events

CTU increments CV on each rising edge at CU. Q becomes true when the count reaches or exceeds PV. A conveyor sensor counting products is a typical example.

CTD counts down, while CTUD supports both directions. Define the triggering edge, reset or load conditions, and how sensor bounce or repeated detections are handled.

04 / ELECNIC KNOWLEDGE

Instance DB and implementation considerations

IEC timers and counters retain internal state in instance data. Independent calls need their own instance data; otherwise separate functions may unintentionally share state.

Use descriptive names such as TON_StartDelay or TOF_FanRunOn. Design reset behavior explicitly and never treat a timer output as a safety function. Test actual timing and CPU stop conditions.

05 / ELECNIC KNOWLEDGE

Choosing timers and counters and understanding their behavior

TON is commonly used for on-delay, TOF for off-delay and TP for a pulse of defined duration. However, verify the exact behavior of IN, Q and elapsed time ET for the instruction being used. IEC timers have instance state, so their instance handling must fit the program structure.

CTU, CTD and CTUD are used for up, down and up/down counting. Count, load and reset inputs must be controlled with clear edge and sequencing logic. If pulses are too fast for reliable detection in the normal program cycle, use a supported high-speed counter function.

Key takeaways

  • TON is on-delay, TOF is off-delay and TP generates a timed pulse.
  • CTU counts up, CTD counts down and CTUD supports both directions.
  • Define triggering edges, reset, instance memory and sensor behavior.
ENGINEERING SUPPORT

Need help applying this in a real project?

Explore Elecnic engineering services for Siemens PLC programming and troubleshooting, HMI/SCADA implementation, SINAMICS drive integration and commissioning support.

References and further reading

This is an original Elecnic article based on the technical references below. Always verify model-, firmware- and software-version-specific details in the official documentation for your equipment.