0% found this document useful (0 votes)
17 views27 pages

Ch-02 Number System

NUmber System

Uploaded by

ori777ethio
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)
17 views27 pages

Ch-02 Number System

NUmber System

Uploaded by

ori777ethio
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/ 27

University of Gondar Institute of Technology

IoT
Digital Logic Design
(CoEng3092)

Lecture-02: Number System and Code

By Beyene Jember
Objectives
 Upon completion of this chapter, you will be able to:
 Convert a number from one number system (decimal, binary, hexadecimal) to
its equivalent in one of the other number systems.
 Cite the advantages of the hexadecimal number system.
 Count in hexadecimal.
 Represent decimal numbers using the BCD code; cite the pros and cons of
using BCD.
 Explain the difference between BCD and straight binary.
 Explain the purpose of alphanumeric codes such as the ASCII code.
 Explain the parity method for error detection.
 Determine the parity bit to be attached to a digital data strin 2
Introduction to Digital Logics
 The most common number system in Computer

 Humans operate using decimal numbers


 Digital systems operate using binary and
hexadecimal numbers.

3
Decimal System
 The decimal system is composed of 10 numerals or symbols(0 through 9).
 The decimal system, also called the base-10 system because it has 10 digits.
 Decimal numbers is a type of weighted system numbers.
 The position of each digit in a decimal number indicates the magnitude of the quantity
represented and can be assigned a weight.
 The value of a digit depends on its position.
 The weight
 The weights for whole numbers are positive powers of ten that increase from right to left.

 For fractional numbers, the weights are negative powers of ten that decrease from left to
right beginning with 10-1

4
Decimal System...
 Each number will be multiplied by its weight to get the actual number
 Example:
 Let’s consider 23 (in decimal number)

1. Express the decimal number 568.23 as a sum of the values of each digit.
2. Determine the value of each digit in 67.924.
5
Binary Numbers...
 The decimal number system does not lend itself to convenient implementation in
digital systems.
 It is very difficult to design electronic equipment so that it can work with 10 different
voltage levels.
 Almost every digital system uses the binary (base-2) number system as the basic
number system of its operations.
 It is very easy to design simple, accurate electronic circuits that operate with only
two voltage levels.
 In the binary system there are only two symbols or possible digit values, 0 and 1.
 It is less complicated compared to decimal numbers
 In general, with n bits we can count up to a number equal to 2n-1
 we can count through 2n different decimal numbers ranging from 0 to 2n - 1
6
Binary Numbers...
 The binary number system is a positional system where each binary digit (bit)
carries a certain weight based on its position relative to the LSB.
 It is represented using the positional number representation as

Which is an integer that has the value

7
Binary Numbers...
1. What is the total range of decimal values that can be represented in eight bits?
2. How many bits are needed to represent decimal values ranging from 0to 12,500?
Solution
1. Here we have N = 8. Thus, we can represent decimal numbers from 0 to 28 - 1 = 255.
We can verify this by checking to see that 111111112 converts to 25510.

1. With 13 bits, we can count from decimal 0 to 213 - 1 = 8191.


With 14 bits, we can count from 0 to 214 - 1 = 16,383.
Clearly, 13 bits aren’t enough, but 14 bits will get us up beyond 12,500.
Thus, the required number of bits is 14.

8
Binary Counting
 Binary numbers is usually restricted to a specific number of bits.
 It is based on the circuitry used to represent these binary numbers

Binary counting sequence.

9
 The binary counting sequence has an important characteristic
The weighting structure of binary numbers
 Binary numbers are weighted number systems.
 How the weights are structured?
 Based on powers of two, which begins with 0.
 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.
 The fractional weights decrease from left to right by a negative power of two for
each bit.

10
The weighting structure of binary numbers
 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 fractional weights decrease from left to right by a negative power of two for
each bit.
 The weight structure of a binary number is

where n is the number of bits from the binary point.

11
The weighting structure of binary numbers
 Binary Weights

12
Decimal-to-Binary Conversion
1. Sum-of-Weights Method.
 One way to find the binary number that is equivalent to a given decimal
number is to determine the set of binary weights whose sum is equal to the
decimal number
 Example, 9 can be expressed as the sum of binary weights as follows:

 Convert the following decimal numbers to binary:


a) 12 b) 25 c) 58 d) 82

13
Decimal-to-Binary Conversion
2. Repeated Division-by-2 Method
 A systematic method of converting whole numbers from decimal to binary.
 This method requires repeatedly dividing the decimal number by 2 and writing down
the remainder after each division until a quotient of 0 is obtained.
 The first remainder as the LSB and the last remainder as the MSB
 Process of convert decimal to any base
1. Divide the initial decimal number by the radix (base).
2. Place the remainder into the LSB (Least Significant Bit) digit of the converted
result.
3. Divide the current quotient by the radix.
4. Place the remainder into the next LSB digit of the converted result.
5. Repeat Step 3 and 4 until the quotient is 0.
14
Decimal-to-Binary Conversion

15
Decimal Fractions-to-Binary Conversion
 An easy way to remember fractional binary weights is that the most significant
weight is 0.5, which is 2-1, and that by halving any weight, you get the next lower
weight;
 A list of four fractional binary weights would be 0.5, 0.25, 0.125, 0.0625.
 Sum-of-Weights

There is a 1 in the 2-1 position, a 0 in the 2-2 position, and a 1 in the 2-3
position

16
Decimal Fractions-to-Binary Conversion
 Repeated Multiplication by 2((Successive Products)
 The process of converting decimal fractions
1. Multiply the initial decimal fraction by the radix.
2. Place the integer into the MSB (Most Significant Bit) digit of the converted
result.
3. Multiply the current fraction by the radix.
4. Place the integer into the next MSB digit of the converted result.
5. Repeat Step 3 and 4 until the fraction is 0 or the required number of bits
have been converted

17
Decimal Fractions-to-Binary Conversion
 Repeated Multiplication by 2((Successive Products)...

18
Binary to Decimal Conversion
 Any binary number can be converted to its decimal equivalent simply by adding
the weights of all bits that are 1 and discarding the weights of all bits that are 0.

 Methods to convert a binary to decimal number system.


 Positional Notation Method
 Doubling Method

19
Binary to Decimal Conversion
 Positional Notation Method
 Example 1:Convert the binary whole number 1101101 to decimal
 First determine the weight of each bit that is a .
 Next find the sum of the weights to get the decimal number.

 Example 2: Convert the binary whole number 101100101 to decimal

(256) + (64) + (32) + (4) + (1) = 35710


20
Binary to Decimal Conversion
 Positional Notation Method
 Example 3: Convert the fractional binary number 0.1011 to decimal.
 First determine the weight of each bit that is a .
 Next find the sum of the weights to get the decimal number.

21
Binary to Decimal Conversion
 Doubling Method
 Another method of binary-to-decimal conversion that avoids the addition of
large numbers and keeping track of column weights.
 The procedure is as follows
1. Write down the left-most 1 in the binary number.
2. Double it and add the next bit to the right.
3. Write down the result under the next bit.
4. Continue with steps 2 and 3 until finished with the binary number.

22
Binary to Decimal Conversion
 Doubling Method

23
Power of Two

 Special Powers of 2
 210 = 1024 ≈103 is Kilo, denoted by “K”
 220 = 1,048,576 ≈106 is Mega, denoted by “M”
 230 = 1,073,741,824 ≈109 is Giga, denoted by “G”
 240 = 1,099, 511, 627, 776 ≈1012 is Tera, denoted by “T” 24
Hexadecimal number System

25
Binary Codes
 An n bit binary code can have up to 2n distinct combinations of 1’s and 0’s, with
each combination representing one element of the information set that is being
coded.
 A set of four elements can be coded using two bits: 00, 01, 10,11.
 A set of eight elements requires a 3bit code and a set of 16 elements requires a 4-
bit code. (What are these codes?).
 The bit combination of an n bit code is the count in binary from 0 to 2n - 1.
 Each element must be assigned a unique binary bit combination, and no two
elements can have the same value; otherwise, the code assignment will be
ambiguous.

26

You might also like