You are on page 1of 5

# Middle Technical University Digital Electronic Lab.

## Electrical Engineering Technical College First Stage

Electrical Power Technical Engineering Dept. Mohammed D. Altamemi

Experiment-10
Digital Comparator
10-1 Object:

To study and design a 2-bit, and 4-bit digital comparator by logic gates, and
then to know the operation of 4-bit IC digital comparator.

10-2 Theory:

First of all, we should point out that, although the digital and analogical
comparators have the same mission, while one evaluates magnitudes of analogical
voltage, the other works with digital signals.

## It is sometimes necessary to know if a binary A is bigger, smaller, equal to

another number B. the system to determine this is called digital comparator. We shall
first of all consider only one-bit numbers. As we already know, the NOR-
EXCLUSIVE gate is an equality detector since:

## The condition A>B is given by:

Since, if A>B, then A=1 and B=0, whereby C=1. On the other hand, if A=B or
A<B (A=0, B=1), then C=0.
Similarly, the restriction A<B is determined by:

The logic block diagram for the n-bit, drawn in figure (10-1), has the three
necessary outputs Cn, Dn, and En.

Figure (10-1) the logic block diagram for the n-bit comparator

## When A=B that mean:

MD
Middle Technical University Digital Electronic Lab.
Electrical Engineering Technical College First Stage
Electrical Power Technical Engineering Dept. Mohammed D. Altamemi

## When A<B that mean:

Figure (10-2) the logic block diagram for the 2-bit comparator
Table (10-1)

10-3 Procedures:

## 1. Connections are given as per circuit diagram in fig.10.3.

2. Logical inputs are given as per circuit diagram.

MD
Middle Technical University Digital Electronic Lab.
Electrical Engineering Technical College First Stage
Electrical Power Technical Engineering Dept. Mohammed D. Altamemi

## 3. Observe the output and verify the truth table

Figure (10-3)

Table 10-2
A0 B0 A<B A=B A>B
0 0
0 1
1 0
1 1

The circuit being studied is represented in figure (10-4). The IC used is 74LS85.
It is a digital comparator of 4-bit that gives us information about the three
possibilities: bigger, equal, or smaller.

## 1. Carry out the circuit assembly in figure (10-5).

2. Feed the circuit by pressing the switch. And SC is always equal to 1.

MD
Middle Technical University Digital Electronic Lab.
Electrical Engineering Technical College First Stage
Electrical Power Technical Engineering Dept. Mohammed D. Altamemi

## Figure (10-5) connection of comparator

3. Fill in the table (10-3), with the result obtained from the practice board.

Table (10-3)
A3 A2 A1 A0 B3 B2 B1 B0 A<B A=B A>B
1 0 1 0 1 0 1 0
1 0 1 0 1 0 1 1
1 0 1 1 1 0 1 0

6-4 Discussions:

## 1. The output are active …

A. At a low level.
B. At a high level.
C. At a high impedance level.
D. It depends on the magnitude of the input.
2. Which are the outputs when A=0000 and B=0000?
A. Y0=0, Y1=0, Y2=0
B. Y0=1, Y1=0, Y2=0
C. Y0=0, Y1=1, Y2=0
D. Y0=0, Y1=0, Y2=1
3. Are there any cases in which the three outputs are active?
A. No
B. When A=0000 and B=0000
C. When A=1111 and B=1111
D. When the two inputs are disconnected.
4. Design a 3-bit logic comparator, draw the digital circuit and give all necessary
logic exprsions.

MD
Middle Technical University Digital Electronic Lab.
Electrical Engineering Technical College First Stage
Electrical Power Technical Engineering Dept. Mohammed D. Altamemi

5. If A=0110, and in the input B we can only connect a lead with a logic 1, where
would we connect it to be sure that B>A is fulfilled?
A. To input B0.
B. To input B1
C. To input B2
D. To input B3

MD