键盘编码

来源:本站
导读:目前正在解读《键盘编码》的相关信息,《键盘编码》是由用户自行发布的知识型内容!下面请观看由(电工技术网 - www.9ddd.net)用户发布《键盘编码》的详细说明。

各表列举了键盘按键扫描码和其ASCII码之间的对照关系,表中数据都是十六进制形式。

在用中断16H0号功能时,当按下任意一个键或组合键时,寄存器AHAL分别保存着该按键的扫描码和ASCII码。表1、ASCII码的编码方案

高位

低位

000001010011100101110111SOHDC1!1AQaq0000NULDELSP0@P`p00010010STXDC2“2BRbr0011ETXDC3#3CScs0100EOTDC4$4DTdt0101ENQNAK%5EUeu0110ACKSYN&6FVfv0111BELETB‘7GWgw1000BSCAN(8HXhx1001HTEM)9IYiy1010LFSUB*:JZjz1011VTESC+;K[k{1100FFFS<Ll|1101CRGS-=M]m}1110SORS.>N^n~1111SIUS/?O_oDel表2、字母和空格按键的编码表按键单键SHIFTCTRLALT表3、功能键的编码表按键单键SHIFTCTRLALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码F13B0054005E006800F23C0055005F006900F33D00560060006A00F43E00570061006B00F53F00580062006C00F64000590063006D00F741005A0064006E00F842005B0065006F00F943005C0066007000F1044005D0067007100F118500870089008B00F12860088008A008C00扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码a and A1E611E411E011E00b and B3062304230023000c and C2E632E432E032E00d and D2064204420042000e and E1265124512051200f and F2166214621062100g and G2267224722072200h and H2368234823082300i and I1769174917091700j an1 J246A244A240A2400k and K256B254B250B2500l and L266C264C260C2600m and M326D324D320D3200n and N316E314E310E3100o and O186F184F180F1800p and P1970195019101900q and Q1071105110111000r and R1372135213121300s and S1F731F531F131F00t and T1474145414141400u and U1675165516151600v and V2F762F562F162F00w and W1177115711171100x and X2D782D582D182D00y and Y1579155915191500z and Z2C7A2C5A2C1A2C00SpaceBar3920392039203920

表4、数字键盘的编码表

按键

单键SHIFTCTRLALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Ins & 0520052309200End & 14F004F3175000001↓ & 25000503291000002PgDn & 35100513376000003← & 44B004B347300000454C004C358F000005→ & 64D004D3674000006Home & 74700473777000007↑ & 8480048388D000008PgUp & 94900493984000009+4E2B4E2B90004E00-4A2D4A2D8E004A00Del & '.'5300532E9300*372A372A96003700

表5、第一排数字键盘的编码表

按键单键SHIFTCTRLALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码` and ~2960297E29001 and !0231022178002 and @03320340030079003 and #043304237A004 and $053405247B005 and %063506257C006 and ^0736075E071E7D007 and &083708267E008 and *0938092A7F009 and (0A390A3880000 and )0B300B298100- and _0C2D0C5F0C1F8200= and +0D3D0D2B8300

表6、操作按键的编码表

按键

单键SHIFTCTRLALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码

Esc

01

1B

01

1B

01

1B

01

00

Backspace

0E

08

0E

08

0E

7F

0E

00

Tab

0F

09

0F

00

94

00

A5

00

Enter

1C

0D

1C

0D

1C

0A

1C

00

表7、标号按键的编码表

按键

单键SHIFTCTRLALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码[ and {1A5B1A7B1A1B1A00] and }1B5D1B7D1B1D1B00; and :273B273A27' and "2827282228 and |2b5C2b7C2B1C2b, and <332C333C33. and >342E343E34/ and ?352F353F35

表8、附加按键的编码表

按键

单键SHIFTCTRLALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Slash(/)E02FE02F9500A400EnterE00DE00DE00AA600Home47E047E077E09700End4FE04FE075E09F00PageUp49E049E084E09900PageDown51E051E076E0A100DnArrow50E050E091E0A000LeftArrow4BE04BE073E09B00RightArrow4DE04DE074E09D00UpArrow48E048E08DE09800Ins52E052E092E0A200Del53E053E093E0A300

表9、其它按键的扫描码

当这些键被按下时,BIOS并没有把它们的扫描码输入键盘缓冲区。

按键

扫描码

CapsLock

3A

NumLock

45

ScrollLock

46

Shift(Left)

2A

Shift(Right)

36

Alt

38

Ctrl

1D

PrtScreen

37

=======================================================================================================================键盘扫描码Esc1F159F260F361F462F563F664F765F866F967F1068F1187F1288`411223344556677889910011-12=134314Tab15Q16W17E18R19T20Y21U22I23O24P25[26]27Caps58A30S31D32F33G34H35J36K37L38;39'40Enter28Shift42Z44X45C46V47B48N49M50,51.52/53Shift54Ctrl29Win219Alt184Space57Alt184Win220Menu221Ctrl157Wake

UpSleepPower

Ins210Home199PgUp201Num197/181*55-74Del211End207PgDn209771872973+78475576677200179280381Enter156203208205082.83这里罗列了键盘上各键的扫描码,还有ALT、CTR、SHIFT与部分键的组合扫描码。这对于编写需要键盘处理的程序应该有所帮助!

#define KEY_L1 0x4F

#define KEY_L2 0x50

#define KEY_L3 0x51

#define KEY_L4 0x4B

#define KEY_L6 0x4D

#define KEY_L7 0x47

#define KEY_L8 0x48

#define KEY_L9 0x49

#define KEY_ADD 0x2B

#define KEY_SUB 0x2D

#define KEY_LEFT 75

#define KEY_RIGHT 77

#define KEY_UP 72

#define KEY_DOWN 80

#define KEY_F1 59

#define KEY_F2 60

#define KEY_F3 61

#define KEY_F4 62

#define KEY_F5 63

#define KEY_F6 64

#define KEY_F7 65

#define KEY_F8 66

#define KEY_F9 67

#define KEY_F10 68

#define KEY_INSERT 82

#define KEY_HOME 71

#define KEY_PAGEUP 73

#define KEY_PAGEDOWN 81

#define KEY_DEL 83

#define KEY_END 79

#define KEY_DASH 12

#define KEY_EQUAL 13

#define KEY_LBRACKET 26

#define KEY_RBRACKET 27

#define KEY_SEMICOLON 39

#define KEY_RQUOTE 40

#define KEY_LQUOTE 41

#define KEY_PERIOD 52

#define KEY_COMMA 51

#define KEY_SLASH 53

#define KEY_BACKSLASH 43

#define KEY_ENTER 28

#define KEY_BACKSPACE 14

#define KEY_SPACE 57

#define KEY_TAB 15

#define KEY_ESC 1

#define KEY_Q 16

#define KEY_W 17

#define KEY_E 18

#define KEY_R 19

#define KEY_T 20

#define KEY_Y 21

#define KEY_U 22

#define KEY_I 23

#define KEY_O 24

#define KEY_P 25

#define KEY_A 30

#define KEY_S 31

#define KEY_D 32

#define KEY_F 33

#define KEY_G 34

#define KEY_H 35

#define KEY_J 36

#define KEY_K 37

#define KEY_L 38

#define KEY_Z 44

#define KEY_X 45

#define KEY_C 46

#define KEY_V 47

#define KEY_B 48

#define KEY_N 49

#define KEY_M 50

#define KEY_1 2

#define KEY_2 3

#define KEY_3 4

#define KEY_4 5

#define KEY_5 6

#define KEY_6 7

#define KEY_7 8

#define KEY_8 9

#define KEY_9 10

#define KEY_0 11

/+++++++++++++++++++++++++CTR+各键扫描码+++++++++++++++++++++++++/

#define KEY_F1 0x5E

#define KEY_F2 0x5F

#define KEY_F3 0x60

#define KEY_F4 0x61

#define KEY_F5 0x62

#define KEY_F6 0x63

#define KEY_F7 0x64

#define KEY_F8 0x65

#define KEY_F9 0x66

#define KEY_F10 0x67

#define KEY_2 0x03

#define KEY_6 0x1E

#define KEY_Q 0x11

#define KEY_W 0x17

#define KEY_E 0x05

#define KEY_R 0x12

#define KEY_T 0x14

#define KEY_Y 0x19

#define KEY_U 0x15

#define KEY_I 0x09

#define KEY_O 0x0F

#define KEY_P 0x10

#define KEY_LBRACKET 0x1B

#define KEY_RBRACKET 0x1D

#define KEY_A 0x01

#define KEY_S 0x13

#define KEY_D 0x04

#define KEY_F 0x06

#define KEY_G 0x07

#define KEY_H 0x08

#define KEY_J 0x0A

#define KEY_K 0x0B

#define KEY_L 0x0C

#define KEY_Z 0x1A

#define KEY_X 0x18

#define KEY_C 0x03

#define KEY_V 0x16

#define KEY_B 0x02

#define KEY_N 0x0E

#define KEY_M 0x0D

#define KEY_SPACE 0x20

#define KEY_BACKSPACE 0x7F

#define KEY_ENTER 0x0A

#define KEY_BACKSLASH 0x1C

#define KEY_L1 0x75

#define KEY_L3 0x76

#define KEY_L4 0x73

#define KEY_L6 0x74

#define KEY_L7 0x77

#define KEY_L9 0x84

/+++++++++++++++++++++++++SHIFT+各键扫描码+++++++++++++++++++++++++/

#define KEY_LQUOTE 0x7E

#define KEY_1 0x21

#define KEY_2 0x40

#define KEY_3 0x23

#define KEY_4 0x24

#define KEY_5 0x25

#define KEY_6 0x5E

#define KEY_7 0x26

#define KEY_8 0x2A

#define KEY_9 0x28

#define KEY_0 0x29

#define KEY_DASH 0x5F

#define KEY_EQUAL 0x2B

#define KEY_BACKSPACE 0x08

#define KEY_Q 0x51

#define KEY_W 0x57

#define KEY_E 0x45

#define KEY_R 0x52

#define KEY_T 0x54

#define KEY_Y 0x59

#define KEY_U 0x55

#define KEY_I 0x49

#define KEY_O 0x4F

#define KEY_P 0x50

#define KEY_LBRACKET 0x7B

#define KEY_RBRACKET 0x7D

#define KEY_ENTER 0x0D

#define KEY_A 0x41

#define KEY_S 0x53

#define KEY_D 0x44

#define KEY_F 0x46

#define KEY_G 0x47

#define KEY_H 0x48

#define KEY_J 0x4A

==================================================================================================

键盘键与虚拟键码对照表

字母和数字键 数字小键盘的键 功能键 其它键

键 键码键 键码 键 键码 键键码

A65 0 96 F1 112 Backspace 8

B66 1 97 F2 113 Tab 9

C67 2 98 F3 114 Clear 12

D68 3 99 F4 115 Enter 13

E69 4 100F5 116 Shift 16

F70 5 101F6 117 Control 17

G71 6 102F7 118 Alt 18

H72 7 103F8 119 Caps Lock 20

I73 8 104F9 120 Esc 27

J74 9 105F10121 Spacebar32

K75 * 106F11122 Page Up 33

L76 + 107F12123 Page Down 34

M77 Enter 108-- --End 35

N78 - 109-- -- Home36

O79 . 110-- -- Left Arrow37

P80 / 111-- -- Up Arrow38

Q81 -- ---- -- Right Arrow 39

R82 -- ---- -- Down Arrow 40

S83 -- ---- -- Insert 45

T84 -- ---- -- Delete 46

U85 -- ---- -- Help 47

V86 -- ---- -- Num Lock 144

W87

X88

Y89

Z90

048

149

250

351

452

553

654

755

856

957

0x1 鼠标左键

0x2 鼠标右键

0x3 CANCEL 键

0x4 鼠标中键

0x8 BACKSPACE 键

0x9 TAB 键

0xC CLEAR 键

0xD ENTER 键

0x10 SHIFT 键

0x11 CTRL 键

0x12 MENU 键

0x13 PAUSE 键

0x14 CAPS LOCK 键

0x1B ESC 键

0x20 SPACEBAR 键

0x21 PAGE UP 键

0x22 PAGE DOWN 键

0x23 END 键

0x24 HOME 键

0x25 LEFT ARROW 键

0x26 UP ARROW 键

0x27 RIGHT ARROW 键

0x28 DOWN ARROW 键

0x29 Select 键

0x2A PRINT SCREEN 键

0x2B EXECUTE 键

0x2C SNAPSHOT 键

0x2D Insert 键

0x2E Delete 键

0x2F HELP 键

0x90 NUM LOCK 键

A 至 Z 键与 A – Z 字母的 ASCII 码相同:

值 描述

65 A 键

66 B 键

67 C 键

68 D 键

69 E 键

70 F 键

71 G 键

72 H 键

73 I 键

74 J 键

75 K 键

76 L 键

77 M 键

78 N 键

79 O 键

80 P 键

81 Q 键

82 R 键

83 S 键

84 T 键

85 U 键

86 V 键

87 W 键

88 X 键

89 Y 键

90 Z 键

0 至 9 键与数字 0 – 9 的 ASCII 码相同:

值 描述

48 0 键

49 1 键

50 2 键

51 3 键

52 4 键

53 5 键

54 6 键

55 7 键

56 8 键

57 9 键

下列常数代表数字键盘上的键:

值 描述

0x60 0 键

0x61 1 键

0x62 2 键

0x63 3 键

0x64 4 键

0x65 5 键

0x66 6 键

0x67 7 键

0x68 8 键

0x69 9 键

0x6A MULTIPLICATION SIGN (*) 键

0x6B PLUS SIGN (+) 键

0x6C ENTER 键

0x6D MINUS SIGN (–) 键

0x6E DECIMAL POINT (.) 键

0x6F DIVISION SIGN (/) 键

下列常数代表功能键:

值 描述

0x70 F1 键

0x71 F2 键

0x72 F3 键

0x73 F4 键

0x74 F5 键

0x75 F6 键

0x76 F7 键

0x77 F8 键

0x78 F9 键

0x79 F10 键

0x7A F11 键

0x7B F12 键

0x7C F13 键

0x7D F14 键

0x7E F15 键

0x7F F16 键

0 None

3 Cancel(Break)

8 Back

9 Tab

13 Return

16 ShiftKey

17 ControlKey

18 Menu

19 Pause

20 Capital(大小写)

27 Escape

32 Space

33 PageUp

34 Next(PageDonw)

35 End

36 Home

37 Left

38 Up

39 Right

40 Down

0-9 48-57

45 Insert

46 Delete

65->90 A->Z

91 LWin

93 Apps

96 105 NumPad0-

106 Multiply *

107 Add+

108

109 Subtract-

110 Decimal .

111 Divide /

112-123 F1-F12

144 NumLock

145 Scroll

173 VolumeMute

174 VolumeDown

175 VolumeUp

186 Oem1 ;

187 Oemplus =

188 Oemcomma ,

189 OemMinus -

190 OemPeriod .

191 OemQuestion /

192 Oemtilde `

219 OemOpenBrackets [

220 Oem5

221 Oem6 ]

222 Oem7 '

提醒:《键盘编码》最后刷新时间 2024-03-14 01:04:55,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《键盘编码》该内容的真实性请自行鉴别。