🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Manufacturing & Marine › Robotics / Mechatronics › Programmable Logic Controllers for Mechatronics › Lesson 5
MFG-MECH15-02 · Lesson 5 · 16 clock hours · lab

Timers and Counters

Objective. Students will program timer-on-delay (TON), timer-off-delay (TOF), and retentive timer (RTO) instructions along with count-up (CTU) and count-down (CTD) instructions to control a simulated conveyor delay and part-count reject sequence.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by a licensed engineer or certified journey-level tradesperson or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

Timers and Counters in PLC Programs

Timers and counters are among the most frequently used instructions in industrial PLC programs. They let a controller measure time intervals and track event totals — skills you will use every time you commission or troubleshoot automated conveyor systems, packaging machines, or robot work-cells.

Timer Instructions

All timers in IEC 61131-3 ladder logic share three key parameters:

Timer-On-Delay (TON)

A TON starts counting when its rung goes TRUE. Its output (Q) energizes only after the elapsed time equals the preset. If the rung goes FALSE before the preset is reached, the timer resets to zero immediately. Use a TON when you want something to happen after a delay — for example, turning on a pilot light five seconds after a pushbutton is pressed.

Timer-Off-Delay (TOF)

A TOF behaves the opposite way. Its output turns ON immediately when the rung goes TRUE. When the rung goes FALSE, the timer begins counting and the output stays ON until the preset is reached, then turns OFF. Use a TOF to keep a lubrication pump running for three seconds after a machine stops.

Retentive Timer (RTO)

An RTO accumulates elapsed time across multiple rung-TRUE events. Unlike a TON, it does not reset when the rung goes FALSE — the accumulated value holds until a separate Reset (RES) instruction clears it. RTOs are used to track total run-hours on a motor or accumulate machine cycle time for maintenance schedules.

Counter Instructions

Count-Up (CTU)

A CTU increments its accumulated value (ACC) by one on each FALSE-to-TRUE transition of its rung. When ACC reaches the preset (PRE), the output bit goes TRUE. A separate reset rung clears ACC to zero. Use a CTU to count parts on a conveyor and trigger a reject gate after ten pieces.

Count-Down (CTD)

A CTD decrements ACC by one on each FALSE-to-TRUE transition. Its output goes TRUE when ACC reaches zero. CTDs are useful for batch operations where you start with a known quantity and count down to empty.

Combining Timers and Counters

Real-world programs often combine both. A common sequence: a CTU counts conveyor cycles while a TON enforces a 30-second run period per cycle. When the CTU reaches its preset (five cycles), a master control rung stops the conveyor permanently until an operator reset is pressed.

Wiring and Lab Safety

Before touching any wiring on the PLC trainer, apply the principles of OSHA 29 CFR 1910.147 — control of hazardous energy (lockout/tagout). Even low-voltage trainers can store energy in capacitors or supply hazardous voltage at I/O terminals. Follow your instructor's lockout procedure: isolate the power source, apply your personal lock, and verify zero energy before connecting or moving any wire.

For trainers with 120 V AC I/O modules, observe NFPA 70E shock-protection boundaries. Wear appropriate PPE — at minimum, safety glasses and insulated gloves rated for the voltage present. Never probe a live terminal with an uninsulated tool.

Follow OSHA 1910.212 machine-guarding requirements if your trainer drives any physical actuator: keep guards in place before energizing outputs.

Reading Accumulated Values and Troubleshooting

During testing, go online with your programming software and watch the ET (elapsed time) or ACC values in real time. Capture screenshots for your lab log at the moment the timer or counter output changes state. Compare the actual delay measured with a stopwatch to the programmed preset. A well-functioning PLC timer should be accurate to within the program scan time — typically a few milliseconds — so any error larger than ±0.5 s usually points to a wiring problem (contact bounce), a wrong time-base setting, or a data-type mismatch in the preset register.

When a counter does not reset, check that the reset rung is using a normally-open (NO) contact from the reset pushbutton and that the RES instruction targets the correct counter address. Addressing errors are the most common beginner mistake.

Documenting Your Work

Accurate documentation is a professional habit expected in manufacturing and marine automation environments. Your lab log must include: the rung-by-rung program printout or screenshot, the measured vs. programmed delay table, accumulated-value screenshots at the moment of output energization, and your functional test checklist signed by the instructor. This mirrors the paperwork discipline required when servicing equipment covered by NFPA 79 (Electrical Standard for Industrial Machinery), which requires documented verification of control-circuit function.

Key terms9

TON (Timer-On-Delay)A PLC timer instruction whose output energizes only after the rung has been continuously TRUE for the programmed preset time; resets immediately if the rung goes FALSE before the preset is reached.
TOF (Timer-Off-Delay)A PLC timer instruction whose output turns ON immediately when the rung goes TRUE and stays ON for the preset duration after the rung goes FALSE, then turns OFF.
RTO (Retentive Timer)A PLC timer that accumulates elapsed time across multiple rung-TRUE events and holds its accumulated value when the rung goes FALSE; cleared only by a separate Reset instruction.
CTU (Count-Up Counter)A PLC instruction that increments its accumulated value by one on each FALSE-to-TRUE rung transition; its output energizes when the accumulated value reaches the preset.
CTD (Count-Down Counter)A PLC instruction that decrements its accumulated value by one on each FALSE-to-TRUE rung transition; its output energizes when the accumulated value reaches zero.
Preset (PRE / PT)The target value programmed into a timer or counter instruction; the output changes state when the accumulated value equals this value.
Accumulated Value (ACC / ET)The current count or elapsed time stored in a timer or counter register during program execution; visible in online monitoring mode.
Rung Transition (FALSE-to-TRUE)The moment a PLC rung changes from a de-energized (FALSE) state to an energized (TRUE) state; counters increment or decrement on this edge.
Reset (RES) InstructionA PLC instruction that clears the accumulated value of a retentive timer or counter to zero and de-energizes its output bit when its rung goes TRUE.

Worked examples4

1. A TON is programmed with a preset of 5,000 ms. A technician presses the start pushbutton, holds it for 3 seconds, then releases it. The light never turns on. The technician presses again and holds for 6 seconds — the light turns on after 5 seconds. Explain why.
  1. Step 1: Recall that a TON resets its accumulated value to zero immediately when its rung goes FALSE.
  2. Step 2: On the first press (3 seconds), the rung was TRUE for only 3,000 ms — less than the 5,000 ms preset — so the output never energized.
  3. Step 3: When the button was released, ET reset to 0 ms.
  4. Step 4: On the second press (6 seconds), the rung stayed TRUE continuously. ET accumulated to 5,000 ms before the button was released, so the output energized at the 5-second mark.
Answer: The TON requires uninterrupted rung-TRUE time equal to the preset. The first 3-second press did not reach 5,000 ms, so the output never fired. The second 6-second press exceeded the preset and the output energized correctly at 5 s.
2. A CTU counter has a preset of 10. A student presses the part-detect pushbutton 10 times to simulate parts. After the 10th press the reject output energizes. The student then presses the reset button. What is the accumulated value immediately after reset, and is the reject output energized or de-energized?
  1. Step 1: After 10 FALSE-to-TRUE transitions, ACC = 10, which equals PRE = 10, so the CTU output (done bit) is TRUE and the reject output is energized.
  2. Step 2: The reset pushbutton drives an RES rung targeting the same counter address.
  3. Step 3: When the RES rung goes TRUE, the PLC writes ACC = 0 and clears the output (done) bit.
  4. Step 4: With ACC = 0 and the done bit cleared, the reject output de-energizes.
Answer: After reset: ACC = 0 and the reject output is de-energized.
3. Program timing check: A TOF is set to PT = 3,000 ms. A student presses and holds the button for 8 seconds, then releases. Using a stopwatch, when should the pilot light turn OFF after button release? If the stopwatch reads 3.4 s, is that within the ±0.5 s tolerance?
  1. Step 1: A TOF output turns ON immediately when the rung goes TRUE (button pressed). The timer does not count during this time.
  2. Step 2: When the button is released, the rung goes FALSE and the TOF begins counting from 0 toward PT = 3,000 ms.
  3. Step 3: The light should turn OFF at exactly 3.0 s after release under ideal conditions.
  4. Step 4: The measured value is 3.4 s. The error is |3.4 − 3.0| = 0.4 s.
  5. Step 5: 0.4 s < 0.5 s tolerance, so the measurement is within spec.
Answer: The light should turn off 3.0 s after button release. A measured delay of 3.4 s gives an error of 0.4 s, which is within the ±0.5 s tolerance — the timer passes.
4. An RTO has accumulated 12,000 ms (12 s) across three separate machine run intervals. The preset is 20,000 ms. How many more milliseconds of rung-TRUE time are needed before the RTO output energizes?
  1. Step 1: PT = 20,000 ms; current ACC = 12,000 ms.
  2. Step 2: Remaining time = PT − ACC = 20,000 − 12,000 = 8,000 ms.
  3. Step 3: Because an RTO retains its accumulated value, it needs exactly 8,000 ms of additional rung-TRUE time (in one or more intervals) to reach the preset.
Answer: 8,000 ms (8 seconds) of additional rung-TRUE time is needed before the RTO output energizes.
In class: Timer lab: students wire a pushbutton input and pilot-light output, then write a TON rung that turns on the light 5 seconds after the button is pressed and a TOF rung that keeps it on 3 seconds after release; measure actual delay with a stopwatch and compare to set-point. · Counter application: students program a CTU that counts 10 simulated part pulses (from a pushbutton) and energizes a reject output; a reset pushbutton resets the count; tested on the trainer and documented in the lab log with accumulated-value screenshots. · Combined timer/counter challenge: students design a program (from a written spec sheet) where a conveyor runs for 30 seconds, pauses, counts five cycles, then stops; program must pass a functional test checklist signed off by the instructor.
Materials: PLC programming software, PLC trainer, pushbuttons, pilot lights, stopwatch, lab log, function checklist sheet
Check: Timer delays within ±0.5 s of set-point; counter resets and accumulates correctly; combined challenge program passes all five items on the functional checklist; lab log complete.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Programmable Logic Controllers
1. A TON instruction is programmed with a preset of 5,000 ms. The input rung goes TRUE, then FALSE after 4,800 ms. What is the accumulated value (ET) immediately after the rung goes FALSE?
Programmable Logic Controllers
2. Which timer instruction keeps its output energized for a set time AFTER its input rung goes FALSE?
Programmable Logic Controllers
3. A technician needs to track the total run-time of a conveyor motor across many start-stop cycles for a maintenance schedule. Which timer type is most appropriate?
Programmable Logic Controllers
4. A CTU counter has PRE = 10 and ACC = 10. The part-detect input pulses one more time (11th pulse). What happens to the ACC and the output (done) bit?
Safety
5. Before wiring pushbutton inputs on a PLC trainer that uses 120 V AC I/O modules, which OSHA standard requires you to control hazardous energy and apply a personal lock?
Programmable Logic Controllers
6. In the combined timer/counter challenge, the conveyor must run for 30 seconds, pause, and repeat for five cycles, then stop. Which instruction combination correctly implements this logic?
Programmable Logic Controllers
7. A student measures the TON pilot-light delay three times and records 5.1 s, 4.8 s, and 5.6 s against a preset of 5.0 s. Which measurement(s) fall OUTSIDE the ±0.5 s acceptance criterion?
Programmable Logic Controllers
8. A reset pushbutton is wired to I:0/3. The student programs a RES instruction targeting counter C5:0 but uses a normally-closed (NC) contact from I:0/3 on the reset rung. What symptom will appear during testing?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.