+ All Categories
Home > Documents > D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T...

D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T...

Date post: 05-Jan-2016
Category:
Upload: roxanne-peters
View: 215 times
Download: 2 times
Share this document with a friend
36
DATA REPRESENTATION, BINARY SYSTEM, BIT, BYTE, ASCII CODE Chapter 4 Lecturer In Charge: Manesh T 1
Transcript
Page 1: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

DATA REPRESENTATION, BINARY SYSTEM, BIT, BYTE, ASCII CODEChapter 4

Lecturer In Charge: Manesh T

1

Page 2: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

DATA REPRESENTATION

• Data Representation refers to how Computers store lots of different types of information:

• numbers • text • graphics of many varieties (stills, video,

animation) • sound

2

Page 3: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

MEMORY STRUCTURE IN COMPUTER• 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.

3

Page 4: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

BINARY SYSTEM

4

Page 5: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

CLASSIFICATIONS

5

Page 6: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

STORAGE UNITS

6

Page 7: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

NUMBER SYSTEMS

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   A1011' 11   B1100' 12   C1101' 13   D1110' 14   E1111' 15   F

7

Page 8: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

CONVERSION AMONG BASES

The possibilities:

Hexadecimal

Decimal Octal

Binary

pp. 40-468

Page 9: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

QUICK EXAMPLE

2510 = 110012 = 318 = 1916

Base

9

Page 10: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

DECIMAL TO DECIMAL (JUST FOR FUN)

Hexadecimal

Decimal Octal

Binary

Next slide…10

Page 11: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

12510 => 5 x 100 = 52 x 101 = 201 x 102 = 100

125

Base

Weight

11

Page 12: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

BINARY TO DECIMAL

Hexadecimal

Decimal Octal

Binary

12

Page 13: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

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

13

Page 14: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

EXAMPLE

1010112 => 1 x 20 = 11 x 21 = 20 x 22 = 01 x 23 = 80 x 24 = 01 x 25 = 32

4310

Bit “0”

14

Page 15: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

OCTAL TO DECIMAL

Hexadecimal

Decimal Octal

Binary

15

Page 16: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

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

16

Page 17: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

EXAMPLE

7248 => 4 x 80 = 42 x 81 = 167 x 82 = 448

46810

17

Page 18: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

HEXADECIMAL TO DECIMAL

Hexadecimal

Decimal Octal

Binary

18

Page 19: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

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

19

Page 20: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

EXAMPLE

ABC16 => C x 160 = 12 x 1 = 12 B x 161 = 11 x 16 = 176 A x 162 = 10 x 256 = 2560

274810

20

Page 21: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

DECIMAL TO BINARY

Hexadecimal

Decimal Octal

Binary

21

Page 22: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

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.

22

Page 23: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

EXAMPLE12510 = ?2

2 125 62 12 31 02 15 12 7 12 3 12 1 12 0 1

12510 = 11111012

23

Page 24: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

OCTAL TO BINARY

Hexadecimal

Decimal Octal

Binary

24

Page 25: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

OCTAL TO BINARY

Technique Convert each octal digit to a 3-bit equivalent

binary representation

25

Page 26: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

EXAMPLE7058 = ?2

7 0 5

111 000 101

7058 = 1110001012

26

Page 27: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

HEXADECIMAL TO BINARY

Hexadecimal

Decimal Octal

Binary

27

Page 28: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

HEXADECIMAL TO BINARY

Technique Convert each hexadecimal digit to a 4-bit

equivalent binary representation

28

Page 29: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

EXAMPLE10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112

29

Page 30: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

CLASS WORK

Convert Decimal to Binary1. (421) 10 = ( ) 2

2. (1025)10 = ( ) 2

3. (368)10 = ( ) 2

4. (687)10 = ( ) 2

5. (625)10 = ( ) 2

6. (752)10 = ( ) 2

30

Page 31: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

CLASS WORK

Convert Binary to Hexadecimal1. (10110101001011100010)2 = ( )16

2. (10000100110110000101)2 = ( )16

3. (11100010101010011010)2 = ( )16

4. (10111100011011101101)2 = ( )16

5. (0101000110110101010)2 = ( )16

6. (101111111010011010)2 = ( )16

31

Page 32: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

CLASS WORK

Convert Hexadecimal to Binary1. (AF1) 16 = ( ) 2

2. (924)16 = ( ) 2

3. (3569)16 = ( ) 2

4. (4526)16 = ( ) 2

5. (6548)16 = ( ) 2

6. (1334)16 = ( ) 2

32

Page 33: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

ASCII

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

33

Page 34: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

ASCII CODESSp ! “ # $ % & ‘ ( ) * + , -

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 { | } ~

116 117 118 119 120 121 121 123 124 125 12634

Page 35: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

ASCII REPRESENTATION OF TEXT

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.

35

Page 36: D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1.

CHAPTER 4 END

36


Recommended