Encoders and decoders are similar to multiplexers and demultiplexers, except that they are a little bit more complicated.
Decoders will have N inputs, and output. Let's say that we have two inputs (A and B), and 4 outputs (M N O P). Decoders will satisfy the following truth table:
Binary numbers come in, and essentially select which wire to send a signal on.
Encoders work in exactly the opposite way as decoders, taking inputs, and having N outputs. When a bit comes in on an input wire, the encoder outputs the physical address of that wire.It takes 2^n inputs and gives out n outputs,the enable pin should be kept 1 for enabling the circuit.
A Priority Encoder works opposite of the decoder circuit. Priority Encoders have logical ranking within them, input_1 may be higher than input_2. If input_2 and input_1 were pressed, the encoder would determine the priority, and accept the input.
Encoders and Multiplexers
The relationship between the two.
A multiplexer (MUX) is a combination circuit that contains more than one input line, one output line and more than one selection line. Whereas, an encoder is also considered a type of multiplexer but without a single output line.It is a combinational logic function that has 2^n (or fewer) input lines and n output lines.