Example #1 -- The ASCII Character Set Most modern computer

advertisement
Example #1 -- The ASCII Character Set
Most modern computer systems use the American Standard Code for Information
Interchange (ASCII) for encoding character or alphanumeric data. ASCII is a
seven-bit code with each character occupying a single eight-bit byte, where
the leftmost bit (the most significant bit) is set to zero. Thus, 128
characters may be encoded using ASCII. A table of the ASCII character set is
given below.
Char
---NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
Hex
--00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F
Dec
--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
---SP
!
"
#
$
%
&
’
(
)
*
+
,
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
Hex
--20
21
22
23
24
25
26
27
28
29
2A
2B
2C
2D
2E
2F
30
31
32
33
34
35
36
37
38
39
3A
3B
3C
3D
3E
3F
Dec
--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
---@
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
[
\
]
^
_
Hex
--40
41
42
43
44
45
46
47
48
49
4A
4B
4C
4D
4E
4F
50
51
52
53
54
55
56
57
58
59
5A
5B
5C
5D
5E
5F
Dec
--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
{
|
}
~
DEL
Hex
--60
61
62
63
64
65
66
67
68
69
6A
6B
6C
6D
6E
6F
70
71
72
73
74
75
76
77
78
79
7A
7B
7C
7D
7E
7F
Dec
--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
Certain features of the ASCII coding scheme are worth noting:
1. Sorting according to the numerical value of each character places the set
of uppercase letters in alphabetic order with respect to one another. For
example, a "B" is represented by 01000010 base two (42 base sixteen) and a
"C" is represented by 01000011 base two (43 base sixteen). Similarly, both
the set of lowercase letters and the set of alphanumeric digits are ordered
alphabetically by numerical value.
2. The numerical difference between corresponding uppercase and lowercase
letters is 00100000 base two (20 base sixteen), permitting a simple
conversion between cases. For example, an "A" is represented by 01000001
base two (41 base sixteen) and an "a" is represented by 01100001 base two
(61 base sixteen).
3. In addition to the printable characters, ASCII contains a number of control
characters that cause various actions on typical terminals. For example,
"CR" represents a carriage return and "HT" represents a horizontal tab.
The definition of each nonprinting character is given in the table below.
Char
---NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI
SP
Definition
---------Null
Start of heading
Start of text
End of text
End of transmission
Enquiry
Acknowledge
Bell
Backspace
Horizontal tab
Line feed
Vertical tab
Form feed
Carriage return
Shift out
Shift in
Space
Char
---DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
DEL
Definition
---------Data link escape
Device control 1
Device control 2
Device control 3
Device control 4
Negative acknowledge
Synchronous idle
End of transmission block
Cancel
End of medium
Substitute
Escape
File separator
Group separator
Record separator
Unit separator
Delete
Download