ASCII and Extended Character Sets

ASCII stands for American Standard Code for Information Interchange. It is the most common way of representing letters and numbers on a computer. Each character is represented by a number—for example, the letter A has the numeric value 65, and the letter a has the numeric value 97 (lowercase letters have a value that is 32 greater than their uppercase versions).

Values below 32 are called control codes—they were defined as nonprinting characters to control early computer terminal devices. The most common control codes for Arduino applications are listed in Table G-1.

Common ASCII control codes
Decimal Hex Escape code Description

0

0x0

'0 '

Null character (used to terminate a C string)

9

0x9

't '

Tab

10

0xA

' '

New line

13

0xD

'r '

Carriage return

27

0x1B

 

Escape

Table G-2 shows the decimal and hexadecimal values of the printable ASCII characters.

ASCII table
  Dec Hex   Dec Hex   Dec Hex

Space

32

20

@

64

40

`

96

60

!

33

21

A

65

41

a

97

61

"

34

22

B

66

42

b

98

62

#

35

23

C

67

43

c

99

63

$

36

24

D

68

44

d

100

64

%

37

25

E

69

45

e

101

65

&

38

26

F

70

46

f

102

66

'

39

27

G

71

47

g

103

67

(

40

28

H

72

48

h

104

68

)

41

29

I

73

49

i

105

69

*

42

2A

J

74

4A

j

106

6A

+

43

2B

K

75

4B

k

107

6B

,

44

2C

L

76

4C

l

108

6C

-

45

2D

M

77

4D

m

109

6D

.

46

2E

N

78

4E

n

110

6E

/

47

2F

O

79

4F

o

111

6F

0

48

30

P

80

50

p

112

70

1

49

31

Q

81

51

q

113

71

2

50

32

R

82

52

r

114

72

3

51

33

S

83

53

s

115

73

4

52

34

T

84

54

t

116

74

5

53

35

U

85

55

u

117

75

6

54

36

V

86

56

v

118

76

7

55

37

W

87

57

w

119

77

8

56

38

X

88

58

x

120

78

9

57

39

Y

89

59

y

121

79

:

58

3A

Z

90

5A

z

122

7A

;

59

3B

[

91

5B

{

123

7B

<

60

3C

92

5C

|

124

7C

=

61

3D

]

93

5D

}

125

7D

>

62

3E

^

94

5E

~

126

7E

?

63

3F

_

95

5F

     

Characters above 128 are non-English characters or special symbols and are displayed in the Serial Monitor using the characters shown in Table G-3.

Extended characters
  Dec Hex   Dec Hex   Dec Hex   Dec Hex

128

80

Space

160

A0

À

192

C0

à 224 E0

129

81

¡

161

A1

Á

193

C1

á 225 E1

130

82

¢

162

A2

Â

194

C2

â 226 E2

ƒ

131

83

£

163

A3

Ã

195

C3

ã 227 E3

132

84

¤

164

A4

Ä

196

C4

ä 228 E4

133

85

¥

165

A5

Å

197

C5

å 229 E5

134

86

¦

166

A6

Æ

198

C6

æ 230 E6

135

87

§

167

A7

Ç

199

C7

ç 231 E7

ˆ

136

88

¨

168

A8

È

200

C8

è 232 E8

137

89

©

169

A9

É

201

C9

é 233 E9

Š

138

8A

ª

170

AA

Ê

202

CA

ê 234 EA

139

8B

«

171

AB

Ë

203

CB

ë 235 EB

Œ

140

8C

¬

172

AC

Ì

204

CC

ì 236 EC

141

8D

­

173

AD

Í

205

CD

í 237 ED

Ž

142

8E

®

174

AE

Î

206

CE

î 238 EE

143

8F

¯

175

AF

Ï

207

CF

ï 239 EF

144

90

°

176

B0

Ð

208

D0

ð 240 F0

145

91

±

177

B1

Ñ

209

D1

ñ 241 F1

146

92

²

178

B2

Ò

210

D2

ò 242 F2

147

93

³

179

B3

Ó

211

D3

ó 243 F3

148

94

´

180

B4

Ô

212

D4

ô 244 F4

149

95

µ

181

B5

Õ

213

D5

õ 245 F5

150

96

182

B6

Ö

214

D6

ö 246 F6

151

97

·

183

B7

×

215

D7

÷ 247 F7

˜

152

98

¸

184

B8

Ø

216

D8

ø 248 F8

153

99

¹

185

B9

Ù

217

D9

ù 249 F9

š

154

9A

º

186

BA

Ú

218

DA

ú 250 FA

155

9B

»

187

BB

Û

219

DB

û 251 FB

œ

156

9C

¼

188

BC

Ü

220

DC

ü 252 FC

157

9D

½

189

BD

Ý

221

DD

ý 253 FD

ž

158

9E

¾

190

BE

Þ

222

DE

þ 254 FE

Ÿ

159

9F

¿

191

BF

ß

223

DF

ÿ 255 FF

You can view the entire character set in the Serial Monitor using this sketch:

/*
 * display characters from 1 to 255
 */

void setup()
{
  Serial.begin(9600);
  while(!Serial); // For Leonardo and 32-bit boards
  for(int i=1; i < 256; i++)
  {
     Serial.write(i);
     Serial.print(", dec: ");
     Serial.print(i, DEC);
     Serial.print(", hex: ");
     Serial.println(i, HEX);
  }
}

void loop()
{
}

Note that some devices, such as LCD displays (see Chapter 11), may use different symbols for the characters above 128, so check the datasheet for your device to see the actual character supported.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.184.237