coding system text representation ascii collating sequence

23
Coding System Text Representation ASCII Collating Sequence

Upload: diana-sharp

Post on 27-Dec-2015

279 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Coding System Text Representation ASCII Collating Sequence

Coding System Text Representation ASCIICollating Sequence

Page 2: Coding System Text Representation ASCII Collating Sequence

What is a BITAs w know a bit is the smallest

unit in a computer system

A bit can either be a 12 or a 02

This means that with one single bit we can only represent only 2 different values

12 = 110 and 02 = 010

Page 3: Coding System Text Representation ASCII Collating Sequence

Representing Text, Pictures ect … Text, pictures and videos are also

stored in a computer system using a sequence of binary digits

Using one single bit is not enough due to its small size

If we want to store a large quantity of data many more bits are required.

Page 4: Coding System Text Representation ASCII Collating Sequence

Combining a number of Bits Each time a bit is combined with

another bit, more different combinations can be stored.

If we will be using two bits to store data, there are a total of 22= 4 different combinations

Hence if we have 4 bits we would have 24= 16 different combinations

Page 5: Coding System Text Representation ASCII Collating Sequence

Working With the following number of bits

how many combinations could be created?

1. 5 bits2. 3 bits3. 6 bits4. 8 bits

Page 6: Coding System Text Representation ASCII Collating Sequence

Answers

1. 5 bits = 25 32 combinations

2. 3 bits = 23 8 combinations

3. 6 bits = 26 64 combinations

4. 8 bits = 28 256 combinations

Page 7: Coding System Text Representation ASCII Collating Sequence

List of Combination Number of Bits Calculation Number of Combinations

1 21 2

2 22 4

3 23 8

4 24 16

5 25 32

6 26 64

7 27 128

8 28 256

Page 8: Coding System Text Representation ASCII Collating Sequence

In the Early Days When computers were first introduced

they were simply used for performing calculations

After a while scientists realized that computers can also be used to store and edit text in different ways

The problem was that a computer could only understand binary (1s & 0s)

Page 9: Coding System Text Representation ASCII Collating Sequence

ASCII Coding System The scientists had to come up with a way for

binary to be able to represent characters

ASCII (American Standard Code for Information Interchange) was developed

With ASCII every single character is assigned a binary code

ASCII also allows computers to communicate with each other (files containing text can be copied from one computer to another)

Page 10: Coding System Text Representation ASCII Collating Sequence

How ASCII Coding Works The first ASCII system used a

series of 7 Bits

This meant that 27=128 different characters could be used

These 128 characters are represented in the following table

Page 11: Coding System Text Representation ASCII Collating Sequence

Code Char Code Char Code Char Code Char0 NUL 32 Space 64 @ 96 `1 SOH 33 ! 65 A 97 a2 STX 34 “ 66 B 98 b3 ETX 35 # 67 C 99 c4 EOT 36 $ 68 D 100 d5 ENQ 37 % 69 E 101 e6 ACK 38 & 70 F 102 f7 BEL 39 ‘ 71 G 103 g8 BS 40 ( 72 H 104 h9 TAB 41 ) 73 I 105 i10 LF 42 * 74 J 106 j11 VT 43 + 75 K 107 k12 FF 44 , 76 L 108 l13 CR 45 - 77 M 109 m14 SO 46 . 78 N 110 n15 SI 47 / 79 O 111 o16 DLE 48 0 80 P 112 p17 DC1 49 1 81 Q 113 q18 DC2 50 2 82 R 114 r19 DC3 51 3 83 S 115 s20 DC4 52 4 84 T 116 t21 NAK 53 5 85 U 117 u22 SYN 54 6 86 V 118 v23 ETB 55 7 87 W 119 w24 CAN 56 8 88 X 120 x25 EM 57 9 89 Y 121 y26 SUB 58 : 90 Z 122 z27 ESC 59 ; 91 [ 123 {28 FS 60 < 92 \ 124 |29 GS 61 = 93 ] 125 }30 RS 62 > 94 ^ 126 ~31 US 63 ? 95 _ 127 DEL

Page 12: Coding System Text Representation ASCII Collating Sequence

Now a Day’sThe first 32 characters were used for

transmission purposes, they are no longer needed

After some time it was noted that ASCII consisted only of the English alphabet, so an extra bit was added to accommodate more languages, graphics and mathematical symbols

By adding an extra bit 128 more characters can be stored since 28=256.

Page 13: Coding System Text Representation ASCII Collating Sequence

Codes Available Today

Page 14: Coding System Text Representation ASCII Collating Sequence

Try it!You can check the symbols on your

computer by typing in its decimal code1. Open Notepad (Start > Programs >

Accessories > Notepad)2. Make sure that NUM LOCK is switched

on3. Press and hold ALT 4. From the Numpad enter the 3 digits

that you want (example 234 for Ω)5. Release the ALT, and the symbol

should appear.

Page 15: Coding System Text Representation ASCII Collating Sequence

Important NoteIt is important that all computers

use ASCII as otherwise different codes would represent different values

Example if a computer used the XYZ system (fictitious) and another uses ASCII the work HELLO would be represented differently on the two machines

Page 16: Coding System Text Representation ASCII Collating Sequence

Coding in ASCIIWe must use the ASCII table to

be able to code the following;

Letter H E L L O

Decimal Code 72 69 76 76 79

Binary Code 1001000 1000101 1001100 1001100 1001111

Page 17: Coding System Text Representation ASCII Collating Sequence

Example of XYZ system Remember this is fictitious

Code Char Code Char Code Char1 A 69 ! 76 *2 B 70 “ 77 (3 C 71 £ 78 )4 D 72 $ 79 -5 E 73 % 80 _6 F 74 ^ 81 +... 75 & ...

Page 18: Coding System Text Representation ASCII Collating Sequence

So HELLO would look different when decoded

Binary Code 1001000 1000101 1001100 1001100 1001111

Decimal 72 69 76 76 79

Letter $ ! * * -

Page 19: Coding System Text Representation ASCII Collating Sequence

When the computer with the XYZ representation system receives the text file from the computer with the ASCII representation system instead of HELLO, one will see $!**-, which is completely wrong!

Since nowadays computers are used across the world a new system is being used which is UNICODE

UNICODE is compatible with ASCII but then it uses a different system. A list of UNICODE characters can be accessed on

http://en.wikipedia.org/wiki/List_of_Unicode_characters.

Page 20: Coding System Text Representation ASCII Collating Sequence

Work Code the following word using

ASCII;

Letter B Y E ! !

Decimal Code

Binary Code

Page 21: Coding System Text Representation ASCII Collating Sequence

Answer

Letter B Y E ! !

Decimal Code 66 89 69 33 33

Binary Code 1000010 1011001 1000101 0100001 0100001

Page 22: Coding System Text Representation ASCII Collating Sequence

Collating Sequence The character codes assigned to the

characters in ASCII are very important since they can be used to sort letters and distinguishing from upper to lower case letters

For instance if the letters C, V and B have to be sorted, they can be easily sorted by looking at their ASCII code and use it to sort text in ascending (AZ) or descending order (ZA).

Page 23: Coding System Text Representation ASCII Collating Sequence

Example

Character Code

C 67

V 86

B 66

Using the ASCII codes the computer could sort the letters in ascending or descending order by sorting the ASCII code (numbers)