19
Digital Electronic Systems Unit 10 COMBINATIONAL LOGIC SYSTEMS 2 This unit introduces some additional examples of combinational logic functions - Coders, Decoders, Multiplexers and Demultiplexers. Coding The following is a simple example of an application for coding. Digital computers use the binary number system to perform calculations. However, data is usually fed into the computer in decimal form and the computer provides results in decimal form. A coding system provides the solution to these conversion problems. Decimal Coding The most common form of decimal coding is Binary Coded Decimal (BCD). In binary coded decimal, every decimal is expressed by four bits, each having a specified weighting. The best known code in this group of codes is the BCD 8421 code. When BCD code is used without qualification, 8421 code is assumed. In this code, the group of four bits has a binary value that represents the equivalent decimal number. Note that not all possible combinations of the four bits are used. Decimal Digit Binary Coded Decimal Input (8421 Code) Output line selected on a Decoder 0 0000 2 Line 0 1 0001 2 Line 1 2 0010 2 Line 2 3 0011 2 Line 3 4 0100 2 Line 4 5 0101 2 Line 5 6 0110 2 Line 6 1

Unit 10- Combinational Logic Systems 2

Embed Size (px)

DESCRIPTION

microcontrollers and electronics,MCU Unit,beginners course,

Citation preview

Page 1: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

COMBINATIONAL LOGIC SYSTEMS 2This unit introduces some additional examples of combinational logic functions - Coders, Decoders, Multiplexers and Demultiplexers.

CodingThe following is a simple example of an application for coding. Digital computers use the binary number system to perform calculations. However, data is usually fed into the computer in decimal form and the computer provides results in decimal form. A coding system provides the solution to these conversion problems.

Decimal CodingThe most common form of decimal coding is Binary Coded Decimal (BCD). In binary coded decimal, every decimal is expressed by four bits, each having a specified weighting. The best known code in this group of codes is the BCD 8421 code. When BCD code is used without qualification, 8421 code is assumed. In this code, the group of four bits has a binary value that represents the equivalent decimal number. Note that not all possible combinations of the four bits are used.

Decimal Digit Binary Coded Decimal

Input (8421 Code)

Output line selected on a Decoder

0 00002 Line 0

1 00012 Line 1

2 00102 Line 2

3 00112 Line 3

4 01002 Line 4

5 01012 Line 5

6 01102 Line 6

7 01112 Line 7

8 10002 Line 8

9 10012 Line 9

The availability of a large variety of codes for the same discrete elements of information results in the use of different codes by different digital systems. It is sometimes necessary to use the output of one system as the input to another. A conversion circuit must be inserted between the two systems if each uses different codes for the same information.

1

Page 2: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

DecodersA decoder is a circuit used to detect the presence of a certain combination of bits (code) on its inputs, and to indicate that presence by a specified output level. In its general form, a decoder has n input lines to handle n bits and from 1 to output lines to indicate the presence of one or more n-bit combinations.

In the examples shown in the figure below, the output of the first circuit detects the presence of the code 1001 on its input, and the output of the second circuit detects the presence of 1100. Each circuit sets its output to high only when the input conditions are met.

A 4-bit binary decoder using 16 AND gates is shown below. Note that a 4-bit binary decoder is also know as a 4-line to 16-line decoder because there are four inputs and sixteen outputs or as a 1-of-16 line decoder because for any given code of inputs, one of sixteen outputs is activated. This circuit can be used as a binary to hexadecimal converter. An example of an IC that performs 4-bit binary decoding is the 74HC154.

2

Page 3: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

BCD to Decimal DecoderA BCD instruction representing one decimal digit can be decoded by a 4 input AND gate using a BCD to decimal decoder as shown below. Note that a BCD to decimal decoder is also know as a 4-line to 10-line decoder because there are four inputs and ten outputs or as a 1-of-10 line decoder because for any given code of inputs, one of ten outputs is activated.

It is sometimes desirable to decode only during certain intervals of time. For example, sometimes the input data on ABCD is not always valid. To account for such cases a strobe input is added to each AND gate and all are tied together and excited by a single binary signal, S. If S=1 a gate is enabled and decoding takes place. If S=0, a gate is disabled and no decoding takes place. An example of an IC that performs BCD-to-decimal decoding is the 74HC42.

EncodersAn encoder performs the reverse function of a decoder. It accepts an active level on one of its inputs, representing a digit such as a decimal or octal, and converts this input to a coded output such as a binary number or BCD. Encoders can also be used to encode various symbols and alphabetic characters, a good example being the keyboard encoder of a calculator or computer. The process of converting from familiar symbols or numbers to a coded format is called encoding.

3

Page 4: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

Decimal-To-BCD Encoder

This type of encoder has ten inputs (one for each decimal digit) and four outputs corresponding to the BCD code. This is a basic 10-line to 4-line encoder.

Decimal Digit BCD Code

0 0 0 0 02

1 0 0 0 12

2 0 0 1 02

3 0 0 1 12

4 0 1 0 02

5 0 1 0 12

6 0 1 1 02

7 0 1 1 12

8 1 0 0 02

9 1 0 0 12

From the table we can determine the relationship between each BCD bit and the decimal digits. For this circuit, A0 (the LSB) is 1 for digits 1,3,5,7,9, A1 is 1 for digits 2,3,6,7, A2 is 1 for digits 4,5,6,7 and A3 (the MSB) is 1 for digits 8 or 9.

4

Page 5: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

Multiplexing / Demultiplexing

Multiplexers

A digital multiplexer (MUX) is a combinational logic circuit that selects binary information from one of many input lines and directs it to a single output line. The selection of a particular input line is controlled by a set of data-select lines. Normally there are 2n input lines and n data-select lines whose combinations determine which input is selected.

Ex 1: Build a 2-input to 1-output Multiplexer

In this example, when the select function, S is LOW (0), is selected and when the select function, S is HIGH (1), is selected.

Therefore, the output function, O is

5

Page 6: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

When ,

When ,

6

Page 7: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

Ex. 2: Build a 4-input to 1-output Multiplexer

The data selection for a 4-1 multiplexer is as follows (Note that this is not a truth table).

Select 1 Select 2 Output

0 0

0 1

1 0

1 1

There are four input lines. This data is multiplexed onto one output line. The select lines are used to select the input lines to pass through the MUX to the output line. If the select code is 01, then I1 appears at the output O. If the select code is 11 then the output is D3. The logic circuit for a 4-1 Multiplexer is given below.

7

Page 8: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

The output of this circuit is

Examples of commercially available multiplexers are a Quad 2 to 1-line multiplexer (74HC157A) and an 8 to 1-line multiplexer (74LS151).

16-to-1 line IC packages are also available. For example, a 16-input MUX is implemented on a 24 pin IC with 16 data inputs, a 4-bit select code, a strobe enable input, one output, a power supply pin and a ground pin. In this case there are sixteen 6-input AND gates (4 select inputs can select 24 = 16 data inputs).

Demultiplexer

A demultiplexer (demux) essentially reverses the multiplexer function. It takes digital information from one line (serial data) and distributes it to one of a number of output lines.

8

Page 9: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

The selection of a particular output line is controlled by a set of data-select lines. Normally there are 2n output lines and n data-select lines whose combinations determine which output is selected. Non-selected outputs are either non-active or are open circuit.

Ex 3: Build a 1-line to 4-line demultiplexer.

It receives information on a single line and transmits this information to one of four possible output lines. The selection of the output lines is controlled by the two data select lines, and .

The data selection for a 1-4 demultiplexer is as follows (Note that this is not a truth table).

Select 1 Select 2 Output Selected

0 0

0 1

1 0

1 1

The logic circuit for a 1-to-4 demultiplexer is given below.

9

Page 10: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

A decoder can be converted to a demultiplexer by applying the data signal at the strobe input, S of the decoder. The signal appears at all the AND gates but only the gate which has “ones” at all of its other inputs selects the data signal and allows it through.

10

Page 11: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

Ex 4: Show how a 2-line to 4-line Decoder may be used as a 1-line to 4-line Demultiplexer

A decoder and a demultiplexer have essentially the same circuit.

2-line to 4-line Decoder

1-line to 4-line Demultiplexer

11

Page 12: Unit 10- Combinational Logic Systems 2

Digital Electronic Systems Unit 10

When the input data, I is low, the active low strobe signal is high, , then all of the outputs are disabled. When the input data, I is high, the active low strobe signal is low then whichever output is enabled by the select inputs (i.e. A,B) is selected. All of the other outputs are deselected. For the example shown, above, the outputs are active high. Therefore, if an output is selected, it goes LOW. All of the other (deselected) outputs go HIGH.

In the case of Philips Semiconductor’s 74HCT139 (a dual 2-to-4 line decoder/demultiplexer), all the outputs are active low. Therefore, if an output is selected, it goes LOW. All of the other (deselected) outputs go HIGH.

Ex. 5: (Part of 20 Mark Question)State the function performed by a Demultipexer. Draw the logic diagram for a 1-to-4 line Demultiplexer.

[6 marks]

Ex. 6: (Part of 20 Mark Question)(a) What binary number is this decoder looking for, assuming A is the least significant bit:

ABCD

f

[3 marks](b) State the function performed by an encoder. Draw the truth table and logic diagram for a 10-to-1-line encoder

[10 marks](c) What is the BCD code for the decimal number 10

[3 marks]

Ex. 7: (Part of 20 Mark Question)(a) State the function performed by a Multiplexer. Draw the logic diagram for a 4-to-1-line Multiplexer.

[6 marks](b) If a Multiplexer has 3 select lines, what is the maximum number of input lines that can be selected?

[4 marks]

12