Digital Logic Design CSE-241 Unit 12

4 bit Decoder In order to decode all possible combinations of 4bits, sixteen gates are required (24 = 16). This type of decoder is commonly called either 4-line-to-16-line decoder or 1-of-16 decoder.

2

Muhammad Usman Arif

4/2/2013

1

4/2/2013

The 1-of-16 Decoder (74HC154 IC) The IC will active if gate output (EN) is HIGH

If CS1 and CS2 are LOW, so EN will HIGH and IC is active! 3

Muhammad Usman Arif

4/2/2013

The BCD-to-Decimal Decoder The BCD-to-decimal converts each BCD code into one of ten possible decimal digit indications. It is frequently referred as 4-line-to-10- line decoder or a 1-of-10 decoder. The method of implementation is the same as for the 1-of-16 decoder.

4

Muhammad Usman Arif

4/2/2013

2

4/2/2013

The BCD-to-Decimal Decoder 0 0

1 0

0 1

1 1

0 0

1 0

0 1

1 1

0 0

1 0

0

0

0

0

1

1

1

1

0

0

0

0

0

0

0

0

0

0

1

1

The 74HC42 is an integrated circuit BCD-todecimal decoder. The logic symbol is shown in Figure 1 below. If the input waveforms in Figure 2 are applied to the inputs of the 74HC42, show the output waveforms. 5

Muhammad Usman Arif

4/2/2013

BCD-to-7segment Display:

6

Muhammad Usman Arif

4/2/2013

3

4/2/2013

7 SEGMENT DISPLAY:

7

Muhammad Usman Arif

4/2/2013

8

Muhammad Usman Arif

4/2/2013

4

4/2/2013

•Lamp Test (LT) •When LT = Low, BI/RBO = HIGH then all of the 7 segments in display are turned zero, LT is used to verify that no segments are burned out •Zero Suppression (BI, RBI, RBO) •Zero suppression is a feature used for multi digit displays to blank out unnecessary zeros. •Example: •In a 6-digit display the number 6.4 may be displayed as 006.400 if the zeros are not blanked out 9

Muhammad Usman Arif

4/2/2013

•Leading Zero Suppression • Blanking the zeros at the front of a numbers •Trailing Zero Suppression •Blanking the zeros at the back of the number •Only nonessential zeros are blanked, the number 030.080 will be displayed as 30.08 (the essential zeros remain)

10

Muhammad Usman Arif

4/2/2013

5

4/2/2013

•4-line-to-16-line (1-of-16) decoder . 74HC154

11

Muhammad Usman Arif

4/2/2013

•Application example •Decoders are used in many types of applications. One example is in computers for I/O selection as in previous slide •Computer must communicate with a variety of external devices called peripherals by sending and/or receiving data through what is known as input/output (I/O) ports •Each I/O port has a number, called an address, which uniquely identifies it. When the computer wants to communicate with a particular device, it issues the appropriate address code for the I/O port to which that particular device is connected . The binary port address is decoded and appropriate decoder output is activated to enable the I/O port •Binary data are transferred within the computer on a data bus, which is a set of parallel lines 12

Muhammad Usman Arif

4/2/2013

6

4/2/2013

•Application example

•A simplified computer I/O port system with a port address decoder with only four address lines shown.

13

Muhammad Usman Arif

4/2/2013

• Combinational Logic Circuit Implementation using a Decoder •Any combinational logic circuit with n inputs and m outputs can be implemented with an n-to-2n-line decoder and m OR gates. •Procedure:

–Express the given Boolean function in sum of min-terms –Choose a decoder to generate all the min-terms of the input variables. –Select the inputs to each OR gate from the decoder outputs according to the list of min-term for each function.

14

Muhammad Usman Arif

4/2/2013

7

4/2/2013

• Example •From the truth table of the full adder,

x 0 0 0 0 1 1 1 1 15

Muhammad Usman Arif

y 0 0 1 1 0 0 1 1

z 0 1 0 1 0 1 0 1

C 0 0 0 1 0 1 1 1

S 0 1 1 0 1 0 0 1 4/2/2013

• Example •Since there are three inputs and a total of eight minterms, we need a 3-to-8 line decoder. •The decoder generates the eight min-terms for x,y,z •The OR gate for output S forms the logical sum of minterms 1,2,4, and 7. •The OR gates for output C forms the logical sum of minterms 3,5,6, and 7 •Number in brackets indicate the decimal equivalent

16

Muhammad Usman Arif

4/2/2013

8

4/2/2013

• Example

•Implementation of a Full Adder with a Decoder 17

Muhammad Usman Arif

4/2/2013

Encoders

An encoder is a combinational logic circuit that essentially performs a “reverse” decoder function.

18

Muhammad Usman Arif

4/2/2013

9

4/2/2013

• General encoder diagram

19

Muhammad Usman Arif

4/2/2013

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

20

Muhammad Usman Arif

4/2/2013

10

4/2/2013

The Decimal-to-BCD Encoder A3 8 9 A2 4 5 6 7 A1 2 3 6 7 A0 1 3 5 7 9

21

Muhammad Usman Arif

4/2/2013

8-Line-to-3-Line Encoder

22

Muhammad Usman Arif

4/2/2013

11

4/2/2013

•Truth table for octal-to binary encoder [8-line- 3-line ]

•A low at any single input will produce the output binary code corresponding to that input. For instance , a low at A3’ will produce O2 =0, O1=1 and O0 =1, which is binary code for 3. Ao’ is not connected to the logic gates because the encoder outputs always be normally at 0000 when none of the inputs is LOW 23

Muhammad Usman Arif

4/2/2013

•Logic circuit for octal-to binary encoder [8-line- 3-line]

24

Muhammad Usman Arif

4/2/2013

12