You are on page 1of 14

3510-2 appC.f.

qc

7/28/00

13:53

Page 709

A P P E N D I X

Keyboard Codes
and ASCII Chart

small microprocessor chip inside the keyboard controls the PC keyboard. Power and clock signals are provided from the system board, and data is returned in codes
from the keyboard.
There are unique codes for each key pressed and special
codes when certain keys are released. This is why there are
some keys with no printable or transmittable code or characters, but the PC knows a key has been pressed. The keyboard also provides the status of the CapsLock, NumLock,
and ScrollLock keys.
These codes are provided to the system board for interpretation and conversion into standard ASCII codes for the 128
characters of the ASCII character set.
IBM enhances the ASCII character set with some foreign
language symbols and a set of line and block characters
for graphics use, completing a 256-character code set.
The F1F10 keys, as well as the Alt, SysReq, PrtSc, and Lock
keys, have no ASCII equivalents. The PC and programs that
know how to interpret the keyboard data use these internally.
Table C-1 provides the key name or character, the code sent
to the PC system board (shown in both hex and decimal), and
the key number which is used by the PC to know which key
is pressed. Note that some key operations produce two codes.
This allows for Shift, Ctrl, and Alt extensions of key presses.
It is important to have all three codes available because different programs look for different representations of the keys.
Also, the key number assignments differ between the PC and
XT systems, the AT, and a variety of enhanced keyboards.

3510-2 appC.f.qc

710

7/28/00

13:53

Page 710

Appendixes

Table C-1
Keyboard Codes
Key Number

Key Label
Lower Case

Key Label
Upper Case

Scan Code
Hex

Scan Code
Decimal

2B

43

02

03

04

05

06

07

&

08

09

10

0A

10

11

0B

11

12

0C

12

13

0D

13

14

5D

93

15

Back Space

Back Space

0E

14

16

Tab

Back Tab

0F

15

17

10

16

18

11

17

19

12

18

20

13

19

21

14

20

22

15

21

23

16

22

24

17

23

25

18

24

26

19

25

27

1A

26

28

1B

27

29

Enter

Enter

1C

28

3510-2 appC.f.qc

7/28/00

13:53

Page 711

Appendix C Keyboard Codes and ASCII Chart

Key Number

Key Label
Lower Case

Key Label
Upper Case

Scan Code
Hex

Scan Code
Decimal

30

Caps Lock

Caps Lock

3A

58

31

1E

30

32

1F

31

33

20

32

34

21

33

35

22

34

36

23

35

37

24

36

38

25

37

39

26

38

40

27

39

41

28

40

44

Left Shift

Left Shift

2A

42

46

2C

44

47

2D

45

48

2E

46

49

2F

47

50

30

48

51

31

49

52

32

50

53

<

33

51

54

>

34

52

55

35

53

57

Right Shift

Right Shift

36

54

58

Left Ctrl

Left Ctrl

1D

55

60

Left Alt

Left Alt

38

56

61

Space Bar

Space Bar

39

57

62

Right Alt

Right Alt

E0,38

64

Right Ctrl

Right Ctrl

E0,1D

75

Insert

Insert

E0,52
Continued

711

3510-2 appC.f.qc

712

7/28/00

13:53

Page 712

Appendixes

Table C-1 (continued)


Key Number

Key Label
Lower Case

Key Label
Upper Case

Scan Code
Hex

Scan Code
Decimal

76

Delete

Delete

E0,53

79

Left Arrow

Left Arrow

E0,4B

80

Home

Home

E0,47

81

End

End

E0,4F

83

Up Arrow

Up Arrow

E0,48

84

Down Arrow

Down Arrow

E0,50

85

Page Up

Page Up

E0,49

86

Page Down

Page Down

E0,51

89

Right Arrow

Right Arrow

E0,4D

90

Num Lock

Num Lock

45,C5

91

Keypad 7

Home

47

71

92

Keypad 4

Left Arrow

4B

75

93

Keypad 1

End

4F

79

95

Keypad /

Keypad /

E0,35

96

Keypad 8

Up Arrow

48

72

97

Keypad 5

4C

76

98

Keypad 2

Down Arrow

50

80

99

Keypad 0

Insert

52

82

100

Keypad *

Keypad *

E0,37

101

Keypad 9

Page Up

49

73

102

Keypad 6

Right Arrow

4D

77

103

Keypad 3

Page Down

51

81

104

Keypad .

Keypad .

53

83

105

Keypad -

Keypad -

4A

74

106

Keypad +

Keypad +

4E

78

108

Keypad Enter

Keypad Enter

E0,1C

110

Esc

Esc

01

112

F1

F1

3B

59

113

F2

F2

3C

60

3510-2 appC.f.qc

7/28/00

13:53

Page 713

Appendix C Keyboard Codes and ASCII Chart

Key Number

Key Label
Lower Case

Key Label
Upper Case

Scan Code
Hex

Scan Code
Decimal

114

F3

F3

3D

61

115

F4

F4

3E

62

116

F5

F5

3F

63

117

F6

F6

40

64

118

F7

F7

41

65

119

F8

F8

42

66

120

F9

F9

43

67

121

F10

F10

44

68

122

F11

F11

D9

217

123

F12

F12

DA

218

124

PrtSc/SysRq

PrtSc/SysRq

2A,37

125

Scroll Lock

Scroll Lock

46

126

Pause Break

Pause Break

1D,E0,45,
E0,C5,9D

70

Complete ASCII Chart


The following 8-part table, in Figures C-1 through C-8, shows the most common
(and one very uncommon) characters, codes, and symbols of the 256 possible
values that an 8-bit character may represent. The first 128 (0 to 127) are the ASCII
(American Standard Code for Information Interchange) codes and characters. The
second 128 characters (128 to 255) are defined quite differently from one major
platform to another. IBM first used them in the PC for foreign language characters
and line drawing characters. With all of the fonts available today, one of these values could be a traffic sign or a weird looking symbol from the ZapfDingbats fonts
character set.
No ASCII chart would be considered complete without the PC version of the ASCII
characters and the corresponding HEX values from 00 to FF. Few include the Octal
numbers from 000 to 377. Sometimes youll find an ASCII chart with the binary
sequence from 00000000 to 11111111. Seldom do you find one with the EBCDIC
characters, codes, and symbols (from IBM mainframes). The kicker in this chart are
the EBCDIC card codes. Remember punch cards? Did you ever think about reading
the information in those holes? Now, you too can be one of those strange people.

713

3510-2 appC.f.qc

714

7/28/00

13:53

Page 714

Appendixes

Figure C-1: ASCII chart, Part 1

3510-2 appC.f.qc

7/28/00

13:53

Page 715

Appendix C Keyboard Codes and ASCII Chart

Figure C-2: ASCII chart, Part 2

715

3510-2 appC.f.qc

716

7/28/00

13:53

Page 716

Appendixes

Figure C-3: ASCII chart, Part 3

3510-2 appC.f.qc

7/28/00

13:53

Page 717

Appendix C Keyboard Codes and ASCII Chart

Figure C-4: ASCII chart, Part 4

717

3510-2 appC.f.qc

718

7/28/00

13:53

Page 718

Appendixes

Figure C-5: ASCII Chart, Part 5

3510-2 appC.f.qc

7/28/00

13:53

Page 719

Appendix C Keyboard Codes and ASCII Chart

Figure C-6: ASCII chart, Part 6

719

3510-2 appC.f.qc

720

7/28/00

13:53

Page 720

Appendixes

Figure C-7: ASCII chart, Part 7

3510-2 appC.f.qc

7/28/00

13:53

Page 721

Appendix C Keyboard Codes and ASCII Chart

Figure C-8: ASCII chart, Part 8

721

3510-2 appC.f.qc

7/28/00

13:53

Page 722

You might also like