### Coding System

```Coding System
Text Representation
ASCII
Collating Sequence
What is a BIT

As 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
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.
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
Working

1.
2.
3.
4.
With the following number of bits how
many combinations could be created?
5 bits
3 bits
6 bits
8 bits
1.
5 bits = 25  32 combinations
2.
3 bits = 23  8 combinations
3.
6 bits = 26  64 combinations
4.
8 bits = 28  256 combinations
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
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)
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)
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
Code
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Char
NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
TAB
LF
VT
FF
CR
SO
SI
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
Code
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Char
Space
!
“
#
\$
%
&
‘
(
)
*
+
,
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
Code
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Char
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_
Code
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Char
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
DEL
Now a Day’s

The 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.
Codes Available Today
Try it!
You can check the symbols on your
computer by typing in its decimal code
1. Open Notepad (Start > Programs >
2. Make sure that NUM LOCK is switched on
3. 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.

Important Note

It 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
Coding in ASCII

We 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
1000101
1001100
1001100
1001111
1001000
Example of XYZ system

Remember this is fictitious
Code Char
Code Char
Code Char
1
A
69
!
76
*
2
B
70
“
77
(
3
C
71
£
78
)
4
D
72
\$
79
-
5
E
73
%
80
_
6
F
74
^
81
+
75
&
...
...

So HELLO would look different when
decoded
Binary Code 1001000 1000101
1001100
1001100
1001111
Decimal
72
69
76
76
79
Letter
\$
!
*
*
-

When the computer with the XYZ
representation system receives the text file
from the computer with the ASCII
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_cha
racters.

Work

Code the following word using ASCII;
Letter
Decimal Code
Binary Code
B
Y
E
!
!
Letter
B
Y
E
!
!
Decimal Code 66
89
69
33
33
Binary Code
1011001
1000101
0100001
0100001
1000010
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 (AZ) or descending
order (ZA).
Example

Using the ASCII codes the computer
could sort the letters in ascending or
descending order by sorting the ASCII
code (numbers)
Character
Code
C
67
V
86
B
66
```