目录
ASCII基本字符
ASCII控制字符
ASCII可显示字符
ASCII扩展字符
转换代码
ASCII 码使用指定的 7 位或 8 位二进制数组合来表示 128 或 256 种可能的字符。标准 ASCII 码也叫基础ASCII码,使用 7 位二进制数来表示所有的大写和小写字母、数字 0 到 9、标点符号, 以及在美式英语中使用的特殊控制字符。其中:
0~31及127(共33个)是控制字符或通信专用字符(其余为可显示字符),如控制符:LF(换行)、CR(回车)、FF(换页)、DEL(删除)、BS(退格)、BEL(振铃)等;通信专用字符:SOH(文头)、EOT(文尾)、ACK(确认)等;ASCII值为 8、9、10 和 13 分别转换为退格、制表、换行和回车字符。它们并没有特定的图形显示,但会依不同的应用程序,而对文本显示有不同的影响。
32~126(共95个)是字符(32sp是空格),其中48~57为0到9十个阿拉伯数字;
65~90为26个大写英文字母,97~122号为26个小写英文字母,其余为一些标点符号、运算符号等。
同时还要注意,在标准ASCII中,最高位(b7) 用作奇偶校验位。所谓奇偶校验,是指在代码传送过程中用来检验是否出现错误的一种方法,一般分奇校验和偶校验两种。奇校验规定:正确的代码一个字节中 1 的个数必须是奇数,若非奇数,则在最高位 b7 添1;偶校验规定:正确的代码一个字节中1的个数必须是偶数,若非偶数,则在最高位 b7 添1。
后128个称为扩展ASCII码,目前许多基于x86的系统都支持使用扩展(或“高”)ASCII。扩展 ASCII 码允许将每个字符的第 8 位用于确定附加的 128 个特殊符号字符、外来语字母和图形符号。
ASCII基本字符,0 - 127,共128个
ASCII码
字符
16进制
10进制
2进制
0x00
0
0
NUL 空
0x01
1
1
SOH 标题开始
0x02
2
10
STX 正文开始
0x03
3
11
ETX 正文结束
0x04
4
100
EOT 传输结束
0x05
5
101
ENQ 询问字符
0x06
6
110
ACK 承认
0x07
7
111
BEL 报警
0x08
8
1000
BS 退一格
0x09
9
1001
HT 横向制表
0x0A
10
1010
LF 换行
0x0B
11
1011
VT 垂直制表
0x0C
12
1100
FF 走纸控制
0x0D
13
1101
CR 回车
0x0E
14
1110
SO 移位输出
0x0F
15
1111
SI 移位输入
0x10
16
10000
DLE 数据链路转义
0x11
17
10001
DC1 设备控制1
0x12
18
10010
DC2 设备控制2
0x13
19
10011
DC3 设备控制3
0x14
20
10100
DC4 设备控制4
0x15
21
10101
NAK 否定
0x16
22
10110
SYN 空转同步
0x17
23
10111
ETB 信息组传送结束
0x18
24
11000
CAN 作废
0x19
25
11001
EM 纸尽
0x1A
26
11010
SUB 换置
0x1B
27
11011
ESC 换码
0x1C
28
11100
FS 文字分隔符
0x1D
29
11101
GS 组分隔符
0x1E
30
11110
RS 记录分隔符
0x1F
31
11111
US 单元分隔符
0x20
32
100000
(space)
0x21
33
100001
!
0x22
34
100010
”
0x23
35
100011
#
0x24
36
100100
$
0x25
37
100101
%
0x26
38
100110
&
0x27
39
100111
'
0x28
40
101000
(
0x29
41
101001
)
0x2A
42
101010
*
0x2B
43
101011
+
0x2C
44
101100
,
0x2D
45
101101
-
0x2E
46
101110
.
0x2F
47
101111
/
0x30
48
110000
0
0x31
49
110001
1
0x32
50
110010
2
0x33
51
110011
3
0x34
52
110100
4
0x35
53
110101
5
36
54
110110
6
0x37
55
110111
7
0x38
56
111000
8
0x39
57
111001
9
0x3A
58
111010
:
0x3B
59
111011
;
0x3C
60
111100
<
0x3D
61
111101
=
0x3E
62
111110
>
0x3F
63
111111
?
0x40
64
1000000
@
0x41
65
1000001
A
0x42
66
1000010
B
0x43
67
1000011
C
0x44
68
1000100
D
0x45
69
1000101
E
0x46
70
1000110
F
0x47
71
1000111
G
0x48
72
1001000
H
0x49
73
1001001
I
0x4A
74
1001010
J
0x4B
75
1001011
K
0x4C
76
1001100
L
0x4D
77
1001101
M
0x4E
78
1001110
N
0x4F
79
1001111
O
0x50
80
1010000
P
0x51
81
1010001
Q
0x52
82
1010010
R
0x53
83
1010011
S
0x54
84
1010100
T
0x55
85
1010101
U
0x56
86
1010110
V
0x57
87
1010111
W
0x58
88
1011000
X
0x59
89
1011001
Y
0x5A
90
1011010
Z
0x5B
91
1011011
[
0x5C
92
1011100
\
0x5D
93
1011101
]
0x5E
94
1011110
^
0x5F
95
1011111
_
0x60
96
1100000
`
0x61
97
1100001
a
0x62
98
1100010
b
0x63
99
1100011
c
0x64
100
1100100
d
0x65
101
1100101
e
0x66
102
1100110
f
0x67
103
1100111
g
0x68
104
1101000
h
0x69
105
1101001
i
0x6A
106
1101010
j
0x6B
107
1101011
k
0x6C
108
1101100
l
0x6D
109
1101101
m
0x6E
110
1101110
n
0x6F
111
1101111
o
0x70
112
1110000
p
0x71
113
1110001
q
0x72
114
1110010
r
0x73
115
1110011
s
0x74
116
1110100
t
0x75
117
1110101
u
0x76
118
1110110
v
0x77
119
1110111
w
0x78
120
1111000
x
0x79
121
1111001
y
0x7A
122
1111010
z
0x7B
123
1111011
{
0x7C
124
1111100
|
0x7D
125
1111101
}
0x7E
126
1111110
~
0x7F
127
1111111
DEL 删除
ASCII控制字符 ,0 - 31,共32个
十进制
八进制
十六进制
二进制
符号
HTML
中文解释
DEC
OCT
HEX
BIN
Symbol
实体编码
Description
0
0
0
0
NUL
空字符
1
1
1
1
SOH
标题开始
2
2
2
10
STX
正文开始
3
3
3
11
ETX
正文结束
4
4
4
100
EOT
传输结束
5
5
5
101
ENQ
询问
6
6
6
110
ACK
收到通知
7
7
7
111
BEL
铃
8
10
8
1000
BS
退格
9
11
9
1001
HT
水平制表符
10
12
0A
1010
LF
换行键
11
13
0B
1011
VT
垂直制表符
12
14
0C
1100
FF
换页键
13
15
0D
1101
CR
回车键
14
16
0E
1110
SO
移出
15
17
0F
1111
SI
移入
16
20
10
10000
DLE
数据链路转义
17
21
11
10001
DC1
设备控制 1
18
22
12
10010
DC2
设备控制 2
19
23
13
10011
DC3
设备控制 3
20
24
14
10100
DC4
设备控制 4
21
25
15
10101
NAK
拒绝接收
22
26
16
10110
SYN
同步空闲
23
27
17
10111
ETB
传输块结束
24
30
18
11000
CAN
取消
25
31
19
11001
EM
介质中断
26
32
1A
11010
SUB
替换
27
33
1B
11011
ESC
换码符
28
34
1C
11100
FS
文件分隔符
29
35
1D
11101
GS
组分隔符
30
36
1E
11110
RS
记录分离符
31
37
1F
11111
US
单元分隔符
ASCII可显示字符 ,32 - 127,共96个
十进制
八进制
十六进制
二进制
符号
HTML
中文解释
DEC
OCT
HEX
BIN
Symbol
实体编码
Description
32
40
20
100000
空格
33
41
21
100001
!
!
感叹号
34
42
22
100010
"
"
双引号
35
43
23
100011
#
#
井号
36
44
24
100100
$
$
美元符
37
45
25
100101
%
%
百分号
38
46
26
100110
&
&
与
39
47
27
100111
'
'
单引号
40
50
28
101000
(
(
左括号
41
51
29
101001
)
)
右括号
42
52
2A
101010
*
*
星号
43
53
2B
101011
+
+
加号
44
54
2C
101100
,
,
逗号
45
55
2D
101101
-
-
连字号或减号
46
56
2E
101110
.
.
句点或小数点
47
57
2F
101111
/
/
斜杠
48
60
30
110000
0
0
0
49
61
31
110001
1
1
1
50
62
32
110010
2
2
2
51
63
33
110011
3
3
3
52
64
34
110100
4
4
4
53
65
35
110101
5
5
5
54
66
36
110110
6
6
6
55
67
37
110111
7
7
7
56
70
38
111000
8
8
8
57
71
39
111001
9
9
9
58
72
3A
111010
:
:
冒号
59
73
3B
111011
;
;
分号
60
74
3C
111100
<
<
小于
61
75
3D
111101
=
=
等号
62
76
3E
111110
>
>
大于
63
77
3F
111111
?
?
问号
64
100
40
1000000
@
@
电子邮件符号
65
101
41
1000001
A
A
大写字母 A
66
102
42
1000010
B
B
大写字母 B
67
103
43
1000011
C
C
大写字母 C
68
104
44
1000100
D
D
大写字母 D
69
105
45
1000101
E
E
大写字母 E
70
106
46
1000110
F
F
大写字母 F
71
107
47
1000111
G
G
大写字母 G
72
110
48
1001000
H
H
大写字母 H
73
111
49
1001001
I
I
大写字母 I
74
112
4A
1001010
J
J
大写字母 J
75
113
4B
1001011
K
K
大写字母 K
76
114
4C
1001100
L
L
大写字母 L
77
115
4D
1001101
M
M
大写字母 M
78
116
4E
1001110
N
N
大写字母 N
79
117
4F
1001111
O
O
大写字母 O
80
120
50
1010000
P
P
大写字母 P
81
121
51
1010001
Q
Q
大写字母 Q
82
122
52
1010010
R
R
大写字母 R
83
123
53
1010011
S
S
大写字母 S
84
124
54
1010100
T
T
大写字母 T
85
125
55
1010101
U
U
大写字母 U
86
126
56
1010110
V
V
大写字母 V
87
127
57
1010111
W
W
大写字母 W
88
130
58
1011000
X
X
大写字母 X
89
131
59
1011001
Y
Y
大写字母 Y
90
132
5A
1011010
Z
Z
大写字母 Z
91
133
5B
1011011
[
[
左中括号
92
134
5C
1011100
\
\
反斜杠
93
135
5D
1011101
]
]
右中括号
94
136
5E
1011110
^
^
音调符号
95
137
5F
1011111
_
_
下划线
96
140
60
1100000
`
`
重音符
97
141
61
1100001
a
a
小写字母 a
98
142
62
1100010
b
b
小写字母 b
99
143
63
1100011
c
c
小写字母 c
100
144
64
1100100
d
d
小写字母 d
101
145
65
1100101
e
e
小写字母 e
102
146
66
1100110
f
f
小写字母 f
103
147
67
1100111
g
g
小写字母 g
104
150
68
1101000
h
h
小写字母 h
105
151
69
1101001
i
i
小写字母 i
106
152
6A
1101010
j
j
小写字母 j
107
153
6B
1101011
k
k
小写字母 k
108
154
6C
1101100
l
l
小写字母 l
109
155
6D
1101101
m
m
小写字母 m
110
156
6E
1101110
n
n
小写字母 n
111
157
6F
1101111
o
o
小写字母 o
112
160
70
1110000
p
p
小写字母 p
113
161
71
1110001
q
q
小写字母 q
114
162
72
1110010
r
r
小写字母 r
115
163
73
1110011
s
s
小写字母 s
116
164
74
1110100
t
t
小写字母 t
117
165
75
1110101
u
u
小写字母 u
118
166
76
1110110
v
v
小写字母 v
119
167
77
1110111
w
w
小写字母 w
120
170
78
1111000
x
x
小写字母 x
121
171
79
1111001
y
y
小写字母 y
122
172
7A
1111010
z
z
小写字母 z
123
173
7B
1111011
{
{
左大括号
124
174
7C
1111100
|
|
垂直线
125
175
7D
1111101
}
}
右大括号
126
176
7E
1111110
~
~
波浪号
127
177
7F
1111111
删除
ASCII扩展字符,128 - 255,共128个
DEC
OCT
HEX
BIN
Symbol
HTML Number
HTML Name
Description
128
200
80
10000000
€
€
Euro sign
129
201
81
10000001
130
202
82
10000010
‚
‚
Single low-9 quotation mark
131
203
83
10000011
ƒ
ƒ
Latin small letter f with hook
132
204
84
10000100
„
„
Double low-9 quotation mark
133
205
85
10000101
…
…
Horizontal ellipsis
134
206
86
10000110
†
†
Dagger
135
207
87
10000111
‡
‡
Double dagger
136
210
88
10001000
ˆ
ˆ
Modifier letter circumflex accent
137
211
89
10001001
‰
‰
Per mille sign
138
212
8A
10001010
Š
Š
Latin capital letter S with caron
139
213
8B
10001011
‹
‹
Single left-pointing angle quotation
140
214
8C
10001100
Œ
Œ
Latin capital ligature OE
141
215
8D
10001101
142
216
8E
10001110
Ž
Latin captial letter Z with caron
143
217
8F
10001111
144
220
90
10010000
145
221
91
10010001
‘
‘
Left single quotation mark
146
222
92
10010010
’
’
Right single quotation mark
147
223
93
10010011
“
“
Left double quotation mark
148
224
94
10010100
”
”
Right double quotation mark
149
225
95
10010101
•
•
Bullet
150
226
96
10010110
–
–
En dash
151
227
97
10010111
—
—
Em dash
152
230
98
10011000
˜
˜
Small tilde
153
231
99
10011001
™
™
Trade mark sign
154
232
9A
10011010
š
š
Latin small letter S with caron
155
233
9B
10011011
›
›
Single right-pointing angle quotation mark
156
234
9C
10011100
œ
œ
Latin small ligature oe
157
235
9D
10011101
158
236
9E
10011110
ž
Latin small letter z with caron
159
237
9F
10011111
Ÿ
ÿ
Latin capital letter Y with diaeresis
160
240
A0
10100000
Non-breaking space
161
241
A1
10100001
¡
¡
¡
Inverted exclamation mark
162
242
A2
10100010
¢
¢
¢
Cent sign
163
243
A3
10100011
£
£
£
Pound sign
164
244
A4
10100100
¤
¤
¤
Currency sign
165
245
A5
10100101
¥
¥
¥
Yen sign
166
246
A6
10100110
¦
¦
¦
Pipe, Broken vertical bar
167
247
A7
10100111
§
§
§
Section sign
168
250
A8
10101000
¨
¨
¨
Spacing diaeresis - umlaut
169
251
A9
10101001
©
©
©
Copyright sign
170
252
AA
10101010
ª
ª
ª
Feminine ordinal indicator
171
253
AB
10101011
«
«
«
Left double angle quotes
172
254
AC
10101100
¬
¬
¬
Not sign
173
255
AD
10101101
Soft hyphen
174
256
AE
10101110
®
®
®
Registered trade mark sign
175
257
AF
10101111
¯
¯
¯
Spacing macron - overline
176
260
B0
10110000
°
°
°
Degree sign
177
261
B1
10110001
±
±
±
Plus-or-minus sign
178
262
B2
10110010
²
²
²
Superscript two - squared
179
263
B3
10110011
³
³
³
Superscript three - cubed
180
264
B4
10110100
´
´
´
Acute accent - spacing acute
181
265
B5
10110101
µ
µ
µ
Micro sign
182
266
B6
10110110
¶
¶
¶
Pilcrow sign - paragraph sign
183
267
B7
10110111
·
·
·
Middle dot - Georgian comma
184
270
B8
10111000
¸
¸
¸
Spacing cedilla
185
271
B9
10111001
¹
¹
¹
Superscript one
186
272
BA
10111010
º
º
º
Masculine ordinal indicator
187
273
BB
10111011
»
»
»
Right double angle quotes
188
274
BC
10111100
¼
¼
¼
Fraction one quarter
189
275
BD
10111101
½
½
½
Fraction one half
190
276
BE
10111110
¾
¾
¾
Fraction three quarters
191
277
BF
10111111
¿
¿
¿
Inverted question mark
192
300
C0
11000000
À
À
À
Latin capital letter A with grave
193
301
C1
11000001
Á
Á
Á
Latin capital letter A with acute
194
302
C2
11000010
Â
Â
Â
Latin capital letter A with circumflex
195
303
C3
11000011
Ã
Ã
Ã
Latin capital letter A with tilde
196
304
C4
11000100
Ä
Ä
Ä
Latin capital letter A with diaeresis
197
305
C5
11000101
Å
Å
Å
Latin capital letter A with ring above
198
306
C6
11000110
Æ
Æ
Æ
Latin capital letter AE
199
307
C7
11000111
Ç
Ç
Ç
Latin capital letter C with cedilla
200
310
C8
11001000
È
È
È
Latin capital letter E with grave
201
311
C9
11001001
É
É
É
Latin capital letter E with acute
202
312
CA
11001010
Ê
Ê
Ê
Latin capital letter E with circumflex
203
313
CB
11001011
Ë
Ë
Ë
Latin capital letter E with diaeresis
204
314
CC
11001100
Ì
Ì
Ì
Latin capital letter I with grave
205
315
CD
11001101
Í
Í
Í
Latin capital letter I with acute
206
316
CE
11001110
Î
Î
Î
Latin capital letter I with circumflex
207
317
CF
11001111
Ï
Ï
Ï
Latin capital letter I with diaeresis
208
320
D0
11010000
Ð
Ð
Ð
Latin capital letter ETH
209
321
D1
11010001
Ñ
Ñ
Ñ
Latin capital letter N with tilde
210
322
D2
11010010
Ò
Ò
Ò
Latin capital letter O with grave
211
323
D3
11010011
Ó
Ó
Ó
Latin capital letter O with acute
212
324
D4
11010100
Ô
Ô
Ô
Latin capital letter O with circumflex
213
325
D5
11010101
Õ
Õ
Õ
Latin capital letter O with tilde
214
326
D6
11010110
Ö
Ö
Ö
Latin capital letter O with diaeresis
215
327
D7
11010111
×
×
×
Multiplication sign
216
330
D8
11011000
Ø
Ø
Ø
Latin capital letter O with slash
217
331
D9
11011001
Ù
Ù
Ù
Latin capital letter U with grave
218
332
DA
11011010
Ú
Ú
Ú
Latin capital letter U with acute
219
333
DB
11011011
Û
Û
Û
Latin capital letter U with circumflex
220
334
DC
11011100
Ü
Ü
Ü
Latin capital letter U with diaeresis
221
335
DD
11011101
Ý
Ý
Ý
Latin capital letter Y with acute
222
336
DE
11011110
Þ
Þ
Þ;
Latin capital letter THORN
223
337
DF
11011111
ß
ß
ß
Latin small letter sharp s - ess-zed
224
340
E0
11100000
à
à
à
Latin small letter a with grave
225
341
E1
11100001
á
á
á
Latin small letter a with acute
226
342
E2
11100010
â
â
â
Latin small letter a with circumflex
227
343
E3
11100011
ã
ã
ã
Latin small letter a with tilde
228
344
E4
11100100
ä
ä
ä
Latin small letter a with diaeresis
229
345
E5
11100101
å
å
å
Latin small letter a with ring above
230
346
E6
11100110
æ
æ
æ
Latin small letter ae
231
347
E7
11100111
ç
ç
ç
Latin small letter c with cedilla
232
350
E8
11101000
è
è
è
Latin small letter e with grave
233
351
E9
11101001
é
é
é
Latin small letter e with acute
234
352
EA
11101010
ê
ê
ê
Latin small letter e with circumflex
235
353
EB
11101011
ë
ë
ë
Latin small letter e with diaeresis
236
354
EC
11101100
ì
ì
ì
Latin small letter i with grave
237
355
ED
11101101
í
í
í
Latin small letter i with acute
238
356
EE
11101110
î
î
î
Latin small letter i with circumflex
239
357
EF
11101111
ï
ï
ï
Latin small letter i with diaeresis
240
360
F0
11110000
ð
ð
ð
Latin small letter eth
241
361
F1
11110001
ñ
ñ
ñ
Latin small letter n with tilde
242
362
F2
11110010
ò
ò
ò
Latin small letter o with grave
243
363
F3
11110011
ó
ó
ó
Latin small letter o with acute
244
364
F4
11110100
ô
ô
ô
Latin small letter o with circumflex
245
365
F5
11110101
õ
õ
õ
Latin small letter o with tilde
246
366
F6
11110110
ö
ö
ö
Latin small letter o with diaeresis
247
367
F7
11110111
÷
÷
÷
Division sign
248
370
F8
11111000
ø
ø
ø
Latin small letter o with slash
249
371
F9
11111001
ù
ù
ù
Latin small letter u with grave
250
372
FA
11111010
ú
ú
ú
Latin small letter u with acute
251
373
FB
11111011
û
û
û
Latin small letter u with circumflex
252
374
FC
11111100
ü
ü
ü
Latin small letter u with diaeresis
253
375
FD
11111101
ý
ý
ý
Latin small letter y with acute
254
376
FE
11111110
þ
þ
þ
Latin small letter thorn
255
377
FF
11111111
ÿ
ÿ
ÿ
Latin small letter y with diaeresis
转换代码
ts_buffer内容为:+CCLK: 2004/02/09 17:34:23.694(均为字符型)
程序内容:将ts_buffer内容中的年、月、日、时、分、秒写入MOA_tx_data.data.timer中(uint8_t型)
MOA_tx_data.data.timer.years=(ts_buffer[8]-48)*10+(ts_buffer[9]-48);
a=ts_buffer[11]-48;
if (ts_buffer[12]=='/'){
MOA_tx_data.data.timer.months=a;
b=13;
}
else{
MOA_tx_data.data.timer.months=a*10+(ts_buffer[12]-48);
b=14;
}
a=ts_buffer[b]-48;
if (ts_buffer[b+1]==','){
MOA_tx_data.data.timer.days=a;
b=b+2;
}
else{
MOA_tx_data.data.timer.days=a*10+(ts_buffer[b+1]-48);
b=b+3;
}
a=ts_buffer[b]-48;
if (ts_buffer[b+1]==':'){
MOA_tx_data.data.timer.hours=a;
b=b+2;
}
else{
MOA_tx_data.data.timer.hours=a*10+(ts_buffer[b+1]-48);
b=b+3;
}
a=ts_buffer[b]-48;
if (ts_buffer[b+1]==':'){
MOA_tx_data.data.timer.minutes=a;
b=b+2;
}
else{
MOA_tx_data.data.timer.minutes=a*10+(ts_buffer[b+1]-48);
b=b+3;
}
a=ts_buffer[b]-48;
if (ts_buffer[b+1]=='.'){
MOA_tx_data.data.timer.seconds=a;
b=b+2;
}
else{
MOA_tx_data.data.timer.seconds=a*10+(ts_buffer[b+1]-48);
b=b+3;
}