Timers, Counters, and the Logic of Machine Intelligence

By mastering timers and counters, you gain the building blocks required to construct and understand the logic behind almost any machine sequence. These instructions act as the bridge between simple digital inputs and the complex, reliable operations that modern machines demand.

1. The Core Timers: TON, TOF, and RTO

Instructions in a PLC either "read" or "write" data. Understanding this distinction is the fastest way to stop struggling with your code.

  • TON (Timer On-Delay): Use this when you need an action to happen after a certain amount of time has passed.

    • Behavior: When the timer is "enabled," it increments its elapsed time. If the instruction becomes "false" (e.g., you let go of a button), the timer immediately resets to zero.

  • TOF (Timer Off-Delay): Use this when you want an action to keep running for a set time after an input turns off.

  • RTO (Retentive Timer On): Use this to track cumulative time. Unlike the TON, the RTO does not reset if the input turns off. It "remembers" exactly where it left off, which is perfect for tracking total machine run-time or maintenance intervals across power cycles.

2. The Logic of Counting

Counters are simple tools, but they can be tricky if you don't account for the speed of the PLC.

  • Scan Time Awareness: A PLC scans your program thousands of times per second. If you connect a physical button directly to a counter, the PLC will "see" the button press thousands of times in a split second, causing the count to skyrocket.

  • The Pulse (One-Shot) Solution: Always use a Pulse Rising Edge (P modifier) or a one-shot instruction on your counter inputs. This forces the PLC to register the button press exactly once, regardless of how long you hold the button down.

  • Resetting: Unlike timers, counters must be explicitly reset. If you don't include a reset instruction (like an MOV 0 or a dedicated reset command), your counter will stay at its final value forever.

3. Pro-Tips for Better Programming

  • Organize with Data Structures: Instead of letting your tags float randomly, group them. Creating a custom structure (or grouping your tags) for your counter's ACC (Accumulated value), PRE (Preset value), and status bits keeps your code clean and significantly easier to troubleshoot later.

  • Fixing Display Issues: CCW often truncates (cuts off) long tag names in the ladder view. To fix this, right-click the area to the right of your ladder, go to Properties, and increase the Cell Width. This makes your code much more readable.

  • Read the Documentation: When in doubt about an instruction, highlight it and hit F1 on your keyboard. This opens the built-in help guide, which is the most reliable way to understand exactly what each bit (Q, DN, OV, UN) does.

Frequently Asked Questions (FAQ)

Why does my timer reset to zero the moment I let go of the button?

You are likely using a TON (Timer On-Delay) instruction. TON timers only track time while the instruction is "true." If you need the timer to hold its value while the input is off, use an RTO (Retentive) timer instead.

What is the easiest way to count button presses without errors?

Always use the Pulse (P) modifier on your counter's input. It ensures that the PLC counts the button press as a single event, preventing "runaway" counts.

How can I see if my counter is actually working?

Use the "Variable Monitor" or "Spy List" feature. This allows you to watch the tag values (like .ACC or .CV) change in real-time as you interact with your hardware.


How to program a sample rate timer in one rung.

Sample rate timers are used anytime you want to repeat an action in a timed interval.  While this lesson was recorded for Studio 5000, this works with Connected Components Workbench and most other brands of PLCs.


You can take two TON timer on delays and tie them together to make a PLC flasher.

This is the most common way to make a light flash on and off and you will find it in most PLC programs. It only takes two simple rungs to make a flashing beacon or pilot light.  While this lesson was recorded for Studio 5000, this works with Connected Components Workbench and most other brands of PLCs.


Cascading timers can be used to sequence through complex timed steps. 

Using the TON timer on delay instruction and some Examine On and Examine Off instructions, you can tie multiple timers together. While this lesson was recorded for Studio 5000, this works with Connected Components Workbench and most other brands of PLCs.


Knowledge Check Quiz

  1. What happens to a TON (Timer On-Delay) timer if the input signal turns off before the time is reached?
    Click to reveal answer

    The timer immediately resets its elapsed time to zero.

  2. Why do you need to use a 'Pulse' or 'One-Shot' instruction when counting physical button presses?
    Click to reveal answer

    PLCs scan code extremely fast; without a pulse instruction, the PLC will count a single button press thousands of times per second.

  3. Which type of timer should you choose if you need to track total run-time that survives power outages?
    Click to reveal answer

    The RTO (Retentive Timer On) instruction.

  4. True or False: A PLC program will automatically reset a counter to zero once it reaches its preset value.
    Click to reveal answer

    False; you must explicitly use a reset instruction to clear a counter.

  5. How do you increase the visibility of long tag names in the ladder editor?
    Click to reveal answer

    Right-click the ladder area, select Properties, and increase the Cell Width value.