0% found this document useful (0 votes)
16 views6 pages

MUCLecture 2022 8106412

Uploaded by

BhargāVā BG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views6 pages

MUCLecture 2022 8106412

Uploaded by

BhargāVā BG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Class: Third

Subject: Electronics Laboratory 2


Lecturer: Dr. Hamza Mohammed Ridha Al-Khafaji
E-mail: [email protected]

Experiment No. 2
4-Bit Binary Adder/Subtractor
1. Introduction
1. Objective:
• To understand how to convert numbers from binary to decimal format and vice versa.
• To study parallel adding and subtraction of 4-bit binary numbers with carry.

1.2 Components:
• ST2611 Digital Circuit Development Platform trainer with power supply cord
• DB19 4-Bit Parallel Adder/Subtractor
• Set of wires

1.3 Theory:
In order to understand the binary arithmetic circuits and the principles of addition and subtraction,
we need to know how to convert between binary and decimal numbers. In the decimal system, each
position from the right represents a larger power of ten, starting with 100. For example:
199610 = 1 × 103 + 9 × 102 + 9 × 101 + 6 × 100
Likewise, in the binary number system, which is also positional, each position from the right
represents a larger power of two, starting with 20.
Binary to Decimal Conversion
For any binary number in a column i, add the decimal number represented by 2 to the ith power
when the binary number is 1 and ignore when it is zero. For example:
• Number to be converted: 1 0 1 0 1 1 0 1
• Power of 2 of columns: 27 26 25 24 23 22 21 20
• Number represented: 128 64 32 16 8 4 2 1
• Thus the decimal number is: 128 + 0 + 32 + 0 + 8 + 4 + 0 + 1 = 173

Decimal to Binary Conversion


For decimal to binary conversion, we have two methods. The easiest way to convert decimal integers
to binary is the method of Successive Division. In this method, we simply divide the decimal number
by 2. The quotient becomes the new number to divide again while the remainder, which will always
be 1 or 0, becomes one bit of the binary number, least significant digit first. The last quotient will

Al-Mustaqbal University College 1/6 https://www.uomus.edu.iq/


always be 0, and the last remainder always 1. Division continues until the quotient is 0 (with a last
remainder of 1). Thus, converting 26 to binary:
26 ÷ 2 = 13, remainder 0
13 ÷ 2 = 6, remainder 1
6 ÷ 2 = 3, remainder 0 1 1 0 1 0 2 = 2610
3 ÷ 2 = 1, remainder 1
1 ÷ 2 = 0, remainder 1
The other method to convert decimal to binary is called Subtraction method which can be done by
observing the number and subtracting it from the highest number of two to the power that is less than
or equal to the number that need to be converted. So, first you need to list the two to the power
values until you exceed the number. Such as the following example:
• Number to be converted is: 23
• List of the power of two: 25 24 23 22 21 20
• Number represented: 32 16 8 4 2 1
Now, subtract 23 from 16 because it is the highest number that is before 23
23 – 16 = 7 The higher number that is near to 7 but less than 7 is 4
7–4=3 The higher number that is near to 3 but less than 3 is 2
3–2=1 The higher number that is near to 1 is 1
As you can see the subtraction continue until you get to the last number which is 1.
Now, let’s list the values that are represented the power of two again and highlight the chosen
numbers then put 1 under the highlighted number and 0 for the other to get the binary number:
16 8 4 2 1
1 0 1 1 1
So, this is the binary number of 23 decimal number. As if you noticed we didn’t take the 32 into the
account because 0 to the left of the number doesn’t mean anything as we know.

Parallel Adder
In our experiment today, we will learn about adding two four-digit numbers to each other by using
the Parallel Adder which can add multiple-digit numbers, assuming that the addend would be the A
inputs, and the augend would be the B inputs. For this explanation, see the following addition:

Al-Mustaqbal University College 2/6 https://www.uomus.edu.iq/


As you can see 0 + 0 will give us 0, 0 + 1 will give us 1, same thing for 1 + 0 it will produce 1, but in
the case of 1 + 1 the number cannot be 2 as in normal addition because as we said previously the
binary numbers can only be 0 or 1. So in this case, the answer will be 0 with a carry out 1 where this
carry can be added to the number of the next column if there is one. For the following example, four
digits number (addend) will be added to another four digits number(augend), working from right to
left as we do in normal addition:

1 0 1 0

+ 0 0 1 0

1 1 0 0

1
Parallel Subtractor
Same as the Parallel Adder, the Parallel Subtractor can also subtract multiple-digit numbers, but we
will only discuss subtraction of two 4-digits numbers from each other for our experiment. See the
following explanation:

_ _ _ _

As you can see 0 - 0 will give us 0, 1 – 0 will give us 1, and 1 - 1 will produce 0, but in the case of 0
- 1 the number will be 1 after borrowing 1 from the next column where this borrow one will
represent as 2 since it would be taken from a higher significant leaving it equal to zero. Check the
following example where four digits number will be subtracted from another four digits number,
working from right to left as we do in normal subtraction:
Al-Mustaqbal University College 3/6 https://www.uomus.edu.iq/
2
0
1 0 1 0

_ 0 1 1 0

0 1 0 0

The DB19 4-Bit Parallel Adder/ Subtractor shown in Figure 1 is a compact, easy to use digital logic
board that will be used in this experiment. It is useful for students to get familiar with the basic
arithmetic operation of addition and subtraction and verify its truth table.

Figure 1: DB19 Panel 4-Bit Parallel Adder/Subtractor

2. Experiments:
2.1 Exercise 1 Adding Two 4-Bit Binary Numbers:
1. Place the DB19 panel shown in Figure 1 on the trainer.
2. To provide power to the board, connect +5 V pin from the trainer on the left side to +5V pin on
the DB19 using a wire.
3. Connect GND pin from the trainer on the left side to ground symbol pin on the DB19.
4. Turn on the power supply.
5. Move the dip switch on the top left side of the panel to Add mode.
6. To execute this exercise, move switches A1 to 1, A2 to 1, A3 to 0, A4 to 1.
Al-Mustaqbal University College 4/6 https://www.uomus.edu.iq/
7. Then move B1 to 1 and keep B2, B3, B4 at 0.
8. Observe the LED lights output on the right side of the panel and fill out Table 1.
9. Repeat for 3 more addition operations.
10. Verify the obtained Truth Table.
A4 A3 A2 A1 B4 B3 B2 B1 Carry S4 S3 S2 S1
1 0 1 1 0 0 0 1

Table 1: Addition of Two 4-Bit Binary Numbers.

2.2 Exercise 2 Subtraction of Two 4-Bit Binary Numbers:


1. Keep the previous connections.
2. Move the dip switch on the top right side of the panel to Sub mode.
3. Observe the LED lights output on the right side of the panel and fill out Table 2.
4. Repeat for 3 more subtraction operations.
5. Verify the obtained Truth Table.
A4 A3 A2 A1 B4 B3 B2 B1 Carry S4 S3 S2 S1
1 0 1 1 0 0 0 1

Table 2: Subtraction of Two 4-Bit Binary Numbers.

Al-Mustaqbal University College 5/6 https://www.uomus.edu.iq/


3. Discussion:
1. Convert the following binary numbers to decimal? (a) 10111012 ; (b) 11011102.
2. Convert the following decimal numbers to binary? (a) 3210 ; (b) 2910.
3. Add the following two binary numbers to each other and verify your solution.
0 1 1 0 1
+ 1 1 1 1 0

4. Subtract the following two binary numbers from each other and verify your solution.
1 0 0 0
- 0 1 0 1

5. How you can prove that the subtraction result of 1011 from 11001 is 14 in decimal
6. Solve the following equation where all numbers including x are binary:

x – 1001 = 11101

7. Here are 3 binary numbers:

1110101 1011110 1010011


Working in binary,

a. Add together the two smaller numbers,


b. Add together the two larger numbers,
c. Take the smallest number away from the largest number,
d. Add together all three numbers.

Al-Mustaqbal University College 6/6 https://www.uomus.edu.iq/

You might also like