Use Case: Calculator

A really simple example of how this could be useful is a calculator.

Imagine if we wanted to make a calculator (either in minecraft or in digital logic), and we wanted to ask the user to input a digit. Think back to the calculators we had in elementary school. Did you have to type the numbers into the calculator in binary?

Think about everything that happens when you perform a simple addition operation on a four-function calculator.

How it Works

What you really did was press a number that corresponded to a decimal digit, from 0 through 9. That number was run through an encoder and turned into binary, so that logic circuits within the calculator (e.g. the adder) could perform some math on it, then generate the output in binary.

But we couldn't stop there- our output is still in binary. How will we represent it on the screen for our user? This is where our decoder comes in. It will go ahead and represent each digit based on what a decoder outputs. A certain wire being on means that the calculator needs to show a 1, another wire being on means that the calculator needs to show a 6, etc.


Obviously, this is a highly simplified example of how a calculator actually works, but here you can see a very clear example of why we need encoders and decoders.

Though encoders and decoders have many uses, one of their main utilities is allowing us humans, who are most familiar with the decimal system, to very easily interface with the logic circuits that we're building, which are most easily implemented using binary.