<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Timer &amp; Counter Peripherals on Embedded Systems Development</title><link>https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/</link><description>Recent content in Timer &amp; Counter Peripherals on Embedded Systems Development</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/index.xml" rel="self" type="application/rss+xml"/><item><title>Timer Prescaler &amp; Auto-Reload Arithmetic</title><link>https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/timer-prescaler-arithmetic/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/timer-prescaler-arithmetic/</guid><description>&lt;h1 id="timer-prescaler--auto-reload-arithmetic"&gt;Timer Prescaler &amp;amp; Auto-Reload Arithmetic&lt;a class="anchor" href="#timer-prescaler--auto-reload-arithmetic"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Every timer application on an MCU — whether generating a 50 Hz servo pulse, triggering a 1 ms systick interrupt, or counting encoder edges — begins with two registers: the prescaler (PSC) and the auto-reload (ARR). Together with the timer clock source, these two values determine the timer&amp;rsquo;s overflow frequency. Getting the arithmetic wrong produces timing errors that compile cleanly, run without faults, and silently generate the wrong frequency.&lt;/p&gt;</description></item><item><title>PWM Generation Patterns</title><link>https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/pwm-generation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/pwm-generation/</guid><description>&lt;h1 id="pwm-generation-patterns"&gt;PWM Generation Patterns&lt;a class="anchor" href="#pwm-generation-patterns"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;PWM output is the most common timer application in embedded systems — LED dimming, motor speed control, servo positioning, and switch-mode power supply gate drive all rely on precisely timed high/low transitions. The STM32 timer peripheral generates hardware PWM without CPU intervention once configured: the counter free-runs, the output compare unit toggles the pin, and the CPU only intervenes to change the duty cycle. Getting from &amp;ldquo;a PWM signal exists&amp;rdquo; to &amp;ldquo;a production-quality PWM driver&amp;rdquo; requires understanding output compare modes, complementary outputs, dead-time insertion, and the break input — all of which live in timer registers, not software loops.&lt;/p&gt;</description></item><item><title>Input Capture &amp; Frequency Measurement</title><link>https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/input-capture/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/input-capture/</guid><description>&lt;h1 id="input-capture--frequency-measurement"&gt;Input Capture &amp;amp; Frequency Measurement&lt;a class="anchor" href="#input-capture--frequency-measurement"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Input capture mode turns a timer into a measurement instrument: on each selected edge of an input signal, the hardware latches the current counter value (CNT) into the Capture/Compare Register (CCRx). No interrupt latency affects the measurement — the capture happens in hardware at the timer clock resolution. By comparing successive captures, firmware can compute the period, frequency, or duty cycle of an external signal. The technique applies to tachometer pulses, ultrasonic echo timing, infrared decoder protocols, and any application where the timing of external events matters.&lt;/p&gt;</description></item><item><title>Encoder Mode &amp; Quadrature Decoding</title><link>https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/encoder-mode/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://applied-ee.github.io/embedded/docs/digital-interfaces/timers/encoder-mode/</guid><description>&lt;h1 id="encoder-mode--quadrature-decoding"&gt;Encoder Mode &amp;amp; Quadrature Decoding&lt;a class="anchor" href="#encoder-mode--quadrature-decoding"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Rotary encoders are the primary position feedback device in motor control, CNC machines, robotic joints, and manual input knobs. A quadrature encoder outputs two square waves (Channel A and Channel B) with a 90° phase offset — the phase relationship between the two signals encodes both position and direction. STM32 timers include a dedicated encoder mode that decodes these signals entirely in hardware: the timer&amp;rsquo;s CNT register tracks absolute position, incrementing or decrementing on each edge, with no CPU involvement per edge. This eliminates the interrupt overhead and timing sensitivity that software-based quadrature decoding requires.&lt;/p&gt;</description></item></channel></rss>