# Function of Encoder

An encoder is a combinational logic circuit that accepts one or more inputs and generates a multibit binary output. Encoding is the process of converting any keyboard character or number as input to a coded output such as a binary or BCD form.

Figure 1 shows a decimal-to-binary encoder. Its function is to take a single digit (0 to 9) as input and to output a 4-bit code representation of the digit. This is referred to as a 10-line-to-4-line encoder. That is, if the digit 4 on the keyboard is typed in, this produces low or a 0 on line 4, which produces the 4-bit code 0100 as an output.

Figure 2 shows a decimal-to-binary priority encoder. The priority function means that if two keys are pressed simultaneously the encoder produces a BCD output corresponding to the highest-order decimal digit appearing on the input.

For example, if both a 5 and a 2 are applied to the encoder, the BCD output is 1010, or the invert of decimal 5.

This type of encoder is built into a single integrated circuit and consists of approximately thirty logic gates.

Figure 3 shows the symbol for a priority encoder. This type of encoder is used to translate the decimal input from a keyboard to an 8421 BCD code.

The decimal-to-binary encoder and the decimal-to-binary priority encoder are found wherever there is keyboard input. This includes: calculators, computer keyboard inputs, electronic typewriters, and teletypewriters (TTY).

## Function of Decoder

A decoder is one of the most frequently used combinational logic circuits. It processes a complex binary code into a recognizable digit or character. For example, it might decode a BCD number into one of the ten possible decimal digits.

The output of such a decoder is used to operate a decimal number readout or display. This type of decoder is called a 1-of-10 decoder or a 4-line-to-10-line decoder.

Figure 4 shows the ten NAND gates required for decoding a 4-bit BCD number to its approximate output (one decimal digit). When all the inputs to a NAND gate are 1, its output is 0.

All other outputs from the NAND gates in the decoder are 1’s. Rather than draw all the logic gates each time the circuit is used, the symbol shown in Figure 5 is used.

Two other types of decoder circuits are the 1- of-8 (octal, or base 8) decoder and the 1-of-16 (hexadecimal, or base 16) decoder (Figure 6).

The 1-of-8 decoder accepts a 3-bit input word and decodes it to one of eight possible outputs. The 1-of-16 decoder activates one of sixteen output lines by a 4-bit code word. It is also called a 4-line-to-16-line decoder.

A special type of decoder is the standard 8421 BCD-to-seven-segment decoder. It accepts a BCD input code and generates a special 7-bit output code to energize a seven-segment decimal readout display (Figure 7). The display consists of seven LED segments that are lit in different combinations to produce each of the ten decimal digits, 0 through 9 (Figure 8).

Besides seven-segment LED displays, there are incandescent and liquid crystal (LCD) displays. Each of these displays operates on the same principle. A segment is activated by either a high or low voltage level.

Figure 9 shows two types of LED displays: a common anode and a common cathode. In each case, the LED segment has to be forward biased for light to be emitted. For a common cathode, a high (1) lights up the segment, a low (0) does not.

Figure 10 shows the decoding logic circuit required to produce the output for a seven-segment display with a BCD input.

Referring to Figure 7, notice that segment a is activated for digits 0, 2, 3, 5, 7, 8, and 9; segment b is activated for digits 0, 1, 2, 3, 4, 7, 8, and 9; and so on.

Boolean expressions can be formed to determine the logic circuitry needed to drive each segment of the display. The logic symbol for a BCD-to-seven-segment decoder is shown in Figure 11. This represents the circuit contained in an integrated circuit.

## Function of Multiplexer

A multiplexer is a circuit used to select and route any one of several input signals to a single output.

An example of a non-electronic circuit multiplexer is a single-pole, multi-position switch (Figure 12). Multi-position switches are widely used in many electronic circuits.

However, circuits that operate at high speed require the multiplexer to switch at high speed and to be automatically selected.

A mechanical switch cannot perform this task satisfactorily. Therefore, multiplexers used to perform high-speed switching are constructed of electronic components.

Multiplexers handle two basic types of data: analog and digital. For analog applications, multiplexers are built of relays and transistor switches. For digital applications, multiplexers are built from standard logic gates.

Digital multiplexers allow digital data from several individual sources to be routed through a common line for transmission to a common destination.

A basic multiplexer has several input lines with a single output line. The input lines are activated by data selection input that identifies the line the data are to be received on.

Figure 13 shows the logic circuit for an eight-input multiplexer. Notice that there are three input-control lines, labeled A, B, and C. Any of the eight input lines can be selected by the proper expression of the input-control line.

The symbol used to represent a digital multiplexer is shown in Figure 14. Figure 15 shows the symbol for a 1-of-16 multiplexer. Notice that there are four input-control lines to activate the sixteen data input lines.

In addition to data line selection, a common application of a multiplexer is parallel-to-serial data conversion. A parallel binary word is applied to the input of the multiplexer. Then, by sequencing through the enabling codes, the output becomes a serial representation of the parallel input word.

Figure 16 shows a multiplexer set up for parallel-to-serial conversion. A 3-bit binary input word from a counter is used to select the desired input. The parallel input word is connected to each of the input lines of the multiplexer.

As the counter is incremented, the input select code is sequenced through each of its states. The output of the multiplexer is equal to the parallel signal applied.

## Summary

• An encoder accepts one or more inputs and generates a multibit binary output.
• A decimal-to-binary encoder takes a single digit (0 through 9) and produces a 4-bit output code that represents the digit.
• A priority encoder accepts the higher-order key when two keys are pressed simultaneously.
• Decimal-to-binary encoders are used for keyboard encoding.
• A decoder processes a complex binary code into a digit or character that is easy to recognize.
• A BCD-to-seven-segment decoder is a special-purpose decoder to drive seven-segment displays.
• A multiplexer allows digital data from several sources to be routed through a common line for transmission to a common destination.
• Multiplexers can handle both analog and digital data.
• Multiplexers can be hooked up for parallel-to-serial conversion of data.