Digital Circuits
Encoders and Decoders
21 questions By Tony R. Kuphaldt
-
Question 1 of 21
What does it mean, in general terms, to encode something? Conversely, what does it mean to decode something? Perhaps the most common context for these terms to be used is cryptography (code-making and code-breaking), but they also find application in common digital circuits.
Reveal answerTo encode something is to convert an unambiguous piece of information into a form of code that is not so clearly understood. To decode is to perform the reverse operation: translating a code back into an unambiguous form.
Notes:This question gets students thinking about encoding and decoding in general terms - terms which they are probably already familiar with. This is a good first step in instruction, to identify a well-known context for a new subject, so students have an easier time relating to it.
-
Question 2 of 21
The simple switch-and-diode circuit shown here is an example of a digital encoder. Explain what this circuit does, as the switch is moved from position to position:

Reveal answerThis encoder generates a three-bit binary code corresponding to the switch position (one out of eight positions).
Follow-up question: trace the path of electron flow through the circuit with the switch in position #3.
Challenge question: are there other codes (besides binary) that could possibly be generated with a circuit of this general design?
Notes:Ask your students to explain how the term “encoder” applies to this simple circuit. What, exactly, is being encoded, and what form of code is the data being converted to?
-
Question 3 of 21
Having learned how to build simple encoder circuits using diode networks, you set out to form your own encoder manufacturing company: Encoders, Inc. After agreeing on a policy of truth in advertising, your board of directors drafts this slogan:
”Our encoder circuits are more reliable because there′s less to break.” After months of hard work, you unveil your latest masterpiece, the 16-line to 4-line encoder:

However, your first customer has a complaint with your encoder circuit. He claims it often outputs false codes. After sending it back to your workshop for warranty repair, you determine there is nothing wrong with the encoder circuit itself: it always outputs the correct codes when you energize the appropriate inputs. Perhaps the problem is in how the customer is using it.
You then telephone the customer and ask him how he is using the encoder. He tells you it is used as part of a fault diagnostic circuit for an important piece of machinery. Each input of the encoder is connected to a different sensor on the machine (low oil pressure switch, high temperature switch, out-of-limit travel switches, etc.), and then the encoder outputs drive a four-LED display for maintenance technicians to view. They would have rather used a separate LED for each “trouble” sensor, but the display panel was too small to accommodate fifteen LEDs, so they decided to use four LEDs and an encoder, having their technicians interpret a binary code to determine which of the fifteen sensors is activating.
To the best of your ability, determine why your company’s flagship encoder circuit sometimes produces false codes in this application. Then, recommend a solution for your customer.
Reveal answerI’ll answer this question with another question: what if two failures occur on this machine at the same time?
Notes:Despite the overly simplistic nature of the company’s product, this scenario accurately reflects the realistic nature of product development and customer application. Often, a company designs, builds, and markets a product, and the customers experience trouble because their applications are improper for that product, or the application reveals a deficiency in the product that wasn’t detected during development.
As elegant as the “diode network” design of encoder is, it certainly has its limitations. Ask your students whether the output of this encoder circuit will always be incorrect if two inputs are simultaneously activated, or if only particular combinations of active inputs cause problems. Which condition would be easier to troubleshoot?
Discuss alternative solutions with your students, being sure to first define what the problem is so that all understand.

