<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Shane Zhang &#8211; Technology for Learners</title>
	<atom:link href="https://technologyforlearners.com/author/shanezhang/feed/" rel="self" type="application/rss+xml" />
	<link>https://technologyforlearners.com</link>
	<description>Learn to use Technology and use Technology to Learn</description>
	<lastBuildDate>Thu, 03 Dec 2026 10:55:48 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>

<image>
	<url>https://technologyforlearners.com/wp-content/uploads/2022/12/cropped-Logo-symbol-32x32.jpg</url>
	<title>Shane Zhang &#8211; Technology for Learners</title>
	<link>https://technologyforlearners.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What Should a Counter Do With a State That Cannot Happen?</title>
		<link>https://technologyforlearners.com/what-should-a-counter-do-with-a-state-that-cannot-happen/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=what-should-a-counter-do-with-a-state-that-cannot-happen</link>
		
		<dc:creator><![CDATA[Shane Zhang]]></dc:creator>
		<pubDate>Thu, 03 Dec 2026 10:53:24 +0000</pubDate>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[binary]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[digital design]]></category>
		<category><![CDATA[unplugged]]></category>
		<guid isPermaLink="false">https://technologyforlearners.com/?p=15914</guid>

					<description><![CDATA[Write 111 on the board and tell students that it is the current reading of a counter for a room with five seats. If 111 is binary for seven, what should the counter do with it? “That can’t happen” is a good first response, but it is not a rule a digital circuit can follow. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Write 111 on the board and tell students that it is the current reading of a counter for a room with five seats. If 111 is binary for seven, what should the counter do with it? “That can’t happen” is a good first response, but it is not a rule a digital circuit can follow. This short, unplugged activity asks students to turn that response into a design decision, then test it against other decisions they have already made.</p>
<p>The activity takes about 20 minutes and needs only paper or a whiteboard. Students should know how to read three-bit unsigned binary numbers; if they do not, leave the numbers 000 through 111 on the board with their decimal equivalents.</p>
<h2>Decide what is being counted</h2>
<p>The counter keeps track of free seats in a fictional room. It can show anything from zero free seats to five. Ask students to list those six values and choose how many bits to store them in. Two bits give four patterns, so two bits are not enough. Three bits give eight patterns. Using ordinary binary, 000 through 101 are legal. That leaves 110 and 111 as unused encodings.</p>
<p>Have pairs draw two columns: current count and next count. Give them a rule for reading input: one row represents one clock tick. An entry uses one free seat and an exit frees one. Each can be either present or absent on a tick. Start with a count of three and ask groups to work out all four possibilities: no event gives three, an entry alone gives two, an exit alone gives four, and an entry plus an exit gives three.</p>
<h2>Give the two ends their own test</h2>
<p>Now put the counter at zero and give it an entry signal. Simply subtracting one would take the count outside its legal range. A three-bit counter that wraps around would show 111, or seven. That is the wrong output for a counter intended to show free seats. In this design the lower limit holds at zero. At the other end, an exit alone when the count is already five likewise leaves the display at five.</p>
<p>Ask pairs to try both signals arriving on the same tick at zero and at five. Under the rules for this exercise, the signals cancel before either boundary is checked, so the count stays where it is. If students get one at zero, ask them to show their order of operations. They may have handled the entry first, clamped at zero, and then handled the exit. That rule is different, and the boundary test makes the difference visible.</p>
<h2>Give unused states a rule</h2>
<p>Return to 111. The rules at zero and five tell us what to do with a legal current count; they do not tell us how to recover from an illegal one. Give the class a chosen reset count of two for this example. Groups can now write a recovery rule: if the current register contains an unused code, its next value is 010 on the next tick, regardless of the input signals. On paper, test 110 with neither signal and 111 with both signals. Both should produce 010. Then give the recovered counter an exit alone on a separate tick: two becomes three, or 011.</p>
<p>Make clear that resetting to two is an exercise convention. It does not reconstruct how many seats are actually free. A real system might instead flag an error and wait for someone to verify the count. Ask groups to compare those choices: which one resumes counting immediately, and which one avoids presenting a plausible but unverified count?</p>
<h2>Finish with evidence, not just the answer</h2>
<p>Give each pair a blank set of four rows and have them write tests for another pair to run. Require one ordinary transition, one boundary, one simultaneous-input case, and one recovery. The team receiving the tests should record the starting state, both inputs and the expected three-bit output before looking at the other team&#x27;s answers. If they disagree, have them identify the exact rule that produced the difference.</p>
<p>For an exit ticket, ask whether 110 is evidence that the room has six free seats. A strong answer explains that a register can hold a bit pattern the model has not assigned to a legal count. What it does next depends on a rule the designer must specify. That is the larger lesson: writing down what happens outside the normal case is part of designing the system, not something to leave until a test fails.</p>
<p><em>Shane Zhang builds online calculation tools at PanaCalc. His work focuses on making the assumptions behind a calculation easier to see and test. <a href="https://panacalc.com/" target="_blank" rel="noopener">PanaCalc</a></em></p>
<p><em>AI assistance was used in drafting and organising this article. The state transitions were independently checked. No classroom trial is claimed.</em></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
