<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Counting on Digital Logic Notebook</title><link>https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/</link><description>Recent content in Counting on Digital Logic Notebook</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/index.xml" rel="self" type="application/rss+xml"/><item><title>Ripple Counters</title><link>https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/ripple-counters/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/ripple-counters/</guid><description>&lt;h1 id="ripple-counters"&gt;Ripple Counters&lt;a class="anchor" href="#ripple-counters"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;A ripple counter is the simplest way to count in hardware: a chain of &lt;a href="https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/storage/t-flip-flop/"&gt;toggle flip-flops&lt;/a&gt; in which each stage&amp;rsquo;s output clocks the next. The first stage toggles on the input clock, dividing it by two; its output clocks the second stage, dividing by two again; and so on. With &lt;em&gt;n&lt;/em&gt; stages the chain counts from 0 to 2ⁿ−1 in binary and divides the input frequency by 2ⁿ — all from flip-flops and a wire, no logic gates and no software.&lt;/p&gt;</description></item><item><title>Synchronous Counters</title><link>https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/synchronous-counters/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/synchronous-counters/</guid><description>&lt;h1 id="synchronous-counters"&gt;Synchronous Counters&lt;a class="anchor" href="#synchronous-counters"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;A synchronous counter fixes the &lt;a href="https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/ripple-counters/"&gt;ripple counter&lt;/a&gt;&amp;rsquo;s central flaw by clocking &lt;strong&gt;every flip-flop from the same clock at the same time&lt;/strong&gt;. There is no ripple: on each edge all stages that need to change do so together, so the count is valid all at once and the counter runs as fast as a single stage allows.&lt;/p&gt;
&lt;h2 id="knowing-when-to-toggle"&gt;Knowing When to Toggle&lt;a class="anchor" href="#knowing-when-to-toggle"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If every flip-flop shares the clock, each one needs to be told &lt;em&gt;in advance&lt;/em&gt; whether to flip on the coming edge. That is the job of a little combinational logic: a stage toggles only when all the stages below it are already 1. Stage 0 toggles every edge; stage 1 toggles when bit 0 is 1; stage 2 toggles when bits 0 and 1 are both 1 — a chain of &lt;a href="https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/gates/and/"&gt;AND gates&lt;/a&gt; feeding each &lt;a href="https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/storage/d-flip-flop/"&gt;flip-flop&lt;/a&gt;&amp;rsquo;s toggle enable. The flip-flops still all fire on the same edge; the logic just decides which ones act.&lt;/p&gt;</description></item><item><title>Frequency Dividers</title><link>https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/frequency-dividers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/frequency-dividers/</guid><description>&lt;h1 id="frequency-dividers"&gt;Frequency Dividers&lt;a class="anchor" href="#frequency-dividers"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;A frequency divider produces a slower clock from a faster one, and a counter is already a frequency divider — the two are the same circuit viewed two ways. Every &lt;a href="https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/storage/t-flip-flop/"&gt;toggle flip-flop&lt;/a&gt; stage halves the frequency, so an &lt;em&gt;n&lt;/em&gt;-stage &lt;a href="https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/ripple-counters/"&gt;counter&lt;/a&gt; divides its input by 2ⁿ while it counts. Deriving usable clocks this way is one of the most common jobs a counter does.&lt;/p&gt;
&lt;h2 id="dividing-by-two-by-2ⁿ-and-by-n"&gt;Dividing by Two, by 2ⁿ, and by N&lt;a class="anchor" href="#dividing-by-two-by-2%e2%81%bf-and-by-n"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Dividing by a power of two is free: tap the output of the right stage of a binary counter. Stage 0 gives ÷2, stage 3 gives ÷16, and so on.&lt;/p&gt;</description></item><item><title>Ring &amp; Johnson Counters</title><link>https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/ring-and-johnson-counters/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/ring-and-johnson-counters/</guid><description>&lt;h1 id="ring--johnson-counters"&gt;Ring &amp;amp; Johnson Counters&lt;a class="anchor" href="#ring--johnson-counters"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Ring and Johnson counters count differently from a binary counter: instead of incrementing a number, they &lt;strong&gt;circulate a pattern&lt;/strong&gt; around a &lt;a href="https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/moving-data/shift-registers/"&gt;shift register&lt;/a&gt;. They trade code efficiency for something valuable — outputs that are already decoded and free of glitches.&lt;/p&gt;
&lt;h2 id="ring-counter"&gt;Ring Counter&lt;a class="anchor" href="#ring-counter"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A ring counter is a shift register with its last output fed straight back to its first input. Seed it with a single &lt;code&gt;1&lt;/code&gt; and that one bit walks around the loop: &lt;code&gt;1000 → 0100 → 0010 → 0001 → 1000&lt;/code&gt;. With N flip-flops it has N states, and exactly &lt;strong&gt;one output is active at a time&lt;/strong&gt; — a &lt;strong&gt;one-hot&lt;/strong&gt; sequence. Because each output &lt;em&gt;is&lt;/em&gt; a decoded state, no decoding logic is needed and there are none of the &lt;a href="https://applied-ee.github.io/digital-logic-notebook/docs/building-blocks/counting/ripple-counters/"&gt;ripple-counter&lt;/a&gt; decoding glitches: the outputs are already clean, one-per-step control signals. That makes ring counters ideal for sequencers, stepper-motor phase drives, and LED chasers.&lt;/p&gt;</description></item></channel></rss>