Encoders Explained

Imagine you wanted to build a digital system that took input from a standard keyboard. Obviously having a separate wire and logic gates for each key is ridiculous, you'd need almost 80 wires and all the logic to go with them. Instead you come up with an idea, why don't you assign an ID number value to each key and just send that ID value when that key is pressed. Now instead of 80 wires each with their own logic gates you can use just 8 (since we normally work with multiples of 4 or 8 wires for digital devices). That's \(\frac{1}{10}\)th the number of wires and gates we were going to have to use! And congratulations, you've just invented the encoder. A encoder has a huge number of inputs and outputs a binary number based on which of the input lines is a 1.
A encoder has many input lines and outputs a binary number to indicate which of those lines is high.
But what happens if both inputs 3 and 4 are high? Well now we get an output of 1110 = 7, so whatever our decoder is hooked up to will respond thinking input 7 was high. Now not only do we not get a response from either of our actual inputs but we DO get a response for something we never even touched! Imagine typing at your keyboard and hitting two keys at the same time and getting a third, completely different letter showing up in your writing. To prevent exactly this problem the priority encoder was invented.
The priority encoder works just like a regular encoder but if more than one input is high it will only output the binary number for the input with the largest number (if 3 and 4 go high only 4's output will be shown).
practice problems