Encoder

Encoder: outputs the binary number of whichever input is 1.

Function table (2-bit example)

I3I2I1I0Y1Y0
1XXX11
01XX10
001X01
000100

X means either 0 or 1

Pins

Inputs I0, I1… on the left, binary output Y on the right (higher number = higher bit).

How to use it

Turn a key or sensor position into a number, e.g. 8 buttons → a 3-bit key code.

Usage example

The opposite of a decoder: whichever input is 1, the output is its number. With I2 = 1 the output Y1 Y0 = 10.

Common mistakes

It's a priority encoder: when several inputs are 1, the highest number wins. All-zero inputs also give 0, which looks the same as I0 = 1.

Try this circuit in Norro

Related parts(Combinational)

← All parts