Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 4 Lecturer In Charge: Manesh T 1."— Presentation transcript:

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

2 D ATA R EPRESENTATION Data Representation refers to how Computers store lots of different types of information: numbers text graphics of many varieties (stills, video, animation) sound 2

3 M EMORY S TRUCTURE IN C OMPUTER 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 = 2 8 pieces of information words (=2,4, or 8 bytes) – a 2 byte word can represent 256 2 pieces of information (approximately 65 thousand). Byte addressable - each byte has its own address. 3

4 B INARY SYSTEM 4

5 C LASSIFICATIONS 5

6 S TORAGE U NITS 6

7 N UMBER S YSTEMS Binary (2)Decimal (10)Octal (8) Hexadecimal (16) 0000'00 0001'11 0010'22 0011'33 0100'44 0101'55 0110'66'6' 0111'77 1000'8 1001'9 1010'10 A 1011'11 B 1100'12 C 1101'13 D 1110'14 E 1111'15 F 7

8 C ONVERSION A MONG B ASES The possibilities: Hexadecimal DecimalOctal Binary pp. 40-46 8

9 Q UICK E XAMPLE 25 10 = 11001 2 = 31 8 = 19 16 Base 9

10 D ECIMAL TO D ECIMAL ( JUST FOR FUN ) Hexadecimal DecimalOctal Binary Next slide… 10

11 125 10 =>5 x 10 0 = 5 2 x 10 1 = 20 1 x 10 2 = 100 125 Base Weight 11

12 B INARY TO D ECIMAL Hexadecimal DecimalOctal Binary 12

13 B INARY TO D ECIMAL Technique Multiply each bit by 2 n, 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

14 E XAMPLE 101011 2 => 1 x 2 0 = 1 1 x 2 1 = 2 0 x 2 2 = 0 1 x 2 3 = 8 0 x 2 4 = 0 1 x 2 5 = 32 43 10 Bit “0” 14

15 O CTAL TO D ECIMAL Hexadecimal DecimalOctal Binary 15

16 O CTAL TO D ECIMAL Technique Multiply each bit by 8 n, 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

17 E XAMPLE 724 8 => 4 x 8 0 = 4 2 x 8 1 = 16 7 x 8 2 = 448 468 10 17

18 H EXADECIMAL TO D ECIMAL Hexadecimal DecimalOctal Binary 18

19 H EXADECIMAL TO D ECIMAL Technique Multiply each bit by 16 n, 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

20 E XAMPLE ABC 16 =>C x 16 0 = 12 x 1 = 12 B x 16 1 = 11 x 16 = 176 A x 16 2 = 10 x 256 = 2560 2748 10 20

21 D ECIMAL TO B INARY Hexadecimal DecimalOctal Binary 21

22 D ECIMAL TO B INARY 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

23 E XAMPLE 125 10 = ? 2 2 125 62 1 2 31 0 2 15 1 2 7 1 2 3 1 2 1 1 2 0 1 125 10 = 1111101 2 23

24 O CTAL TO B INARY Hexadecimal DecimalOctal Binary 24

25 O CTAL TO B INARY Technique Convert each octal digit to a 3-bit equivalent binary representation 25

26 E XAMPLE 705 8 = ? 2 7 0 5 111 000 101 705 8 = 111000101 2 26

27 H EXADECIMAL TO B INARY Hexadecimal DecimalOctal Binary 27

28 H EXADECIMAL TO B INARY Technique Convert each hexadecimal digit to a 4-bit equivalent binary representation 28

29 E XAMPLE 10AF 16 = ? 2 1 0 A F 0001 0000 1010 1111 10AF 16 = 0001000010101111 2 29

30 C LASS WORK Convert Decimal to Binary 1. (421) 10 = ( ) 2 2. (1025) 10 = ( ) 2 3. (368) 10 = ( ) 2 4. (687) 10 = ( ) 2 5. (625) 10 = ( ) 2 6. (752) 10 = ( ) 2 30

31 C LASS WORK Convert Binary to Hexadecimal 1. (10110101001011100010) 2 = ( ) 16 2. (10000100110110000101) 2 = ( ) 16 3. (11100010101010011010) 2 = ( ) 16 4. (10111100011011101101) 2 = ( ) 16 5. (0101000110110101010) 2 = ( ) 16 6. (101111111010011010) 2 = ( ) 16 31

32 C LASS WORK Convert Hexadecimal to Binary 1. (AF1) 16 = ( ) 2 2. (924) 16 = ( ) 2 3. (3569) 16 = ( ) 2 4. (4526) 16 = ( ) 2 5. (6548) 16 = ( ) 2 6. (1334) 16 = ( ) 2 32

33 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

34 ASCII C ODES Sp!“#$%&‘()*+,- 3233343536373839404142434445./0123456789:; 4647484950515253545556575859 <=>?@ABCDEFGHI 6061626364656667686970717273 JKLMNOPQRSTUVW 7475767778798081828384858687 XYZ[\]^_`abcde 888990919293949596979899 100101 fghijklmnopqrs 102103104 105106107108109110111112113114115 tuvw xyz{|}~ 116117118 119120121 123124125126 34

35 ASCII REPRESENTATION OF T EXT 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

36 C HAPTER 4 E ND 36


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

Similar presentations


Ads by Google