Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

Computer learning 2

Uploaded by

hhcf2321
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Computer learning 2

Uploaded by

hhcf2321
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Computer Fundamentals

Dr. Abdulsalam Abdullah

Tuesday 12 November 2024


INTRODUCTION

NUMBER SYSTEMS AND CONVERSION


Objectives
Topics introduced in this chapter:
• Difference between Analog and Digital System
• Difference between Combinational and Sequential Circuits
• Binary number and digital systems
• Number systems and Conversion
• Binary Arithmetic
Digital Systems and Switching Circuits

• Digital systems: computation, data processing, control,

communication, measurement
- Reliable, Integration
• Analog – Continuous
- Natural Phenomena
(Pressure, Temperature, Speed…)
- Difficulty in realizing, processing using electronics
• Digital – Discrete
- Binary Digit ➔ Signal Processing as Bit unit
- Easy in realizing, processing using electronics
- High performance due to Integrated Circuit Technology
Binary Digit?

• Binary:- Two values(0, 1)


- Each digit is called as a “bit”

Good things in Binary Number


- Number representation with only two values (0,1)
- Can be implemented with simple electronics devices
(ex: Voltage High(1), Low(0)
Switch On (1) Off(0)…)
Switching Circuit

• Combinational Circuit :

outputs depend on only present inputs, not on past inputs


• Sequential Circuit:
- outputs depend on both present inputs and past inputs
- have “memory” function
Base-N Number System

• Base N
• N Digits: 0, 1, 2, 3, 4, 5, …, N-1
• Example: 1045N
• Positional Number System
n −1 4 3 2 1 0
N N N N N N
d n −1 d 4 d3 d 2 d1 d 0
• Digit do is the least significant digit (LSD).
• Digit dn-1 is the most significant digit (MSD).
7
Decimal Number System
• Base 10
• Ten Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• Example: 104510
• Positional Number System

n −1 4 3 2 1 0
10 10 10 10 10 10
d n −1 d 4 d3 d 2 d1 d 0
• Digit d0 is the least significant digit (LSD).
• Digit dn-1 is the most significant digit (MSD).
8
Binary Number System

• Base 2
• Two Digits: 0, 1
• Example: 10101102
• Positional Number System
n −1 4 3 2 1 0
2 2 22 22
bn −1 b4 b3 b2 b1 b0
• Binary Digits are called Bits
• Bit bo is the least significant bit (LSB).
• Bit bn-1 is the most significant bit (MSB). 9
Octal Number System

• Base 8
• Ten Digits: 0, 1, 2, 3, 4, 5, 6, 7
• Example: 10458
• Positional Number System
8n-1 … 84 83 82 81 80

• Digit d0 is the least significant digit (LSD).


• Digit dn-1 is the most significant digit (MSD).

10
Hexadecimal Number System

• Base 16
• Sixteen Digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
• Example: EF5616
• Positional Number System
n−1 4 3 2 1 0
16 16 16 16 16 16
0000 0 0100 4 1000 8 1100 C
0001 1 0101 5 1001 9 1101 D
0010 2 0110 6 1010 A 1110 E
0011 3 0111 7 1011 B 1111 F
11
Number systems
include decimal, binary, octal and hexadecimal

Number System Base


Binary Base 2
Octal Base 8
Decimal Base 10
Hexadecimal Base 16
Number Conversions

13
Decimal to Binary Conversion

Method I:

Use repeated subtraction.

Subtract largest power of 2, then next largest, etc.

20 21 22 23 24 25 26 27 28 29 210 2n

Powers of 2: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2n

Exponent: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 , n
Decimal to Binary Conversion

Suppose x = 156410
Subtract 1024: 1564-1024 (210) = 540  n=10 or 1 in the (210)’s position
Subtract 512: 540-512 (29) = 28  n=9 or 1 in the (29)’s position
28=256, 27=128, 26=64, 25=32 > 28, so we have 0 in all of these positions
Subtract 16: 28-16 (24) = 12  n=4 or 1 in (24)’s position
Subtract 8: 12 – 8 (23) = 4  n=3 or 1 in (23)’s position
Subtract 4: 4 – 4 (22) = 0  n=2 or 1 in (22)’s position
Thus:
20 21 22 23 24 25 26 27 28 29 210
0 0 1 1 1 0 0 0 0 1 1

156410 = (1 1 0 0 0 0 1 1 1 0 0)2
Decimal to Binary Conversion

Method II:
Use repeated division by radix.

2 | 1564 2|__24_
782
2|_____ R=0 12
2|_____ R=0


391
2|_____ R=0 6
2|_____ R=0
195
2|_____ R=1 3
2|_____ R= 0
97
2|____ R=1 1
2|_____ R=1
48
2|_____ R=1 0 R=1
24 R=0
Collect remainders in reverse order
11000011100
Example 2: Decimal to Binary Conversion

2 53

2 26 rem. = 1 = a0

2 13 rem. = 0 = a1

5310 = 1101012
2 6 rem. = 1 = a2

rem. = 0 = a3
2 3

rem. = 1 = a4
2 1

rem. = 1 = a5
0
Example: Convert 0.7 to binary

.7
2
(1).4
2
(0).8
2
(1).6
2
(1).2
2
(0).4 Process starts repeating here because .4 was previously
obtained
2
(0).8 0.710 − 0.1 0110 0110 0110   2
Decimal to Octal Conversion

Division Quotient Remainder

44978 / 8 5622 2
5622 / 8 702 6
702/8 87 6
87/8 10 7
10/8 1 2
1/8 0 1

4497810 = 1276628
Decimal to Hex Conversion

Use repeated division by radix.

16 | 1564


97
16|_____ R = 12 = C
6
16|_____ R=1
0 R=6

N = 61C 16
Binary to Decimal Conversion

Ex: (11001100)2 = ( 204 ) 10

28 27 26 25 24 23 22 21 20

256 128 + 64 32 16 8 + 4 2 1
1 1 0 0 1 1 0 0
Binary to Octal Conversion

1. Divide binary number into 3-bit groups

011000011100

2. Substitute Octa digit for each group

30348
Binary to Hex Conversion

1. Divide binary number into 4-bit groups

011000011100

2. Substitute hex digit for each group

61C16
Octal to Binary Conversion Example

Convert each Octal digit to equivalent binary


(1 6 2)8

(001 110 010)2

24
Hexadecimal to Binary Conversion Example

Convert each hex digit to equivalent binary

(1 E 9 C)16

(0001 1110 1001 1100)2

25
Conversion of Binary to Octal, Hexa-decimal

• (101011010111 )2
=( )8, octal

• (10111011)2
=( )8, octal

• (1010111100100101)2
=( )16, Hexadecimal

• (1101101000)2
=( )16, Hexadecimal

You might also like