0% found this document useful (0 votes)
14 views

Lecture # 02 Part A Number System

Digital Logic Design

Uploaded by

shahzadafnan95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Lecture # 02 Part A Number System

Digital Logic Design

Uploaded by

shahzadafnan95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 55

McGraw-Hill Technology Copyright © 2006 by The McGraw-Hill Companies, Inc.

All
McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies, Inc. All
Chapter 5A

Transforming Data Into


Information

McGraw-Hill Technology Copyright © 2006 by The McGraw-Hill Companies, Inc. All


How Computers Represent Data
• Number systems
– A manner of counting
– Several different number systems exist
• Decimal number system
– Used by humans to count
– Contains ten distinct digits
– Digits combine to make larger numbers

5A-3
• Binary
• Decimal
• Octal
• Hexa decimal

5A-4
How Computers Represent Data
• Binary number system
– Used by computers to count
– Two distinct digits, 0 and 1
– 0 and 1 combine to make numbers

5A-5
How Computers Represent Data
• Bits and bytes
– Binary numbers are made of bits
– Bit represents a switch
– A byte is 8 bits
– Byte represents one character

5A-6
How Computers Represent Data
• Text codes
– Converts letters into binary
– Standard codes necessary for data transfer
ASCII
• American Standard Code
for Information Interchange
• It is binary code used to handle text using the
English alphabet, numbers, and other common
symbols.
• The code includes definitions for 128
characters.
5A-7
• Why needed?
5A-8
• Standard ascii codes are(7 bit code)
128(0-127)
• 27=128
• but Extended ASCII are 28=256

• Extended ascii codes are 128+128= 256


• (0-255)

5A-9
Ascii codes

5A-10
Extended ASCII CODES

5A-11
How Computers Represent Data
• Most of these are the printable characters of the alphabet
such as abc, ABC, 123, and ?&!.
• There are also control characters that cannot be
printed but instead control how text is processed, to
start a new line for example
Extended ASCII
Eight bit code.
Specifies the character for values from 128-255.
First 40 symbols represent punctuation and special
punctuation.
• Remaining shows Graphics
Unicode
5A-12 • All languages on the planet
How Computers Represent Data
• Unicode
• All languages on the planet
• Provide up to 4bytes(32bits) to represent each letter,
number or symbol.
• With four bytes Unicode represent more than 14billion
different character and symbol.
• This is enough for every unique character and symbol
in the world include chines,Korean and Japanese
character.

5A-13
1. Number Systems

McGraw-Hill Technology Copyright © 2006 by The McGraw-Hill Companies, Inc. All


Conversion Among Bases
• The possibilities:

Decimal Octal

Binary Hexadecimal

pp. 40-46
Quick Example

2510 = 110012 = 318 = 1916

Base
Binary to Decimal

Decimal Octal

Binary Hexadecimal
Binary to Decimal
• Technique
– Multiply each bit by 2n, where n is the
“weight” of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results
Example
Bit “0”

1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
Octal to Decimal

Decimal Octal

Binary Hexadecimal
Octal to Decimal
• Technique
– Multiply each bit by 8n, where n is the
“weight” of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results
Example

7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
Hexadecimal to Decimal

Decimal Octal

Binary Hexadecimal
Hexadecimal to Decimal
• Technique
– Multiply each bit by 16n, where n is the
“weight” of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results
Example

ABC16 => C x 160 = 12 x 1 = 12


B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
Decimal to Binary

Decimal Octal

Binary Hexadecimal
Decimal to Binary
• Technique
– Divide by two, keep track of the remainder
– First remainder is bit 0 (LSB, least-
significant bit)
– Second remainder is bit 1
– Etc.
Example
12510 = ?2 2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1

12510 = 11111012
Octal to Binary

Decimal Octal

Binary Hexadecimal
Octal to Binary
• Technique
– Convert each octal digit to a 3-bit
equivalent binary representation
Example
7058 = ?2

7 0 5

111 000 101

7058 = 1110001012
Hexadecimal to Binary

Decimal Octal

Binary Hexadecimal
Hexadecimal to Binary
• Technique
– Convert each hexadecimal digit to a 4-bit
equivalent binary representation
Example
10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112
Decimal to Octal

Decimal Octal

Binary Hexadecimal
Decimal to Octal
• Technique
– Divide by 8
– Keep track of the remainder
Example
123410 = ?8

8 1234
8 154 2
8 19 2
8 2 3
0 2

123410 = 23228
Decimal to Hexadecimal

Decimal Octal

Binary Hexadecimal
Decimal to Hexadecimal
• Technique
– Divide by 16
– Keep track of the remainder
Example
123410 = ?16

16 1234
16 77 2
16 4 13 = D
0 4

123410 = 4D216
Binary to Octal

Decimal Octal

Binary Hexadecimal
Binary to Octal
• Technique
– Group bits in threes, starting on right
– Convert to octal digits
Example
10110101112 = ?8

1 011 010 111

1 3 2 7

10110101112 = 13278
Binary − Octal Conversion
• 8 = 23
• Each group of 3 bits represents an octal digit.

Works both ways (Binary to Octal & Octal to


Binary)

09/12/24
Binary to Hexadecimal

Decimal Octal

Binary Hexadecimal
Binary to Hexadecimal
• Technique
– Group bits in fours, starting on right
– Convert to hexadecimal digits
Example
10101110112 = ?16

10 1011 1011

2 B B

10101110112 = 2BB16
Octal to Hexadecimal

Decimal Octal

Binary Hexadecimal
Octal to Hexadecimal
• Technique
– Use binary as an intermediary
Example
10768 = ?16

1 0 7 6

001 000 111 110

2 3 E

10768 = 23E16
Hexadecimal to Octal

Decimal Octal

Binary Hexadecimal
Hexadecimal to Octal
• Technique
– Use binary as an intermediary
Example
1F0C16 = ?8

1 F 0 C

0001 1111 0000 1100

1 7 4 1 4

1F0C16 = 174148
Practice Questions
• (11011100.11) 2 = (?
• (DF2E.C)
• (74036)
• (2024.3)
• (DEAF)

5A-54
55

THANK YOU

You might also like