You are on page 1of 27

Digital Electronics

Unit – 1
Number Systems and
Codes

Dr. Anil Kannur


Assistant Professor, Department of Computer Science & Engineering
Introduction to Number Systems: Types-Decimal, Binary, Octal,
Hexadecimal; Conversion from one number system to other
Agenda
01 Objectives, Why Binary System?
of Todays’ Class
02 Number Systems and Types

Conversion from one number


03 system to other
Objectives

4
1 2 3

Understand Understand Understand


Understand how to
how to how to
why convert
convert convert
computers Base-16
Base-2 Base-8
use binary numbers to
numbers to numbers to
(Base-2) Base-10, Base-2
Base-10 Base-10
numbering. or Base-8
or Base-8 or Base 2
❑ Computers are made of a series of switches
Why
❑ Each switch has two states: ON or OFF
Binary
❑ Each state can be represented by a number –
System? 1 for “ON” and 0 for “OFF”
❑ You probably already know
Decimal what a number system is -
Numbers ever hear of binary numbers
Base-10 or hexadecimal numbers?
(0 to 9)

Number Binary Hexadecimal ❑ Simply put, a number system


Numbers Numbers is a way to represent numbers.
Systems Base-2 Base-16
and Types (0 and 1) (0 to 9, A to F) ❑ We are used to using the base-
Octal 10 number system, which is
Numbers also called decimal.
Base-8
(0 to 7) ❑ Other common number
systems include base-16
(hexadecimal), base-8 (octal),
and base-2 (binary).
Decimal Numbers
The Decimal Number System uses base 10. It includes the digits {0, 1,2,…, 9}.
The weighted values for each position are:
Base

10^4 10^3 10^2 10^1 10^0 10^-1 10^-2 10^-3

10000 1000 100 10 1 0.1 0.01 0.001

Left of the decimal point Right of decimal point


7
Binary Numbers
Most modern computer system using binary logic. The computer represents
values(0,1) using two voltage levels (usually 0V for logic 0 and +5V for logic 1).
The Binary Number System uses base 2 includes only the digits 0 and 1.
The weighted values for each position are :
Base

2^5 2^4 2^3 2^2 2^1 2^0 2^-1 2^-2

32 16 8 4 2 1 0.5 0.25
Octal Numbers
Computer scientists are often looking for shortcuts to do things.
One of the ways in which we can represent binary numbers is to use their octal equivalents instead
This is especially helpful when we have to do fairly complicated tasks using numbers.
The octal numbering system includes eight base digits (0-7). After 7, the next placeholder to the right
begins with a “1”. The Octal numbers are: 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13 ...
Base

8^5 8^4 8^3 8^2 8^1 8^0 8^-1 8^-2

32768 4096 512 64 8 1 0.125 0.015625


Hexadecimal Numbers
The hexadecimal number system is a radix-16 number system and its 16 basic digits are 0, 1, 2, 3, 4, 5, 6,
7, 8, 9, A, B, C, D, E and F.

The decimal equivalent of A, B, C, D, E and F are 10, 11, 12, 13, 14 and 15 respectively, for obvious
reasons

The hexadecimal number system provides a condensed way of representing large binary numbers
stored and processed inside the computer. One such example is in representing addresses of different
memory locations.
Base

16^3 16^2 16^1 16^0 16^-1

4096 256 16 1 0.0625


Conversion
from one
number
system to
other
Binary to Decimal Conversion

The decimal equivalent of the binary number (1011.0101)2 is determined as follows:


• The integer part = 1011
• The decimal equivalent = 1 × 23+ 0 × 22 + 1 × 21 + 1 × 20 = 8 + 0 + 2 + 1 = 11
• The fractional part = .0101
• Therefore, the decimal equivalent = 0 × 2−1 + 1 × 2−2 + 0 × 2−3 + 1 × 2−4
= 0 + 0.25 + 0 + 0.0625 = 0.3125
• Therefore, the decimal equivalent of (1001.0101)2 = 11.3125
Binary to Decimal Conversion
TEST
Convert the following binary numbers into decimal numbers:

Binary 1001 = 9
Binary 1111 = 15

Binary 0010 = 2
Decimal to Binary Conversion
Divide by 2 Process
Decimal # 13 ÷ 2 = 6 remainder 1

6 ÷ 2 = 3 remainder 0

3 ÷ 2 = 1 remainder 1

1 ÷ 2 = 0 remainder 1

1 1 0 1
Decimal to Binary Conversion
TEST
Convert the following decimal numbers into binary:

Decimal 11 = 1011

Decimal 4 = 0100

Decimal 17 = 10001
Octal to Decimal Conversion
The decimal equivalent of the octal number (137.21)8 is determined as follows:
• The integer part = 137
• The decimal equivalent = 1 × 83 + 3 × 81 + 7 × 80 = 64 + 24 + 7 = 95

The fractional part = .21


• The decimal equivalent = 2 × 8−1 + 1 × 8−2 = 0.265
• Therefore, the decimal equivalent of (137.21)8 = (95.265)10
Octal to Decimal Conversion
TEST
Convert the following Octal numbers into decimal numbers:

Octal 10 = 8
Octal 73 = 59

Octal 24 = 20
Decimal to Octal Conversion
Divide by 8 Process
Decimal # 73 ÷ 8 = 9 remainder 1

9 ÷ 8 = 1 remainder 1

1 ÷ 8 = 1 remainder 1

1 1 1
Decimal to Octal Conversion
TEST
Convert the following decimal numbers into octal:

Decimal 11 = 13

Decimal 4 = 4

Decimal 17 = 21
Hexadecimal to Decimal Conversion

The decimal equivalent of the hexadecimal number (1E0.2A)16 is determined as follows:


• The integer part = 1E0
• The decimal equivalent = 1 × 162 + 14 × 161 + 0 × 160 = 256 + 224 + 0 = 480
• The fractional part = 2A
• The decimal equivalent = 2 × 16−1 + 10 × 16−2 = 0.164
• Therefore, the decimal equivalent of (1E0.2A)16 = (480.164)10
Hexadecimal to Decimal Conversion
TEST
Convert the following Hexadecimal numbers into decimal numbers:

Hexadecimal 1F = 31
Hexadecimal 73 = 115

Hexadecimal 2A = 42
Decimal to Hexadecimal Conversion
Divide by 16 Process
Decimal # 82 ÷ 16 = 5 remainder 2

5 ÷ 16 = 5 remainder 5

5 2
Decimal to Hexadecimal Conversion
TEST
Convert the following decimal numbers into
Hexadecimal:

Decimal 121 = 79

Decimal 45 = 2D

Decimal 73 = 49
Binary to Octal and Vice Versa
• The given octal number = (374.26)8 Octal Binary
• The binary equivalent = (011 111 100.010 110)2 = 0 000
(011111100.010110)2 1 001
2 010
• Any 0s on the extreme left of the integer part and extreme right of 3 011
the fractional part of the equivalent 4 100
5 101
binary number should be omitted. Therefore,
6 110
(011111100.010110)2 = (11111100.01011)2
7 111
• The given binary number = (1110100.0100111)2 10 001 000
= (1 110 100.010 011 1)2 11 001 001

= (001 110 100.010 011 100)2
= (164.234)8
Hexadecimal Binary
Binary to Hexadecimal and Vice Versa 0 0000
1 0001
2 0010
• The given hex number = (17E.F6)16
3 0011
• The binary equivalent = (0001 0111 1110.1111 0110)2
4 0100
= (000101111110.11110110)2 5 0101
= (101111110.1111011)2 6 0110
7 0111
• The 0s on the extreme left of the integer part and on the
8 1000
extreme right of the fractional part have been omitted.
9 1001
• The given binary number = (1011001110.011011101)2 A 1010
= (10 1100 1110.0110 1110 1)2 B 1011

• The hex equivalent = (0010 1100 1110.0110 1110 1000)2 C 1100


D 1101
= (2CE.6E8)16
E 1110
F 1111
Unit 1, 2 & 3 Unit 4, 5 & 6

Digital Microprocessor
Electronics Architecture,
Principles, Programming,

TEXTBOOKS FOR Devices and


Applications
and Applications
with the 8085

REFERENCE By By
Anil K. Maini Ramesh Gaonkar

Wiley Prentice Hall


Publications Publications
ANY QUESTIONS?

You might also like