0% found this document useful (0 votes)
38 views28 pages

Chap 2

Uploaded by

Milon Ahmed
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)
38 views28 pages

Chap 2

Uploaded by

Milon Ahmed
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/ 28

Chapter 2

Number Systems,
Operations, and Codes
Prepared by
MIR MUNTASIR HOSSAIN
Lecturer, EEE
Northern University Bangladesh
Chapter Outline
 Binary Numbers
 Binary Arithmetic
 Complements of Binary Numbers
 Hexadecimal Numbers
 Binary Coded Decimal
 The Gray Code

2
Mir Muntasir Hossain
Binary Numbers
 Binary system has only two digits.
 The two binary digits (bits) are 1 and 0.
 Four bits are required to count from zero
to 15. In general, with n bits you can count
up to a number equal to 2n - 1.
So, Largest decimal number = 2n – 1
 For example, with five bits (n = 5) you can
count from zero to thirty-one.
25 - 1 = 32 - 1 = 31

3
Mir Muntasir Hossain
The Weighting Structure of Binary Numbers
 The right-most bit is the LSB (least significant bit) in a binary whole number and
has a weight of 20 = 1.
 The weights increase from right to left by a power of two for each bit.
 The left-most bit is the MSB (most significant bit); its weight depends on the
size of the binary number.
 Fractional numbers can also be represented in binary by placing bits to the right
of the binary point.
 The left-most bit is the MSB in a binary fractional number and has a weight of
2-1 = 0.5.
 The weight structure of a binary number is

4
Mir Muntasir Hossain
Binary-to-Decimal Conversion

5
Mir Muntasir Hossain
6
Mir Muntasir Hossain
Decimal-to-Binary Conversion (Repeated Division-by-2 Method)
EXAMPLE 2–6
Convert the
following decimal
numbers to binary:
(a) 19 (b) 45

7
Mir Muntasir Hossain
Converting Decimal Fractions to Binary (Repeated Multiplication
by 2 Method)

8
Mir Muntasir Hossain
Binary Arithmetic

9
Mir Muntasir Hossain
10
Mir Muntasir Hossain
Additional Example
11000
− 111
10001

11
Mir Muntasir Hossain
12
Mir Muntasir Hossain
13
Mir Muntasir Hossain
Complements of Binary Numbers

14
Mir Muntasir Hossain
15
Mir Muntasir Hossain
Hexadecimal Numbers
 The hexadecimal number system has a
base of sixteen; that is, it is composed of
16 numeric and alphabetic characters.
 It is used primarily as a compact way of
displaying or writing binary numbers
because it is very easy to convert
between binary and hexadecimal.
 Also, long binary numbers are difficult to
read and write because it is easy to drop
or transpose a bit.
 Hexadecimal is widely used in computer
and microprocessor applications.

16
Mir Muntasir Hossain
Binary-to-Hexadecimal Conversion

17
Mir Muntasir Hossain
Hexadecimal-to-Binary Conversion

18
Mir Muntasir Hossain
Hexadecimal-to-Decimal Conversion

19
Mir Muntasir Hossain
Another way to convert a hexadecimal number to its decimal equivalent:
For a 4-digit hexadecimal number, the weights are

20
Mir Muntasir Hossain
Decimal-to-Hexadecimal Conversion
EXAMPLE 2–28
Convert the decimal number 650 to hexadecimal by repeated division by 16.

21
Mir Muntasir Hossain
Binary Coded Decimal (BCD)
 Binary coded decimal (BCD) is a way to express each of the decimal digits with a binary
code.
 There are only ten code groups in the BCD system, so it is very easy to convert
between decimal and BCD.
 Because we like to read and write in decimal, the BCD code provides an excellent
interface to binary systems.
 Examples of such interfaces are keypad inputs and digital readouts.
 The 8421 code is a type of BCD (binary coded decimal) code.
 The designation 8421 indicates the binary weights of the four bits (23, 22, 21, 20).
 The ease of conversion between 8421 code numbers and the familiar decimal numbers
is the main advantage of this code.
 Applications
Digital clocks, digital thermometers, digital meters, and other devices with seven
segment displays typically use BCD code to simplify the displaying of decimal numbers.
22
Mir Muntasir Hossain
23
Mir Muntasir Hossain
24
Mir Muntasir Hossain
The Gray Code
 The important feature of the Gray code is that it exhibits only a single bit change
from one code word to the next in sequence.

25
Mir Muntasir Hossain
26
Mir Muntasir Hossain
Additional Examples

27
Mir Muntasir Hossain
Reference Book
Digital Fundamentals, 11th Edition
Thomas L. Floyd
©2015 |Pearson |

28
Mir Muntasir Hossain

You might also like