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

Week 4-Data Representation - Binary System

The document discusses data representation in computers including binary systems, bytes, ASCII codes, and number conversions. It explains that computers store data as bits and bytes, with a byte being 8 bits that can represent 256 unique values. The binary system, octal, decimal, and hexadecimal numbering systems are presented along with methods to convert between them. ASCII codes are introduced as a common standard where letters, numbers and symbols are assigned numeric codes for computer storage and processing of text data.

Uploaded by

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

Week 4-Data Representation - Binary System

The document discusses data representation in computers including binary systems, bytes, ASCII codes, and number conversions. It explains that computers store data as bits and bytes, with a byte being 8 bits that can represent 256 unique values. The binary system, octal, decimal, and hexadecimal numbering systems are presented along with methods to convert between them. ASCII codes are introduced as a common standard where letters, numbers and symbols are assigned numeric codes for computer storage and processing of text data.

Uploaded by

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

1

DATA REPRESENTATION,
BINARY SYSTEM, BIT,
BYTE, ASCII CODE
Objectives
2

In the end of this lecture, the student should know:


 Data representation

 Memory structure in computer

 Binary system and classification

 Storage system and number units

 Conversion Among Bases

 ASCII and ASCII code


Data Representation
3

• Data Representation refers to how Computers store


lots of different types of information:
• numbers
• text
• graphics of many varieties (stills, video, animation)
• sound
Memory Structure in Computer
4

• Memory consists of bits (0 or 1)


– a single bit can represent two pieces of information
• bytes (=8 bits)
– a single byte can represent 256 = 2x2x2x2x2x2x2x2 =
28 pieces of information
• words (=2,4, or 8 bytes)
– a 2 byte word can represent 2562 pieces of information
(approximately 65 thousand).
• Byte addressable - each byte has its own address.
Binary system
5
Classifications
6
Storage Units
7
Number Systems
8

Binary (2) Decimal (10) Octal (8) Hexadecimal (16)


0000' 0 0 0000'
0001' 1 1 0001'
0010' 2 2 0010'
0011' 3 3 0011'
0100' 4 4 0100'
0101' 5 5 0101'
0110' 6 6' 0110'
0111' 7 7 0111'
1000' 8 1000'
1001' 9 1001'
1010' 10 A
1011' 11 B
1100' 12 C
1101' 13 D
1110' 14 E
1111' 15 F
Conversion Among Bases
9

 The possibilities:

Decimal Octal

Binary Hexadecimal
Quick Example
10

2510 = 110012 = 318 = 1916

Base
Decimal to Decimal (just for fun)
11

Decimal Octal

Binary Hexadecimal

Next slide…
Example
12
Weight

12510 => 5 x 100 = 5


2 x 101 = 20
1 x 102 = 100
125

Base
Binary to Decimal
13

Decimal Octal

Binary Hexadecimal
Binary to Decimal
14

 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
15

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
Octal to Decimal
16

Decimal Octal

Binary Hexadecimal
Octal to Decimal
17

 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
18

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

Decimal Octal

Binary Hexadecimal
Hexadecimal to Decimal
20

 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
21

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
22

Decimal Octal

Binary Hexadecimal
Decimal to Binary
23

 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
24

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
25

Decimal Octal

Binary Hexadecimal
Octal to Binary
26

 Technique
 Convert each octal digit to a 3-bit equivalent binary
representation
Example
27

7058 = ?2

7 0 5

111 000 101

7058 = 1110001012
Hexadecimal to Binary
28

Decimal Octal

Binary Hexadecimal
Hexadecimal to Binary
29

 Technique
 Convert each hexadecimal digit to a 4-bit equivalent
binary representation
Example
30

10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112
Class work
31

Convert Decimal to Binary


1. (421) 10 = (110100101) 2
2. (1025)10 = (10000000001) 2
3. (368)10 = (101110000) 2
4. (687)10 = (1010101111 ) 2
5. (625)10 = (1001110001) 2
6. (752)10 = (1011110000) 2
Class work
32

Convert Binary to Hexadecimal


1. (10110101001011100010)2 = (B52E2 )16
2. (10000100110110000101)2 = (84D85)16
3. (11100010101010011010)2 = (E2A9A)16
4. (10111100011011101101)2 = (BC6ED)16
5. (0101000110110101010)2 = (28DAA)16
6. (101111111010011010)2 = (2FE9A)16
Class work
33

Convert Hexadecimal to Binary


1. (AF1) 16 = (101011110001) 2
2. (924)16 = (100100100100) 2
3. (3569)16 = (11010101101001) 2
4. (4526)16 = (100010100100110) 2
5. (6548)16 = (110010101001000) 2
6. (1334)16 = (1001100110100) 2
ASCII
34

 The most common code used in computers is ASCII


(American Standard Code for Information
Interchange).
 ASCII provides codes for letters, digits, punctuation
marks, and other special characters.
 The ASCII code for A is 65 = 01000001
ASCII Codes
Sp ! “ # $ % & ‘ ( ) * + , -
32 33 34 35 36 37 38 39 40 41 42 43 44 45
. / 0 1 2 3 4 5 6 7 8 9 : ;
46 47 48 49 50 51 52 53 54 55 56 57 58 59
< = > ? @ A B C D E F G H I
60 61 62 63 64 65 66 67 68 69 70 71 72 73
J K L M N O P Q R S T U V W
74 75 76 77 78 79 80 81 82 83 84 85 86 87
X Y Z [ \ ] ^ _ ` a b c d e
88 89 90 91 92 93 94 95 96 97 98 99 100 101
f g h i j k l m n o p q r s
102 103 104 105 106 107 108 109 110 111 112 113 114 115
t u v w x y z { | } ~
35
116 117 118 119 120 121 121 123 124 125 126
ASCII representation of Text
36

 Since the ASCII codes for ART are


65, 82, and 84, the three bytes representing the
word ART would be 01000001 0101010
01010100
• Nearly all software which deals with text

(Notepad, WordPerfect, Word) use the ASCII


codes to represent such text, though they may
use proprietary codes to deal with fonts, etc.
37

You might also like