Skip to content
Adaptive AgroTech NetworkUniversity of Southern Denmark · SDU Drone Center
Book2026
← Applied Automation in AgricultureChapter 50

Polling and interrupts

InstructorDr. Redmond R. Shamshiri
AffiliationAssistant Professor of Robotics · University of Southern Denmark (SDU)
Study time35 minutes
Study companion. These editable notes, worked examples and exercises supplement the source material. They are not a verbatim video transcript or a reproduction of the book.

Study Polling and interrupts. Use the accompanying model, numerical example and practical task to connect the topic to a measurable engineering result. Notes are original supplemental material, not a transcript.

Learning Objectives

  • Explain the role of timers, edges and product counting in the engineering system.
  • Calculate the worked quantity with consistent units.
  • Design a measurement that can reveal an implementation failure.

Study guide

Original companion notes. These notes support the topic of this lesson. They are not a transcript or a claim about the exact contents, hardware settings or examples in the video.

Lesson focus: Polling and interrupts

Define the input, measured output, units and pass/fail condition before running the experiment.

Timers, edges and product counting

A count should represent a physical event, not the number of PLC scans during which a sensor remains high. Detect a rising edge and define how closely spaced valid events may occur. A timer measures elapsed duration under a stated enable/reset behavior.

Model, units and assumptions

\[Edge_k=Input_k\land\neg Input_{k-1},\qquad Count_{k+1}=Count_k+Edge_k\]

Input is a Boolean sampled signal. Pulses shorter than the acquisition interval may be missed; mechanical or optical chatter can create several edges unless the signal is conditioned appropriately.

Worked engineering example

A product blocks a sensor for 120 ms while a PLC scans every 10 ms. Counting high scans could produce about 12 counts for one product; counting one rising edge produces one, provided the pulse is captured.

Practical task and evidence

Apply the following procedure to the topic of this lesson: Polling and interrupts.

  • Simulate one long pulse, two distinct pulses and a bouncing transition.
  • Record scan interval and the shortest valid pulse width.
  • Use hardware counters or suitable input capture when normal scanning is insufficient.

Submit: a diagram or interface table, a short timestamped dataset, the calculation with units, and a paragraph explaining the largest observed limitation.

Check your understanding

Question. A pulse stays high for five scans. How many events does a correct rising-edge counter add?

Show worked answer

One, assuming a previous low state and no intervening falling edge.

Extension. Change one assumption in the model and explain which measurement would reveal that it no longer holds.

Summary

Timers, edges and product counting: keep units, assumptions and timing explicit. Check the numerical model against an independent observation before using it in a larger system.

Suggested Reading & Resources

  • Reading
    Book source: Applied Automation in Agriculture

    Primary documentation or original technical reference; check the version used in your lab.

    Open ↗
  • Reading
    CODESYS Structured Text reference

    Primary documentation or original technical reference; check the version used in your lab.

    Open ↗