0% found this document useful (0 votes)
37 views12 pages

Number Systems: Decimal, Binary, Octal, Hexadecimal

The document provides an overview of various number systems including decimal, binary, octal, and hexadecimal, explaining their positional values and conversion methods. It details how to convert between these systems using examples, emphasizing the importance of binary in digital logic design. Additionally, it discusses the advantages of using octal and hexadecimal systems for representing binary data more succinctly.

Uploaded by

25ai1aj12
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)
37 views12 pages

Number Systems: Decimal, Binary, Octal, Hexadecimal

The document provides an overview of various number systems including decimal, binary, octal, and hexadecimal, explaining their positional values and conversion methods. It details how to convert between these systems using examples, emphasizing the importance of binary in digital logic design. Additionally, it discusses the advantages of using octal and hexadecimal systems for representing binary data more succinctly.

Uploaded by

25ai1aj12
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

UNIT-1

DIGITAL LOGIC DESIGN


 Decimal point used to separate the integer and fractional part of the
number.
 Formal notation→ .
 Decimal position values of powers of (10).

Positional values "weights"

2 7 7 8 3 . 2 3 4 5
MSD LSD

Binary numbers:

 Base-2 system (0 or 1).


 We can represent any quantity that can be represented in decimal or
other number systems using binary numbers.
 Binary number is also positional–value system (power of 2).
Example: 1101.011

1 1 0 1 . 0 1 1
MSD LSD
Notes:
 To find the equivalent of binary numbers in decimal system , we
simply take the sum of products of each digit value (0,1)and its
positional value:

Example:

= (1× ) + (0× ) + (1× ) + (1× )+ (1× )+ (0× ) +(1× )

=8+0+2+1+ +0+ =

In general, any number (decimal, binary, octal and


hexadecimal) is simply the sum of products of each digit
value and its positional value.
 In binary system, the term binary digit is often called bit.
 Binary values at the output of digital system must be converted to
decimal values for presentation to the outside world.
 Decimal values must be converted into the digital system.
 Group of 8 bits are called a byte.

Octal Number System

 octal number system has a base of 8 : (0,1,2,3,4,5,6,7)

Examples:

 (1101.011)8

1 1 0 1 . 0 1 1
MSD LSD

= (4× ) + (3× ) + (2× ) + (7× )

= (3× ) + (7× ) + (2× ) + (3× )+ (6× )

Note: octal number don’t use digits 8 or 9

Hexadecimal number system (16-base)

 Hexadecimal numbers are made of 16 digits, it uses the digits 0


through 9 plus the letters A, B, C, D, E, F.

Examples:

= (10× ) + (2× ) + (9× )=

= (2× ) + (12× ) + (7× ) + (7× )+ (3× )+ (8× )

Note:
 For hex numbers the digits 10, 11, 12, 13, 14, 15 are
represented by a, b, c, d, e, f as shown in the following table:

Number Systems
Decimal Binary Octal Hex
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

2. Counting in decimal ,binary, octal and hexadecimal


systems
Decimal counting:

o Start with 0 in the units position and take each digit in


progression until reach 9.
o Add 1 to the next higher position and start over 0 in the first
position.
o Continue process until the count 99.
o Add 1 to the third position and start over with 0 in the first
position.

Note: the largest number that can be represented using


8 bits is
-1= -1=
Counting in hexadecimal:

 For n hex digit positions, we can count for decimal 0 to -1, for
a total of different values.
 The general representation for a number in the form:
.
Using r-base/radix number system, in which the number of radix
r can be written as
=....+ + + +
+ + + +...
Numbering System Radix
Decimal r=10
Binary r=2
Octal r=8
Hex r=16
Counting in binary system: (counting range)

 Using n bits, we can represent decimal numbers ranging from 0 to


, a total of different numbers.

Examples:

 for n=4 bits

We can count from 0000 to (see table above) which is to


(16 different numbers).

 How many bits are needed to represent decimal values


ranging from 0 to 12500?

Answer:

 With 13 bits , we can count from 0 to -1 =8191 (not enough)


 With 14 bits , we can count from 0 to -1 =16.383 (okay)
 What is the total range of decimal values that can be
represented in 8 bits?

Answer:

For N=8, we can represent form 0 to -1 =255.


a) Binary to decimal conversions:
 Rule: any binary number can be converted to its decimal equivalent
simply by summing together the weights of the various positions in
the binary number which contains a 1.

Example 1: Convert 110112 to its decimal equivalent

1 1 0 1 1

+ + + = 16+8+2+1= 2710

24 +23 0 21 20

Example 2: Convert 101101012 to decimal equivalent

27 + 0+ 25+ 24+ 0+ 22+ 0+ 20 = 18110

b) Decimal to binary conversions:


 There are two ways to convert a decimal number to its equivalent
binary representation
1. The reverse of the binary-to-decimal conversion process
(optional). The decimal number is simply expressed as a sum
of powers of 2 and then 12 and 02 are written in the appropriate
bit positions.
Example 1:-Convert 4510 to binary number

4510 = 32+ 8+ 4+ 1= 25+ 0+ 23+ 22+ 0+ 20 =101101(2)

Example 2:-Convert 7610 to binary number

7610= 64+ 8+ 4 = 26+ 23+ 22 = 10011002

2. Repeated division: Repeating division the decimal number by


2 and writing down the remainder after each division until a
quotient of 0 is obtained.
Note:
The binary result is obtained by writing the first
remainder as the LSB and the last remainder as the MSB.
General Rule 1: Conversion from decimal to other base

1. Divide decimal number by the base (2, 8, 16,…).


2. The remainder is the lowest-order digit.
3. Repeat first two steps unit no divisor remains.
General Rule 2: Decimal fraction conversion to anther base

1. Multiply decimal number by the base (2, 8,…).


2. The integer is the highest-order digit.
3. Repeat first two steps until fraction becomes
zero.

Example 1 Convert 2510 to binary number

= 12 + remainder of 1 (LSB)

= 6 + remainder of 0

= 3 + remainder of 0

= 1 + remainder of 1

= 0 + remainder of 1 (MSB)

2510 = 1 1 0 0 12

Example 2 Convert 1310 to binary number

Division by 2 Quotient integer remainder


6 1 (a0)

=
3 0 (a1)

1 1 (a2)

0 1 (a3)
Answer (13)10 = (a3 a2 a1 a0) = (1101)2
Example 3: Convert 0.62510 to binary number
Multiply by 2 Integer Fraction coefficient
0.625*2 = 1 + 0.25 a1 = 1

0.250*2 = 0 + 0.50 a2 = 0

0.500*2 = 1 + 0(stop) a3 = 1
Correct
Answer (0.625)10 = (0.a1 a2 a3)2 = (0.101)2 order

c) Octal-to-decimal
 To convert, we need to multiply each octal digit by its positional
weight.

Example 1

372(8) = (3*82) + (7*81) + (2*80) = (3*64) + 56+2 = 25010

Example 2

24.68 = (2*81) + (4*80) + (6*8-1) = 20.7510

d) Decimal to octal
 Repeated division by 8.

Example 1: Convert 26610 to octal number.

= 33 + remainder of 2 (LSD)

= 4 + remainder of 1

= 0 + remainder of 4

26610 = 4 1 2(8)
Example 2: Convert 0.3510 to octal number.
Multiply by 8 Integer Fraction coefficient
0.35*8= 2 + 0.80 a1 = 2

Repeated 0.8*8 = 6 + 0.40 a2 = 6


“stop”
0.4*8 = 3 + 0.20 a3 = 3

0.2*8 = 1 + 0.60 a4 =1

0.6*8 = 4 + 0.80 a5 =4

Answer (0.35)10 = (0.a1 a2 a3 a4 a5)2 = (0.26314)8 Correct


order
e) Hexa-to-decimal

Example 1:-Convert 356(16) to decimal:

356(16) =

(3*162) + (5*161) + (6*160) = 3*256 + 80 +6 = 854(10)

Example 2:-Convert 2AF(16) to decimal:


2AF(16) =

(2*162) + (10*161) + (15*160) = 512+160+15 = 687(10)

f) Decimal-to-hexa:(using repeated division by 16)


Example 1: Convert 42310 to hex number.

= 26 + remainder of 7 (LSD)

= 1 + remainder of 10

= 0 + remainder of 1

42310 = 1 A 7(16)
g) Hexa-to-binary:
 Each hexa digit is converted to its four-bit binary equivalent:

Example 1: Convert 9F2(16) to its binary equivalent

9 F 2

1001 1111 0010

9F2(16) = 100111110010(2)

Example 2: Convert BA6(16) to binary equivalent

BA6(16) = (1011 1010 0110)2

h) Binary-to-hexa
 The binary numbers are grouped into groups of four bits and each
group is converted to its equivalent hexa digit.
 Zeros are added as needed to complete a four-bit group.

Example 1: Convert 1110100110(2) to hexa equivalent

Solution:
Added
0011 1010 0110
zeros
3 A 6

1110100110(2) = 3A6(16)

Example 2: Convert 1010111112 to hexa equivalent

Solution:

1 0101 11112 = 15F(16)

i) Octal to binary conversion:


 Conversion each octal digit to its three bit binary equivalent.
Conversion Table
Octal digit 0 1 2 3 4 5 6 7
Binary
000 001 010 011 100 101 110 111
equivalent
 Using this table, we can convert any octal number to binary by
individually converting each digit.

Example 1: Convert 472(8) to binary number

Solution:

4 7 2

100 111 010

472(8)) = 100111010(2)

Example 2: Convert 5431(8) to binary number

Solution:

5431(8) = 101 100 011 001 = 101100011001(2)

j) Binary to octal conversion:


 The bits of the binary number are grouped into group of 3 bits
starting at the LSB, then each group is converted to its octal
equivalent (see table).

Example 1: Convert 11010110(2) to octal equivalent

Solution:
Added
011 010 110
zero
3 2 6

11010110(2) = 326(8)

Note:
Zero was placed to the left of the MSB to produce groups
of 3 bits.

General example:

Convert 17710 to its eight-bit binary equivalent by first


converting to octal.
Solution:

= 22 + remainder of 1 (LSD)

= 2 + remainder of 6

= 0 + remainder of 2

17710 = 2 6 1(8)

 Thus 17710 = 261(8), now we can quickly convert this octal number
to its binary equivalent 010110001 to get eight bit representation.
So:

Important Note: this method of decimal-to-octal-to-binary


conversion is often quicker than going directly from
decimal to binary, especially for large numbers.

4. Advantage of octal and hexadecimal systems:


1. Hexa and octal number are used as a "short hand" way to represent
stings of bits.
2. Error prone to write the binary number, in hex and octal less error.
3. The octal and hexadecimal number systems are both used (in
memory addressing and microprocessor technology).

You might also like