键盘扫描码

合集下载

键盘扫描码

键盘扫描码

键盘扫描码一. 键盘的构造及历史对于键盘,如果想要表示某个按键,硬件上对应着某个点,有两种方法。

一种是对于每个按键,都设计一个硬件的点。

一种是设计成矩阵式,即由多少行,多少列所组成。

举例说明:某个键盘一共需要35个按键。

前者是要设计35个硬件上的点。

后者只需要设计7行5列即可实现7×5=35个按键。

行列的矩阵式,比独立的点的方式,硬件上更容易实现。

矩阵式的键盘普通PC上的键盘,由于按键太多,为了之后的普及和通用性,要有个统一的标准,去定义哪个键值对应到键盘上的哪个按键。

因此,才会出现扫描码Scan Code。

二. 键盘中的扫描码Scan Code从按下一个键盘上的字母,到手松开,实际上对应着一个通码Make Code和一个断码Break Code,两者概念上都属于扫描码ScanCode。

对应的按下键的动作产生的键码叫做通码Make Code。

释放的时候电路被断开产生的键码叫做断码Break Code。

三. 扫描码集合Scan Code Set目前现存有3种Scan Code即,Scan Code Set1(第一种扫描码集合)。

Scan Code Set2。

Scan Code Set3。

四. 第一种扫描码集合Set1的Scan Code的Make Code和Break Code都是单字节。

Make code和Break Code的差别就在最高位,即Break code = make code + 0x80将make code的最高位置1就是Break Code。

五. 键盘常见流程(1)用户按下键盘上的某个键(2)键盘的硬件产生Scan Code,其中目前常见的AT键盘中用的是Set2的Scan Code。

按下是Make Code,释放是Break Code (3)键盘的控制器将Set2的Scan Code转化为Set1的Scan Code。

A. 此处是为了兼容旧的Scan Code Set1才去将Set2转为Set1。

PC键盘第二套扫描码集

PC键盘第二套扫描码集

PC键盘第二套扫描码集编程 2008-06-01 01:17 阅读1094 评论0字号:大中小来源:/web/pckey/scancode.htmPC键盘扫描码参考资料键盘的处理器如果发现有键被按下、释放、或按住键盘不放将发送扫描码的信息包到计算机,扫描码有两种不同的类:型通码和断码,当一个键被按下或按住,就发送通码,当一个键被释放就发送断码,每个按键被分配了唯一的通码和断码,这样主机通过查找唯一的扫描码就可以测定是哪个按键,通码和断码组成了键盘的扫描码集,有三套标准的扫描码集,分别是第一套、第二套和第三套,下面给出的现在通行的第二套扫描码集。

虽然多数按键只有一个字节宽,但也有少数扩展按键的通码是两字节或四字节宽,这类按键的通码第一个字节总是为E0h。

正如键按下通码就被发往计算机一样,只要键一释放断码也会被发送到计算机,每个键都有它自己唯一的通码和断码。

幸运的是,你不用总是通过查表来确定按键的断码,在通码和断码之间存在着必然的联系,多数断码有两字节长,其第一个字节是F0h 第二个字节是这个键的通码,扩展按键的断码通常有三个字节,它们前两个字节是E0h,F0h 最后一个字节是这个按键通码的最后一个字节,下面举一个例子,先列出了几个按键的通码和断码一个按键发送的例子(以按G键为例):通码和断码是以什么样的序列发送到你的计算机,然后使得字符G出现在你的字处理软件里的呢,因为这是一个大写字母需要发生这样的事件次序:按下左Shift- 键-按下G键-释放G-键释放左Shift键,左Shift 键的通码12h,G键的通码34h G键的断码F0h 34h,左Shift键的断码F0h 12h 因此发送到你的计算机的数据应该是:12h 34h F0h 34h F0h 12h。

第二套扫描码:(实用于标准PC的101、102和104 键的键盘):ACPI 扫描码:Windows 多媒体扫描码:Keyboard Scan Codes (Numerical Order)---------------+---------------+---------------+---------------+---------------HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys---------------+---------------+---------------+---------------+---------------|10 16 Q |20 32 D |30 48 B |40 64 F601 1 ESC |11 17 W |21 33 F |31 49 N |41 65 F702 2 1 |12 18 E |22 34 G |32 50 M |42 66 F803 3 2 |13 19 R |23 35 H |33 51 , |43 67 F904 4 3 |14 20 T |24 36 J |34 52 . |44 68 F1005 5 4 |15 21 Y |25 37 K |35 53 / |45 69 Num06 6 5 |16 22 U |26 38 L |36 54 R Shift|46 70 Scroll07 7 6 |17 23 I |27 39 ; |37 55 Prt Sc |47 71 Home08 8 7 |18 24 O |28 40 ' |38 56 Alt |48 72 Up09 9 8 |19 25 P |29 41 ` |39 57 Spa ce |49 73 PgUp0A 10 9 |1A 26 [ |2A 42 LShift|3A 58 Caps |4A 74 -0B 11 0 |1B 27 ] |2B 43 \ |3B 59 F1 |4B 75 Left0C 12 - |1C 28 |2C 44 Z |3C 60 F2 |4C 76 Center0D 13 = |1D 29 CTRL |2D 45 X |3D 61 F3 |4D 77 Right0E 14 bs |1E 30 A |2E 46 C |3E 62 F4 |4E 78 +0F 15 Tab |1F 31 S |2F 47 V |3F 63 F5 |4F 79 End---------------+---------------+---------------+---------------+---------------50 80 Down | | | |51 81 PgDn | | | |52 82 Ins | | | |53 83 Del | | | |---------------+---------------+---------------+---------------+---------------Keyboard Scan Codes (Read from Port HEX 60 = DEC 96) (Keyboard Layout)Top number ... DECBottom number ... HEX+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F1|F2|ESC| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BkS|NumLok|Scr Lok|| | | | | | | | | | | | | | | || | ||59|60| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 | 69 | 70 ||3B|3C|01 |02 |03 |04 |05 |06 |07 |08 |09 |0A |0B |0C |0D |0E | 45 | 46 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F3|F4|TAB| Q | W | E | R | T | Y | U | I | O | P | [ | ] | | 7 3 8 | 9 3 - || | | | | | | | | | | | | | | || 3 | 3 ||61|62|15 |16 |17 |18 |19 |20 |21 |22 |23 |24 |25 |26 |27 | |71 372 |73 374 ||3D|3E|0F |10 |11 |12 |13 |14 |15 |16 |17 |18 |19 |1A |1B | |47 348 |49 34A |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F5|F6|CTR| A | S | D | F | G | H | J | K | L | ; | ' | ` |28 | 4 3 5 | 6 3 || | | | | | | | | | | | | | | || 3 | 3 ||63|64|29 |30 |31 |32 |33 |34 |35 |36 |37 |38 |39 |40 |41 | |75 376 |77 3 ||3F|40|1D |1E |1F |20 |21 |22 |23 |24 |25 |26 |27 |28 |29 | |4B 34C |4D 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F7|F8|Shf| \ | Z | X | C | V | B | N | M | , | . | / |Shf|Prt| 1 3 2 | 3 3 + || | | | | | | | | | | | | | | || 3 | 3 ||65|66|42 |43 |44 |45 |46 |47 |48 |49 |50 |51 |52 |53 |54 |55 |78 380 |81 378 ||41|42|2A |2B |2C |2D |2E |2F |30 |31 |32 |33 |34 |35 |36 |37 |4F 350 |51 34E |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F9|F0| A|t | | | | |pac| | | | |Cap|Lok| I|s 3 D|l 3 || | | | | | | | | | | | | | | || 3 | 3 ||67|68| 5| | | | | |57| | | | | 5| | 8| 3 8| 3 ||43|44| 3| | | | | |39| | | | | 3| | 5| 3 5| 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+Extended ASCII Special Key Codes (Numerical Order)... composed of 2 bytes, the 2nd byte being 00 (00 signifies that the special codes are to be applied.)HEX DEC keys-------------------------------03 3 CTRL-2; same as CHR$(0)0F 15 Shift-tab10 16 Alt-Q11 17 Alt-W12 18 Alt-E13 19 Alt-R14 20 Alt-T15 21 Alt-Y16 22 Alt-U17 23 Alt-I18 24 Alt-O19 25 Alt-P1E 30 Alt-A1F 31 Alt-S20 32 Alt-D21 33 Alt-F22 34 Alt-G23 35 Alt-H24 36 Alt-J25 37 Alt-K26 38 Alt-L2C 44 Alt-Z2D 45 Alt-X2E 46 Alt-C2F 47 Alt-V30 48 Alt-B31 49 Alt-N32 50 Alt-M3B 59 F13C 60 F23D 61 F33E 62 F43F 63 F540 64 F641 65 F742 66 F843 67 F944 68 F1047 71 Home48 72 Up49 73 PgUp4B 75 Left4D 77 Right4F 79 End50 80 Down51 81 PgDn52 82 Ins53 83 Del54 84 Shift-F155 85 Shift-F256 86 Shift-F357 87 Shift-F458 88 Shift-F559 89 Shift-F6 5A 90 Shift-F7 5B 91 Shift-F8 5C 92 Shift-F9 5D 93 Shift-F10 5E 94 Ctrl-F15F 95 Ctrl-F260 96 Ctrl-F361 97 Ctrl-F462 98 Ctrl-F563 99 Ctrl-F664 100 Ctrl-F765 101 Ctrl-F866 102 Ctrl-F967 103 Ctrl-F1068 104 Alt-F169 105 Alt-F26A 106 Alt-F36B 107 Alt-F46C 108 Alt-F56D 109 Alt-F66E 110 Alt-F76F 111 Alt-F870 112 Alt-F971 113 Alt-F1072 114 Ctrl-PrtSc73 115 Ctrl-Left74 116 Ctrl-Right75 117 Ctrl-End76 118 Ctrl-PgDn77 119 Ctrl-Home78 120 Alt-179 121 Alt-27A 122 Alt-37B 123 Alt-47C 124 Alt-57D 125 Alt-67E 126 Alt-77F 127 Alt-880 128 Alt-981 129 Alt-082 130 Alt--83 131 Alt-=84 132 Ctrl-PgUp85 133 Ctrl-Up86 134 Ctrl--(num)87 135 Ctrl-Center88 136 Ctrl-+(num)89 137 Ctrl-Down8A 138 Ctrl-Ins8B 139 Ctrl-Del8C 140 Alt-Home8D 141 Alt-Up8E 142 Alt-PgUp8F 143 Alt--(num)90 144 Alt-Left91 145 Alt-Center92 146 Alt-Right93 147 Alt-+(num)94 148 Alt-End95 149 Alt-Down96 150 Alt-PgDn97 151 Alt-Ins98 152 Alt-DelExtended ASCII Special Key Codes (Keyboard Layout)------------------+-------------------+-------------------+--------------------HEX DEC keys | HEX DEC keys | HEX DEC keys | HEX DEC keys------------------+-------------------+-------------------+--------------------03 3 nul | 0F 15 Shift-tab | 72 114 Ctrl-PrtSc| ------------------+-------------------+-------------------+--------------------47 71 Home | | 77 119 Ctrl-Home | 8C 140 Alt-Home48 72 Up | | 85 133 Ctrl-Up | 8D 141 Alt-Up49 73 PgUp | | 84 132 Ctrl-PgUp | 8E 142 Alt-PgUp4A 74 -(num) | | 86 134 Ctrl--(nu)| 8F 143 Alt--(num)4B 75 Left | | 73 115 Ctrl-Left | 90 144 Alt-Left4C 76 Center | | 87 135 Ctrl-Centr| 91 145 Alt-Center4D 77 Right | | 74 116 Ctrl-Right| 92 146 Alt-Right4E 78 +(num) | | 88 136 Ctrl-+(nu)| 93 147 Alt-+(num)4F 79 End | | 75 117 Ctrl-End | 94 148 Alt-End50 80 Down | | 89 137 Ctrl-Down | 95 149 Alt-Down51 81 PgDn | | 76 118 Ctrl-PgDn | 96 150 Alt-PgDn52 82 Ins | | 8A 138 Ctrl-Ins | 97 151 Alt-Ins53 83 Del | | 8B 139 Ctrl-Del | 98 152 Alt-Del------------------+-------------------+-------------------+--------------------3B 59 F1 | 54 84 Shift-F1 | 5E 94 Ctrl-F1 | 68 104 Alt-F13C 60 F2 | 55 85 Shift-F2 | 5F 95 Ctrl-F2 |69 105 Alt-F23D 61 F3 | 56 86 Shift-F3 | 60 96 Ctrl-F3 | 6A 106 Alt-F33E 62 F4 | 57 87 Shift-F4 | 61 97 Ctrl-F4 | 6B 107 Alt-F43F 63 F5 | 58 88 Shift-F5 | 62 98 Ctrl-F5 | 6C 108 Alt-F540 64 F6 | 59 89 Shift-F6 | 63 99 Ctrl-F6 | 6D 109 Alt-F641 65 F7 | 5A 90 Shift-F7 | 64 100 Ctrl-F7 | 6E 110 Alt-F742 66 F8 | 5B 91 Shift-F8 | 65 101 Ctrl-F8 | 6F 111 Alt-F843 67 F9 | 5C 92 Shift-F9 | 66 102 Ctrl-F9 | 70 112 Alt-F944 68 F10 | 5D 93 Shift-F10 | 67 103 Ctrl-F10 | 71 113 Alt-F10------------------+-------------------+-------------------+--------------------1E 30 Alt-A | 31 49 Alt-N | 78 120 Alt-1 | 30 48 Alt-B | 18 24 Alt-O | 79 121 Alt-2 | 2E 46 Alt-C | 19 25 Alt-P | 7A 122 Alt-3 | 20 32 Alt-D | 10 16 Alt-Q | 7B 123 Alt-4 | 12 18 Alt-E | 13 19 Alt-R | 7C 124 Alt-5 |21 33 Alt-F | 1F 31 Alt-S | 7D 125 Alt-6 |22 34 Alt-G | 14 20 Alt-T | 7E 126 Alt-7 |23 35 Alt-H | 16 22 Alt-U | 7F 127 Alt-8 | 17 23 Alt-I | 2F 47 Alt-V | 80 128 Alt-9 |24 36 Alt-J | 11 17 Alt-W | 81 129 Alt-0 |25 37 Alt-K | 2D 45 Alt-X | 82 130 Alt-- |26 38 Alt-L | 15 21 Alt-Y | 83 131 Alt-= | 32 50 Alt-M | 2C 44 Alt-Z | | ------------------+-------------------+-------------------+--------------------1.htm。

键盘码

键盘码

2PS/2键盘的编码与命令集(1)PS/2键盘的编码现在PC机使用的PS/2键盘都默认采用第二套扫描码集。

该扫描码集可参考文献\[1\]。

扫描码有两种不同的类型:通码(make code)和断码(break code)。

当一个键被按下或持续按住时,键盘会将该键的通码发送给主机;而当一个键被释放时,键盘会将该键的断码发送给主机。

根据键盘按键扫描码的不同,在此可将按键分为如下几类:第一类按键,通码为1字节,断码为0xF0+通码形式。

如A键,其通码为0x1C,断码为0xF0 0x1C。

第二类按键,通码为2字节0xE0+0xXX形式,断码为0xE0+0xF0+0xXX形式。

如right ctrl键,其通码为0xE0 0x14,断码为0xE0 0xF0 0x14。

第三类特殊按键有两个,print screen键通码为0xE0 0x12 0xE0 0x7C,断码为0xE0 0xF0 0x7C 0xE0 0xF0 0x12; pause键通码为0x E1 0x14 0x77 0xE10xF0 0x14 0xF0 0x77,断码为空。

组合按键的扫描码发送按照按键发生的次序,如以下面顺序按左SHIFT+A键:1按下左SHIFT键,2按下A键,3释放A键,4释放左SHIFT键,那么计算机上接收到的一串数据为0x12 0x1C 0xF0 0x1C 0xF0 0x12。

在驱动程序设计中,就是根据这样的分类来对不同的按键进行不同处理的。

(2)PS/2键盘的命令集主机可以通过向PS/2键盘发送命令来对键盘进行设置或者获得键盘的状态等操作。

每发送一个字节,主机都会从键盘获得一个应答0xFA(“重发resend”和“回应echo”命令例外)。

下面简要介绍驱动程序在键盘初始化过程中所用的指令(详细键盘命令集见参考文献\[1\]):0xED主机在本命令后跟随发送一个参数字节,用于指示键盘上num lock, caps lock, scroll lock led的状态;0xF3主机在这条命令后跟随发送一个字节参数来定义键盘机打的速率和延时;0xF4用于在当主机发送0xF5禁止键盘后,重新使能键盘。

c语言键盘扫描码大全

c语言键盘扫描码大全

c语言键盘扫描码大全对程序进行键盘控制时,往往要用到一些键的扫描码,以前每次用时都得先扫下试试,实在麻烦,今天又搞了个小程序,用到了扫描码,索性整了个测试程序,把所有键的扫描码全存入一个文件啦,以便以后编程时使用.在此跟大家分享一下,c语言键盘扫描码 扫描码键 0x011bESC 0x3b00F1 0x3c00F2 0x3d00F3 0x3e00F4 0x3f00F5 0x4000F6 0x4100F7 0x4200F8  0x4300F9  0x4400F10  主键盘区:  0x2960~  0x02311  0x03322  0x04333  0x05344  0x06355  0x07366  0x08377  0x09388 0x0a399 0x0b300 0x0c2d- 0x0d3d= 0x2b5c\ 0x0e08退格键  0x0f09Tab 0x1071q 0x1177w 0x1265e 0x1372r 0x1474t 0x1579y  0x1675u  0x1769i  0x186fo  0x1970p  0x1a5b[  0x1b5d]  0x1e61a  0x1f73s  0x2064d  0x2166f  0x2267g  0x2368h 0x246aj 0x256bk 0x266cl 0x273b; 0x2827’ 0x1c0d回车  0x2c7az 0x2d78x 0x2e63c 0x2f76v 0x3062b 0x316en 0x326dm 0x332c, 0x342e. 0x352f/ 0x3920空格键 右边数字键盘:  0x5200Insert 0x4700Home 0x4900Page UP  0x5300Delete 0x4f00End 0x5100PageDown  0x4800上箭头 0x4b00左箭头 0x5000下箭头 0x4d00右箭头 0x352f/ 0x372a* 0x4a2d- (注意,这是数字键盘的)  0x47377 0x48388 0x49399 0x4b344 0x4c355 0x4d366 0x4e2b+ 0x4f311 0x50322 0x51333 0x52300 0x532eDel 以上就是由为您提供的c语言键盘扫描码,希望给您带来帮助! 。

键盘鼠标扫描码

键盘鼠标扫描码

键盘鼠标扫描码第一篇:键盘鼠标扫描码[VB]键盘鼠标扫描码1.••常数值描述2.vbKeyLButton &H1鼠标左键3.vbKeyRButton &H2鼠标右键4.vbKeyCancel&H3CANCEL键5.vbKeyMButton &H4鼠标中键6.vbKeyBack&H8BACKSPACE键7.vbKeyTab&H9TAB键8.vbKeyClear&HCCLEAR 键9.vbKeyReturn&HDENTER 键10.vbKeyShift&H10 SHIFT 键11.vbKeyControl &H11 CTRL 键12.vbKeyMenu&H12 MENU 键13.vbKeyPause&H13 PAUSE 键14.vbKeyCapital &H14 CAPS LOCK键15.vbKeyEscape&H1B ESC键16.vbKeySpace&H20 SPACEBAR键17.vbKeyPageUp&H21 PAGE UP 键18.vbKeyPageDown &H22 PAGE DOWN键19.vbKeyEnd&H23 END键20.vbKeyHome&H24 HOME 键21.vbKeyLeft&H25 LEFT 键22.vbKeyUp&H26 UP键23.vbKeyRight&H27 RIGHT 键24.vbKeyDown&H28 DOWN 键25.vbKeySelect&H29 SELECT 键26.vbKeyPrint&H2A PRINT SCREEN键27.vbKeyExecute &H2B EXECUTE 键28.vbKeySnapshot &H2C SNAPSHOT键29.vbKeyInsert&H2D INSERT键30.vbKeyDelete&H2E DELETE键31.vbKeyHelp&H2F HELP 键32.vbKeyNumlock &H90 NUM LOCK键33.34.A至Z键与A杴Z字母的ASCII码相同:35.常数值描述36.vbKeyA 65 A 键37.vbKeyB 66 B 键38.vbKeyC 67 C 键39.vbKeyD 68 D 键40.vbKeyE 69 E 键41.vbKeyF 70 F 键42.vbKeyG 71 G 键43.vbKeyH 72 H 键44.vbKeyI 73 I 键45.vbKeyJ 74 J 键46.vbKeyK 75 K 键47.vbKeyL 76 L 键48.vbKeyM 77 M 键49.vbKeyN 78 N 键50.vbKeyO 79 O 键51.vbKeyP 80 P 键52.vbKeyQ 81 Q 键53.vbKeyR 82 R 键54.vbKeyS 83 S 键55.vbKeyT 84 T 键56.vbKeyU 85 U 键57.vbKeyV 86 V 键58.vbKeyW 87 W 键59.vbKeyX 88 X 键60.vbKeyY 89 Y 键61.vbKeyZ 90 Z 键62.63.0 至 9 键与大键盘上的数字 0至9 的ASCII码相同:64.常数值描述65.vbKey0 48 0 键66.vbKey1 49 1 键67.vbKey2 50 2 键68.vbKey3 51 3 键69.vbKey4 52 4 键70.vbKey5 53 5 键71.vbKey6 54 6 键72.vbKey7 55 7 键73.vbKey8 56 8 键74.vbKey9 57 9 键75.76.下列常数代表数字键盘上的键:77.常数值描述78.vbKeyNumpad0 &H60 0 键79.vbKeyNumpad1 &H61 1 键80.vbKeyNumpad2 &H62 2 键81.vbKeyNumpad3 &H63 3 键82.vbKeyNumpad4 &H64 4 键83.vbKeyNumpad5 &H65 5 键84.vbKeyNumpad6 &H66 6 键85.vbKeyNumpad7 &H67 7 键86.vbKeyNumpad8 &H68 8 键87.vbKeyNumpad9 &H69 9 键88.vbKeyMultiply &H6A MULTIPLICATION SIGN(*)键89.vbKeyAdd&H6B PLUS SIGN(+)键90.vbKeySeparator&H6C ENTER 键91.vbKeySubtract &H6D MINUS SIGN(杴)键92.vbKeyDecimal &H6E DECIMAL POINT(.)键93.vbKeyDivide&H6F DIVISION SIGN(/)键94.95.下列常数代表功能键:96.常数值描述97.vbKeyF1 &H70 F1 键98.vbKeyF2 &H71 F2 键99.vbKeyF3 &H72 F3 键100.vbKeyF4 &H73 F4 键101.vbKeyF5 &H74 F5 键102.vbKeyF6 &H75 F6 键103.vbKeyF7 &H76 F7 键104.vbKeyF8 &H77 F8 键105.vbKeyF9 &H78 F9 键106.vbKeyF10 &H79 F10107.vbKeyF11 &H7A F11108.vbKeyF12 &H7B F12109.vbKeyF13 &H7C F13110.vbKeyF14 &H7D F14111.vbKeyF15 &H7E F15112.vbKeyF16 &H7F F16113.•键键键键键键键第二篇:鼠标控制键盘一般用左ALT+左SHIFT+NUM LOCK即可启动鼠标键。

键盘扫描码

键盘扫描码

键盘上的每一个键都有两个唯一的数值进行标志。

为什么要用两个数值而不是一个数值呢?这是因为一个键可以被按下,也可以被释放。

当一个键按下时,它们产生一个唯一的数值,当一个键被释放时,它也会产生一个唯一的数值,我们把这些数值都保存在一张表里面,到时候通过查表就可以知道是哪一个键被敲击,并且可以知道是它是被按下还是被释放了。

这些数值在系统中被称为键盘扫描码2扫描码大全扫描码键0x011b ESC0x3b00 F10x3c00 F20x3d00 F30x3e00 F40x3f00 F50x4000 F60x4100 F70x4200 F80x4300 F90x4400 F10主键盘区:0x2960 ~0x0231 10x0332 20x0433 30x0534 40x0635 50x0736 60x0837 70x0938 80x0a39 90x0b30 00x0c2d -0x0d3d =0x2b5c \0x0e08 退格键0x0f09 Tab0x1071 q0x1177 w0x1265 e0x1372 r0x1474 t0x1579 y0x1769 i0x186f o0x1970 p0x1a5b [0x1b5d ]0x1e61 a0x1f73 s0x2064 d0x2166 f0x2267 g0x2368 h0x246a j0x256b k0x266c l0x273b ;0x2827 '0x1c0d 回车0x2c7a z0x2d78 x0x2e63 c0x2f76 v0x3062 b0x316e n0x326d m0x332c ,0x342e .0x352f /0x3920 空格键0xe05b 左Win0xe05c 右Win0xe05d Menu右边数字键盘:0x5200 Insert0x4700 Home0x4900 Page UP 0x5300 Delete0x4f00 End0x5100 PageDown 0x4800 上箭头0x4b00 左箭头0x5000 下箭头0x4d00 右箭头0x352f /0x4a2d - (注意,这是数字键盘的)0x4737 70x4838 80x4939 90x4b34 40x4c35 50x4d36 60x4e2b +0x4f31 10x5032 20x5133 30x5230 00x532e Del通过PC机键盘输入汉字时,其中经过多次的代码转换:用户---汉字输入码---键盘---键盘扫描码---BIOS键盘驱动程序----ASCII码----汉字输入软件----汉字内码。

键盘扫描码key_code

键盘扫描码key_code

键盘扫描码Keyboard Scan Codes (Numerical Order)---------------+---------------+---------------+---------------+---------------HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys |HEXDEC keys---------------+---------------+---------------+---------------+---------------|10 16 Q |20 32 D |30 48 B |4064 F601 1 ESC |11 17 W |21 33 F |31 49 N |4165 F702 2 1 |12 18 E |22 34 G |32 50 M |4266 F803 3 2 |13 19 R |23 35 H |33 51 , |4367 F904 4 3 |14 20 T |24 36 J |34 52 . |4468 F1005 5 4 |15 21 Y |25 37 K |35 53 / |4569 Num06 6 5 |16 22 U |26 38 L |36 54 RShift|46 70 Scroll07 7 6 |17 23 I |27 39 ; |37 55 PrtSc |4771 Home08 8 7 |18 24 O |28 40 ' |38 56 Alt |4872 Up09 9 8 |19 25 P |29 41 ` |39 57 Space |4973 PgUp0A 10 9 |1A 26 [ |2A 42 LShift|3A 58 Caps |4A 74 -0B 11 0 |1B 27 ] |2B 43 \ |3B 59 F1 |4B75 Left0C 12 - |1C 28 |2C 44 Z |3C 60 F2 |4C76 Center0D 13 = |1D 29 CTRL |2D 45 X |3D 61 F3 |4D77 Right0E 14 bs |1E 30 A |2E 46 C |3E 62 F4 |4E78 +0F 15 Tab |1F 31 S |2F 47 V |3F 63 F5 |4F79 End---------------+---------------+---------------+---------------+---------------50 80 Down | | | |51 81 PgDn | | | |52 82 Ins | | | |53 83 Del | | | | ---------------+---------------+---------------+---------------+---------------Keyboard Scan Codes (Read from Port HEX 60 = DEC 96) (Keyboard Layout)Top number ... DECBottom number ... HEX+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F1|F2|ESC| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BkS|NumLok|Scr Lok|| | | | | | | | | | | | | | | | || ||59|60| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 | 69 | 70 | |3B|3C|01 |02 |03 |04 |05 |06 |07 |08 |09 |0A |0B |0C |0D |0E| 45 | 46 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F3|F4|TAB| Q | W | E | R | T | Y | U | I | O | P | [ | ] | | 7 38 | 9 3 - || | | | | | | | | | | | | | | | | 3| 3 ||61|62|15 |16 |17 |18 |19 |20 |21 |22 |23 |24 |25 |26 |27 | |71 372|73 374 ||3D|3E|0F |10 |11 |12 |13 |14 |15 |16 |17 |18 |19 |1A |1B | |47 348|49 34A |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F5|F6|CTR| A | S | D | F | G | H | J | K | L | ; | ' | ` |28 | 4 35 |6 3 || | | | | | | | | | | | | | | | | 3| 3 ||63|64|29 |30 |31 |32 |33 |34 |35 |36 |37 |38 |39 |40 |41 | |75 376|77 3 ||3F|40|1D |1E |1F |20 |21 |22 |23 |24 |25 |26 |27 |28 |29 | |4B 34C|4D 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F7|F8|Shf| \ | Z | X | C | V | B | N | M | , | . | / |Shf|Prt| 1 32 |3 3 + || | | | | | | | | | | | | | | | | 3| 3 ||65|66|42 |43 |44 |45 |46 |47 |48 |49 |50 |51 |52 |53 |54 |55 |78 380|81 378 ||41|42|2A |2B |2C |2D |2E |2F |30 |31 |32 |33 |34 |35 |36 |37 |4F 350|51 34E |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F9|F0| A|t | | | | |pac| | | | |Cap|Lok| I|s 3D|l 3 || | | | | | | | | | | | | | | | | 3| 3 ||67|68| 5| | | | | |57| | | | | 5| | 8| 3 8| 3 ||43|44| 3| | | | | |39| | | | | 3| | 5| 3 5| 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+Extended ASCII Special Key Codes (Numerical Order)... composed of 2 bytes, the 2nd byte being 00 (00 signifies that the special codes are to be applied.)HEX DEC keys-------------------------------03 3 CTRL-2; same as CHR$(0)0F 15 Shift-tab10 16 Alt-Q11 17 Alt-W12 18 Alt-E13 19 Alt-R14 20 Alt-T15 21 Alt-Y16 22 Alt-U17 23 Alt-I18 24 Alt-O19 25 Alt-P1E 30 Alt-A1F 31 Alt-S20 32 Alt-D21 33 Alt-F22 34 Alt-G23 35 Alt-H24 36 Alt-J25 37 Alt-K26 38 Alt-L2C 44 Alt-Z2D 45 Alt-X2E 46 Alt-C2F 47 Alt-V30 48 Alt-B31 49 Alt-N32 50 Alt-M3B 59 F13C 60 F23D 61 F33E 62 F43F 63 F540 64 F641 65 F742 66 F843 67 F944 68 F1047 71 Home48 72 Up49 73 PgUp4B 75 Left4D 77 Right4F 79 End50 80 Down51 81 PgDn52 82 Ins53 83 Del54 84 Shift-F155 85 Shift-F256 86 Shift-F357 87 Shift-F458 88 Shift-F559 89 Shift-F6 5A 90 Shift-F7 5B 91 Shift-F8 5C 92 Shift-F9 5D 93 Shift-F105F 95 Ctrl-F260 96 Ctrl-F361 97 Ctrl-F462 98 Ctrl-F563 99 Ctrl-F664 100 Ctrl-F765 101 Ctrl-F866 102 Ctrl-F967 103 Ctrl-F1068 104 Alt-F169 105 Alt-F26A 106 Alt-F36B 107 Alt-F46C 108 Alt-F56D 109 Alt-F66E 110 Alt-F76F 111 Alt-F870 112 Alt-F971 113 Alt-F1072 114 Ctrl-PrtSc73 115 Ctrl-Left74 116 Ctrl-Right75 117 Ctrl-End76 118 Ctrl-PgDn77 119 Ctrl-Home78 120 Alt-179 121 Alt-27A 122 Alt-37B 123 Alt-47C 124 Alt-57D 125 Alt-67E 126 Alt-77F 127 Alt-880 128 Alt-981 129 Alt-082 130 Alt--83 131 Alt-=84 132 Ctrl-PgUp85 133 Ctrl-Up86 134 Ctrl--(num)87 135 Ctrl-Center88 136 Ctrl-+(num)89 137 Ctrl-Down8B 139 Ctrl-Del8C 140 Alt-Home8D 141 Alt-Up8E 142 Alt-PgUp8F 143 Alt--(num)90 144 Alt-Left91 145 Alt-Center92 146 Alt-Right93 147 Alt-+(num)94 148 Alt-End95 149 Alt-Down96 150 Alt-PgDn97 151 Alt-Ins98 152 Alt-DelExtended ASCII Special Key Codes (Keyboard Layout)------------------+-------------------+-------------------+--------------------HEX DEC keys | HEX DEC keys | HEX DEC keys | HEX DECkeys------------------+-------------------+-------------------+--------------------03 3 nul | 0F 15 Shift-tab | 72 114 Ctrl-PrtSc|------------------+-------------------+-------------------+--------------------47 71 Home | | 77 119 Ctrl-Home | 8C140 Alt-Home48 72 Up | | 85 133 Ctrl-Up | 8D141 Alt-Up49 73 PgUp | | 84 132 Ctrl-PgUp | 8E142 Alt-PgUp4A 74 -(num) | | 86 134 Ctrl--(nu)| 8F143 Alt--(num)4B 75 Left | | 73 115 Ctrl-Left | 90144 Alt-Left4C 76 Center | | 87 135 Ctrl-Centr| 91145 Alt-Center4D 77 Right | | 74 116 Ctrl-Right| 92146 Alt-Right4E 78 +(num) | | 88 136 Ctrl-+(nu)| 93147 Alt-+(num)4F 79 End | | 75 117 Ctrl-End | 94148 Alt-End50 80 Down | | 89 137 Ctrl-Down | 95149 Alt-Down51 81 PgDn | | 76 118 Ctrl-PgDn | 96150 Alt-PgDn52 82 Ins | | 8A 138 Ctrl-Ins | 97151 Alt-Ins53 83 Del | | 8B 139 Ctrl-Del | 98152 Alt-Del------------------+-------------------+-------------------+--------------------3B 59 F1 | 54 84 Shift-F1 | 5E 94 Ctrl-F1 | 68104 Alt-F13C 60 F2 | 55 85 Shift-F2 | 5F 95 Ctrl-F2 | 69105 Alt-F23D 61 F3 | 56 86 Shift-F3 | 60 96 Ctrl-F3 | 6A106 Alt-F33E 62 F4 | 57 87 Shift-F4 | 61 97 Ctrl-F4 | 6B107 Alt-F43F 63 F5 | 58 88 Shift-F5 | 62 98 Ctrl-F5 | 6C108 Alt-F540 64 F6 | 59 89 Shift-F6 | 63 99 Ctrl-F6 | 6D109 Alt-F641 65 F7 | 5A 90 Shift-F7 | 64 100 Ctrl-F7 | 6E110 Alt-F742 66 F8 | 5B 91 Shift-F8 | 65 101 Ctrl-F8 | 6F111 Alt-F843 67 F9 | 5C 92 Shift-F9 | 66 102 Ctrl-F9 | 70112 Alt-F944 68 F10 | 5D 93 Shift-F10 | 67 103 Ctrl-F10 | 71113 Alt-F10------------------+-------------------+-------------------+--------------------1E 30 Alt-A | 31 49 Alt-N | 78 120 Alt-1 |30 48 Alt-B | 18 24 Alt-O | 79 121 Alt-2 |2E 46 Alt-C | 19 25 Alt-P | 7A 122 Alt-3 |20 32 Alt-D | 10 16 Alt-Q | 7B 123 Alt-4 |12 18 Alt-E | 13 19 Alt-R | 7C 124 Alt-5 |21 33 Alt-F | 1F 31 Alt-S | 7D 125 Alt-6 |22 34 Alt-G | 14 20 Alt-T | 7E 126 Alt-7 |23 35 Alt-H | 16 22 Alt-U | 7F 127 Alt-8 |17 23 Alt-I | 2F 47 Alt-V | 80 128 Alt-9 |24 36 Alt-J | 11 17 Alt-W | 81 129 Alt-0 |25 37 Alt-K | 2D 45 Alt-X | 82 130 Alt-- |26 38 Alt-L | 15 21 Alt-Y | 83 131 Alt-= |32 50 Alt-M | 2C 44 Alt-Z |PC机和键盘部分通信命令字PC机向键盘发出的命令共有10条,键盘向PC机发出的键盘响应共有7条。

键盘码表:单键扫描码,ascii,组合键码

键盘码表:单键扫描码,ascii,组合键码

键盘码表:单键扫描码,ascii,组合键码字母和空格按键的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码a 1E 61 1E 41 1E 01 1E 00b 30 62 30 42 30 02 30 00c 2E 63 2E 43 2E 03 2E 00d 20 64 20 44 20 04 20 00e 12 65 12 45 12 05 12 00f 21 66 21 46 21 06 21 00g 22 67 22 47 22 07 22 00h 23 68 23 48 23 08 23 00i 17 69 17 49 17 09 17 00 j 24 6A 24 4A 24 0A 24 00 k 25 6B 25 4B 25 0B 25 00 l 26 6C 26 4C 26 0C 26 00 m 32 6D 32 4D32 0D 32 00 n 31 6E 31 4E 31 0E 31 00 o 18 6F 18 4F 18 0F 18 00 p 19 70 19 50 19 10 19 00 q 10 71 10 51 10 11 10 00 r 13 72 13 52 13 12 13 00 s 1F 73 1F 53 1F 13 1F 00 t 14 74 14 54 14 14 14 00 u 16 75 16 55 16 15 16 00 v 2F 76 2F 56 2F 16 2F 00 w 11 77 11 57 11 17 11 00 x 2D 78 2D 58 2D 18 2D 00 y 15 79 15 59 15 19 15 00 z 2C 7A 2C 5A 2C 1A 2C 00 SpaceBar 39 20 39 20 39 20 39 20功能键和数字键盘的编码表·内容正⽂按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码F1 3B 00 54 00 5E 00 68 00 F2 3C 00 55 00 5F 00 69 00 F3 3D 00 56 00 60 00 6A 00 F4 3E 00 57 00 61 00 6B 00 F5 3F 00 58 00 62 00 6C 00 F6 40 00 59 00 63 00 6D 00 F7 41 00 5A 00 64 00 6E 00 F8 42 00 5B 00 65 00 6F 00 F9 43 00 5C 00 66 00 70 00 F10 44 00 5D 00 67 00 71 00 F11 85 00 87 00 89 00 8B 00 F12 86 00 88 00 8A 00 8C 00 键盘码表:单键扫描码,ascii,组合键码数字键盘的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Ins&0 52 00 52 30 92 00 00 End&1 4F 00 4F 31 75 00 00 01 ↓&2 50 00 50 32 91 00 00 02 PgDn&3 51 00 51 33 76 00 00 03←&4 4B 00 4B 34 73 00 00 04 5 4C 00 4C 35 8F 00 00 05 →&6 4D 00 4D 36 74 00 00 06 Home&7 47 00 47 37 77 00 00 07↑&8 48 00 48 38 8D 00 00 08 PgUp&9 49 00 49 39 84 00 00 09 + 4E 2B 4E 2B 90 00 4E 00 - 4A 2D 4A 2D 8E 00 4A 00 Del&'.' 53 00 53 2E 93 00 00 * 37 2A 37 2A 96 00 37 00第⼀排数字键盘的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码`@~ 29 60 29 7E 00 29 00 1@! 02 31 02 21 00 78 00 2@@ 03 32 03 40 03 00 79 00 3@# 04 33 04 23 00 7A 00 4@$ 05 34 05 24 00 7B 00 5@% 06 35 06 25 00 7C 00 6@^ 07 36 07 5E 07 1E 7D 00 7@& 08 37 08 26 00 7E 00 8@* 09 38 09 2A 00 7F 00 9@( 0A 39 0A 38 00 80 00 0@) 0B 30 0B 29 00 81 00 -@_0C 2D 0C 5F 0C 1F 82 00 =@+0D 3D 0D 2B 00 83 00操作、标号和附加按键等的编码表·内容正⽂按键单键SHIFT CTRL ALT扫描码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标号按键的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码[@{ 1A 5B 1A 7B 1A 1B 1A 00]@} 1B 5D 1B 7D 1B 1D 1B 00 ;@: 27 3B 27 3A 00 27 00 @" 28 27 28 22 00 28 00 \@| 2b 5C 2b 7C 2B 1C 2b 00 , @ < 33 2C 33 3C 00 33 00 . @> 34 2E 34 3E 00 34 00 / @ ? 35 2F 35 3F 00 35 00、附加按键的编码表按键单键SHIFT CTRL ALT扫描码ASCII码扫描码ASCII码扫描码ASCII码扫描码ASCII码Flash(/) E0 2F E0 2F 95 00 A4 00 Enter E0 0D E0 0D E0 0A A6 00 Home 47 E0 47 E0 77 E0 97 00 End 4F E0 4F E0 75 E0 9F 00 PageUp 49 E0 49 E0 84 E0 99 00 PageDown 51 E0 51 E0 76 E0 A1 00 DnArrow 50 E0 50 E0 91 E0 A0 00 LeftArrow 4B E0 4B E0 73 E0 9B 00 RightArrow 4D E0 4D E0 74 E0 9D 00 UpArrow 48 E0 48 E0 8D E0 98 00 Ins 52 E0 52 E0 92 E0 A2 00 Del 53 E0 53 E0 93 E0 A3 00其它按键的扫描码当这些键被按下时,BIOS并没有把它们的扫描码输⼊键盘缓冲区。

键盘鼠标扫描码

键盘鼠标扫描码

[VB]键盘鼠标扫描码1.∙∙常数值描述2.vbKeyLButton &H1 鼠标左键3.vbKeyRButton &H2 鼠标右键4.vbKeyCancel &H3 CANCEL 键5.vbKeyMButton &H4 鼠标中键6.vbKeyBack &H8 BACKSPACE键7.vbKeyTab &H9 TAB 键8.vbKeyClear &HC CLEAR 键9.vbKeyReturn &HD ENTER 键10.vbKeyShift &H10 SHIFT 键11.vbKeyControl &H11 CTRL 键12.vbKeyMenu &H12 MENU 键13.vbKeyPause &H13 PAUSE 键14.vbKeyCapital &H14 CAPS LOCK键15.vbKeyEscape &H1B ESC 键16.vbKeySpace &H20 SPACEBAR键17.vbKeyPageUp &H21 PAGE UP 键18.vbKeyPageDown &H22 PAGE DOWN键19.vbKeyEnd &H23 END 键20.vbKeyHome &H24 HOME 键21.vbKeyLeft &H25 LEFT 键22.vbKeyUp &H26 UP 键23.vbKeyRight &H27 RIGHT 键24.vbKeyDown &H28 DOWN 键25.vbKeySelect &H29 SELECT 键26.vbKeyPrint &H2A PRINT SCREEN键27.vbKeyExecute &H2B EXECUTE 键28.vbKeySnapshot &H2C SNAPSHOT键29.vbKeyInsert &H2D INSERT 键30.vbKeyDelete &H2E DELETE 键31.vbKeyHelp &H2F HELP 键32.vbKeyNumlock &H90 NUM LOCK键33.34.A至Z键与A杴Z字母的ASCII码相同:35.常数值描述36.vbKeyA 65 A 键37.vbKeyB 66 B 键38.vbKeyC 67 C 键39.vbKeyD 68 D 键40.vbKeyE 69 E 键41.vbKeyF 70 F 键42.vbKeyG 71 G 键43.vbKeyH 72 H 键44.vbKeyI 73 I 键45.vbKeyJ 74 J 键46.vbKeyK 75 K 键47.vbKeyL 76 L 键48.vbKeyM 77 M 键49.vbKeyN 78 N 键50.vbKeyO 79 O 键51.vbKeyP 80 P 键52.vbKeyQ 81 Q 键53.vbKeyR 82 R 键54.vbKeyS 83 S 键55.vbKeyT 84 T 键56.vbKeyU 85 U 键57.vbKeyV 86 V 键58.vbKeyW 87 W 键59.vbKeyX 88 X 键60.vbKeyY 89 Y 键61.vbKeyZ 90 Z 键62.63.0 至 9 键与大键盘上的数字 0至9 的ASCII码相同:64.常数值描述65.vbKey0 48 0 键66.vbKey1 49 1 键67.vbKey2 50 2 键68.vbKey3 51 3 键69.vbKey4 52 4 键70.vbKey5 53 5 键71.vbKey6 54 6 键72.vbKey7 55 7 键73.vbKey8 56 8 键74.vbKey9 57 9 键75.76.下列常数代表数字键盘上的键:77.常数值描述78.vbKeyNumpad0 &H60 0 键79.vbKeyNumpad1 &H61 1 键80.vbKeyNumpad2 &H62 2 键81.vbKeyNumpad3 &H63 3 键82.vbKeyNumpad4 &H64 4 键83.vbKeyNumpad5 &H65 5 键84.vbKeyNumpad6 &H66 6 键85.vbKeyNumpad7 &H67 7 键86.vbKeyNumpad8 &H68 8 键87.vbKeyNumpad9 &H69 9 键88.vbKeyMultiply &H6A MULTIPLICATION SIGN (*)键89.vbKeyAdd &H6B PLUS SIGN (+) 键90.vbKeySeparator &H6C ENTER 键91.vbKeySubtract &H6D MINUS SIGN (杴) 键92.vbKeyDecimal &H6E DECIMAL POINT (.) 键93.vbKeyDivide &H6F DIVISION SIGN (/) 键94.95.下列常数代表功能键:96.常数值描述97.vbKeyF1 &H70 F1 键98.vbKeyF2 &H71 F2 键99.vbKeyF3 &H72 F3 键100.vbKeyF4 &H73 F4 键101.vbKeyF5 &H74 F5 键102.vbKeyF6 &H75 F6 键103.vbKeyF7 &H76 F7 键104.vbKeyF8 &H77 F8 键105.vbKeyF9 &H78 F9 键106.vbKeyF10 &H79 F10 键107.vbKeyF11 &H7A F11 键108.vbKeyF12 &H7B F12 键109.vbKeyF13 &H7C F13 键110.vbKeyF14 &H7D F14 键111.vbKeyF15 &H7E F15 键112.vbKeyF16 &H7F F16 键113.。

键盘扫描原理

键盘扫描原理

键盘扫描原理
键盘扫描原理是指通过控制信号将按键状态传输到计算机的一种技术。

它主要分为两个步骤:键盘扫描和数据传输。

在键盘扫描过程中,计算机会发送扫描码(scan code)到键盘。

扫描码是一个8位的二进制数,用于唯一标识每个按键。

键盘内部有一个按键矩阵,当按键按下时,会触发相应的行和列连线,形成一个电路通路。

键盘通过轮询的方式扫描每个按键的状态,并生成扫描码。

一旦键盘生成了扫描码,它就会通过电缆传输给计算机。

数据传输的方式可以是串行还是并行,取决于键盘和计算机之间的连接方式。

对于串行传输,扫描码会被逐位地发送到计算机。

对于并行传输,扫描码会同时发送到计算机的多个引脚上。

计算机接收到扫描码后,会根据预先定义的映射表将其转换为相应的字符或功能。

映射表可以根据键盘类型和语言环境的不同而有所不同。

计算机将转换后的按键信息存储在一个缓冲区中,供操作系统或应用程序读取和处理。

总结来说,键盘扫描原理通过扫描码和数据传输将按键状态传输给计算机。

这种技术广泛应用于各种键盘设备,包括传统的有线键盘和现代的无线键盘。

键盘扫描码

键盘扫描码

键盘扫描码这里罗列了键盘上各键的扫描码,还有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 25h tt p://h i.ba i d u.c o m /ba ll 648500361#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 0x08h tt p://h i .ba i d u .c o m /ba ll 648500361#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 0x4Ah tt p://h i.b a i d u .c o m /ba ll 648500361。

PC键盘扫描码

PC键盘扫描码

O:就是利用bioskey()得到的值。

参数为0时,bioskey()的返回值如果低八位非0,表示按下了普通键;如果低八位为0,表示按下了功能键。

参数为1时,检测有没有键被按下,如果返回值为0,表示没有键按下,相反有键按下。

参数为2时,表示获取变换键的状态,哪些是变换键呢?变换键包括双态键和控制键,双态键就是num lock、scroll lock、insert和caps lock,控制键就是左右shift、ctrl和alt,返回值的低八位反映了这些变换键的状态:0x01 右边shift0x10 scroll lock打开0x02 左边shift0x20 num lock打开0x04 ctrl键0x40 caps lock打开0x08 alt键0x80 insert打开其实bioskey直接调用bios的int 16h键盘I/O中断,直接就是int 16h 的完整翻版。

键盘扫描码大全对程序进行键盘控制时,往往要用到一些键的扫描码,以前每次用时都得先扫下试试,实在麻烦,今天又搞了个小程序,用到了扫描码,索性整了个测试程序,把所有键的扫描码全存入一个文件啦,以便以后编程时使用.在此跟大家分享一下,虽然得来非常容易,但至少可以免得大家都像我以前那样用时再查扫描码键0x011b ----- ESC0x3b00 ----- F1 0x3c00 ----- F20x3d00 ----- F30x3e00 ----- F40x3f00 ----- F50x4000 ----- F60x4100 ----- F70x4200 ----- F80x4300 ----- F90x4400 ----- F10主键盘区:0x2960 ----- ~0x0231 ----- 10x0332 ----- 20x0433 ----- 30x0534 ----- 40x0635 ----- 50x0736 ----- 60x0837 ----- 70x0938 ----- 80x0a39 ----- 90x0b30 ----- 00x0c2d ----- -0x0d3d ----- =0x2b5c ----- \0x0e08 ----- 退格键0x0f09 ----- Tab0x1071 ----- q0x1177 w0x1265 e0x1372 r0x1474 t0x1579 y0x1675 u0x1769 i0x186f o0x1970 p0x1a5b [0x1b5d ]0x1e61 a0x1f73 s0x2064 d0x2166 f0x2267 g0x2368 h0x246a j0x256b k0x266c l0x273b0x2827 '0x1c0d 回车0x2c7a z0x2d78 x0x2e63 c0x2f76 v0x3062 b0x316e n0x326d m0x332c ,0x342e .0x352f /0x3920 空格键右边数字键盘:0x5200 Insert0x4700 Home0x4900 Page UP0x5300 Delete0x4f00 End0x5100 PageDown0x4800 上箭头0x4b00 左箭头0x5000 下箭头0x4d00 右箭头0x352f /0x372a *0x4a2d - (注意,这是数字键盘的) 0x4737 70x4838 80x4939 90x4b34 40x4c35 50x4d36 60x4e2b +0x4f31 10x5032 20x5133 30x5230 00x532e DelCtrl+字母:在字母扫描码的基础上减去0x0060alt+字母: 在字母的基础上,把最后两位变成00shift+字母:在字母的基础上减去0x0020比如: a----0x1e61 Ctrl+a----0x1e01 Alt+a-----0x1e00b----0x3062 Ctrl+b----0x3002 Alt+b-----0x3000另加: Ctrl+Enter: 0x1c0a可以直接用一个程序查看的,很简单的#include “stdio.h”#include “bios.h”void main(void){int key, modifiers;while ((key=bioskey(0)) != 0 && key!=0x11b){printf("0x%x \n",key);}}*********************************************************** ********************上面列出的编码中,前面两位是“扫描码”,后面两位是ASCII码,合起来是所谓的“键盘码”比如,小键盘的数字键扫描码和大键盘的数字键是不同的,而后两位是一样的,因为那个是它们共用的ASCII码,下面就是扫描码的列表Keyboard Scan Codes (Numerical Order)---------------+---------------+---------------+---------------+---------------HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys---------------+---------------+---------------+---------------+---------------|10 16 Q |20 32 D |30 48 B|40 64 F601 1 ESC |11 17 W |21 33 F |31 49 N |41 65 F702 2 1 |12 18 E |22 34 G |32 50 M |42 66 F803 3 2 |13 19 R |23 35 H |33 51 , |43 67 F904 4 3 |14 20 T |24 36 J |34 52 . |44 68 F1005 5 4 |15 21 Y |25 37 K |35 53 / |45 69 Num06 6 5 |16 22 U |26 38 L |36 54 R Shift |46 70 Scroll07 7 6 |17 23 I |27 39 |37 55 PrtSc |47 71 Home08 8 7 |18 24 O |28 40 ' |38 56 Alt |48 72 Up09 9 8 |19 25 P |29 41 ` |39 57 Space |49 73 PgUp0A 10 9 |1A 26 [ |2A 42 L Shift |3A 58 Caps |4A 74 -0B 11 0 |1B 27 ] |2B 43 \ |3B 59 F1 |4B 75 Left0C 12 - |1C 28 |2C 44 Z |3C 60 F2 |4C 76 Center0D 13 = |1D 29 CTRL |2D 45 X |3D 61 F3 |4D 77 Right0E 14 bs |1E 30 A |2E 46 C |3E 62 F4 |4E 78 +0F 15 Tab |1F 31 S |2F 47 V |3F 63 F5 |4F 79 End---------------+---------------+---------------+---------------+---------------50 80 Down | | | |51 81 PgDn | | | |52 82 Ins | | | |53 83 Del | | | |---------------+---------------+---------------+---------------+---------------Keyboard Scan Codes (Read from Port HEX 60 = DEC 96) (Keyboard Layout)Top number ... DECBottom number ... HEX+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F1|F2|ESC| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BkS|Num Lok|Scr Lok|| | | | | | | | | | | | | | | | | | ||59|60| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 | 69 | 70 ||3B|3C|01 |02 |03 |04 |05 |06 |07 |08 |09 |0A |0B |0C |0D |0E | 45 | 46 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F3|F4|TAB| Q | W | E | R | T | Y | U | I | O | P | [ | ] | | 7 3 8 | 9 3 - || | | | | | | | | | | | | | | | | 3 | 3 ||61|62|15 |16 |17 |18 |19 |20 |21 |22 |23 |24 |25 |26 |27 | |71 372 |73 374 | |3D|3E|0F |10 |11 |12 |13 |14 |15 |16 |17 |18 |19 |1A |1B | |47 348 |49 34A | +--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F5|F6|CTR| A | S | D | F | G | H | J | K | L | | ' | ` |28 | 4 3 5 | 6 3 || | | | | | | | | | | | | | | | | 3 | 3 ||63|64|29 |30 |31 |32 |33 |34 |35 |36 |37 |38 |39 |40 |41 | |75 376 |77 3 | |3F|40|1D |1E |1F |20 |21 |22 |23 |24 |25 |26 |27 |28 |29 | |4B 34C |4D 3 | +--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F7|F8|Shf| \ | Z | X | C | V | B | N | M | , | . | / |Shf|Prt| 1 3 2 | 3 3 + || | | | | | | | | | | | | | | | | 3 | 3 ||65|66|42 |43 |44 |45 |46 |47 |48 |49 |50 |51 |52 |53 |54 |55 |78 380 |81 378 | |41|42|2A |2B |2C |2D |2E |2F |30 |31 |32 |33 |34 |35 |36 |37 |4F 350 |51 34E | +--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F9|F0| A|t | | | | |pac| | | | |Cap|Lok| I|s 3 D|l 3 || | | | | | | | | | | | | | | | | 3 | 3 ||67|68| 5| | | | | |57 | | | | | 5| | 8| 3 8| 3 ||43|44| 3| | | | | |39 | | | | | 3| | 5| 3 5| 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+Extended ASCII Special Key Codes (Numerical Order)... composed of 2 bytes, the 2nd byte being 00 (00 signifies that the speci al codesare to be applied.)HEX DEC keys--------------------------------------03 3 CTRL-2; same as CHR$(0)0F 15 Shift-tab10 16 Alt-Q11 17 Alt-W12 18 Alt-E13 19 Alt-R14 20 Alt-T15 21 Alt-Y16 22 Alt-U17 23 Alt-I18 24 Alt-O19 25 Alt-P 1E 30 Alt-A 1F 31 Alt-S20 32 Alt-D21 33 Alt-F22 34 Alt-G23 35 Alt-H24 36 Alt-J25 37 Alt-K26 38 Alt-L 2C 44 Alt-Z 2D 45 Alt-X 2E 46 Alt-C 2F 47 Alt-V30 48 Alt-B31 49 Alt-N32 50 Alt-M 3B 59 F13C 60 F23D 61 F3-------------------------------------- 3E 62 F43F 63 F540 64 F641 65 F742 66 F843 67 F944 68 F1047 71 Home48 72 Up49 73 PgUp4B 75 Left4D 77 Right4F 79 End50 80 Down51 81 PgDn52 82 Ins53 83 Del54 84 Shift-F155 85 Shift-F256 86 Shift-F357 87 Shift-F458 88 Shift-F559 89 Shift-F6 5A 90 Shift-F7 5B 91 Shift-F8 5C 92 Shift-F9 5D 93 Shift-F10 5E 94 Ctrl-F1 5F 95 Ctrl-F260 96 Ctrl-F361 97 Ctrl-F462 98 Ctrl-F563 99 Ctrl-F664 100 Ctrl-F765 101 Ctrl-F866 102 Ctrl-F967 103 Ctrl-F1068 104 Alt-F169 105 Alt-F2 6A 106 Alt-F3 6B 107 Alt-F46D 109 Alt-F66E 110 Alt-F76F 111 Alt-F870 112 Alt-F971 113 Alt-F1072 114 Ctrl-PrtSc73 115 Ctrl-Left74 116 Ctrl-Right75 117 Ctrl-End76 118 Ctrl-PgDn77 119 Ctrl-Home78 120 Alt-179 121 Alt-27A 122 Alt-37B 123 Alt-47C 124 Alt-57D 125 Alt-67E 126 Alt-77F 127 Alt-880 128 Alt-981 129 Alt-083 131 Alt-=84 132 Ctrl-PgUp85 133 Ctrl-Up86 134 Ctrl--(num)87 135 Ctrl-Center88 136 Ctrl-+(num)89 137 Ctrl-Down 8A 138 Ctrl-Ins8B 139 Ctrl-Del8C 140 Alt-Home 8D 141 Alt-Up8E 142 Alt-PgUp 8F 143 Alt--(num)90 144 Alt-Left91 145 Alt-Center92 146 Alt-Right93 147 Alt-+(num)94 148 Alt-End95 149 Alt-Down96 150 Alt-PgDn97 151 Alt-InsExtended ASCII Special Key Codes (Keyboard Layout)------------------+-------------------+-------------------+--------------------HEX DEC keys | HEX DEC keys | HEX DEC keys | HEX DEC keys ------------------+-------------------+-------------------+--------------------03 3 nul | 0F 15 Shift-tab | 72 114 Ctrl-PrtSc|------------------+-------------------+-------------------+--------------------47 71 Home | | 77 119 Ctrl-Home | 8C 140 Alt-Home48 72 Up | | 85 133 Ctrl-Up | 8D 141 Alt-Up49 73 PgUp | | 84 132 Ctrl-PgUp | 8E 142 Alt-PgUp 4A 74 -(num) | | 86 134 Ctrl--(nu)| 8F 143 Alt--(num) 4B 75 Left | | 73 115 Ctrl-Left | 90 144 Alt-Left4C 76 Center | | 87 135 Ctrl-Centr| 91 145 Alt-Center 4D 77 Right | | 74 116 Ctrl-Right| 92 146 Alt-Right4E 78 +(num) | | 88 136 Ctrl-+(nu)| 93 147 Alt-+(num) 4F 79 End | | 75 117 Ctrl-End | 94 148 Alt-End50 80 Down | | 89 137 Ctrl-Down | 95 149 Alt-Down51 81 PgDn | | 76 118 Ctrl-PgDn | 96 150 Alt-PgDn52 82 Ins | | 8A 138 Ctrl-Ins | 97 151 Alt-Ins53 83 Del | | 8B 139 Ctrl-Del | 98 152 Alt-Del------------------+-------------------+-------------------+--------------------3B 59 F1 | 54 84 Shift-F1 | 5E 94 Ctrl-F1 | 68 104 Alt-F13C 60 F2 | 55 85 Shift-F2 | 5F 95 Ctrl-F2 | 69 105 Alt-F23D 61 F3 | 56 86 Shift-F3 | 60 96 Ctrl-F3 | 6A 106 Alt-F33E 62 F4 | 57 87 Shift-F4 | 61 97 Ctrl-F4 | 6B 107 Alt-F43F 63 F5 | 58 88 Shift-F5 | 62 98 Ctrl-F5 | 6C 108 Alt-F540 64 F6 | 59 89 Shift-F6 | 63 99 Ctrl-F6 | 6D 109 Alt-F641 65 F7 | 5A 90 Shift-F7 | 64 100 Ctrl-F7 | 6E 110 Alt-F742 66 F8 | 5B 91 Shift-F8 | 65 101 Ctrl-F8 | 6F 111 Alt-F843 67 F9 | 5C 92 Shift-F9 | 66 102 Ctrl-F9 | 70 112 Alt-F944 68 F10 | 5D 93 Shift-F10 | 67 103 Ctrl-F10 | 71 113 Alt-F10 ------------------+-------------------+-------------------+--------------------1E 30 Alt-A | 31 49 Alt-N | 78 120 Alt-1 |30 48 Alt-B | 18 24 Alt-O | 79 121 Alt-2 |2E 46 Alt-C | 19 25 Alt-P | 7A 122 Alt-3 |20 32 Alt-D | 10 16 Alt-Q | 7B 123 Alt-4 |12 18 Alt-E | 13 19 Alt-R | 7C 124 Alt-5 |21 33 Alt-F | 1F 31 Alt-S | 7D 125 Alt-6 |22 34 Alt-G | 14 20 Alt-T | 7E 126 Alt-7 |23 35 Alt-H | 16 22 Alt-U | 7F 127 Alt-8 |17 23 Alt-I | 2F 47 Alt-V | 80 128 Alt-9 |24 36 Alt-J | 11 17 Alt-W | 81 129 Alt-0 |25 37 Alt-K | 2D 45 Alt-X | 82 130 Alt-- |26 38 Alt-L | 15 21 Alt-Y | 83 131 Alt-= |32 50 Alt-M | 2C 44 Alt-Z | |------------------+-------------------+-------------------+--------------------。

键盘扫描码key_code

键盘扫描码key_code

键盘扫描码Keyboard Scan Codes (Numerical Order)---------------+---------------+---------------+---------------+---------------HEX DEC keys |HEX DEC keys |HEX DEC keys |HEX DEC keys |HEXDEC keys---------------+---------------+---------------+---------------+---------------|10 16 Q |20 32 D |30 48 B |4064 F601 1 ESC |11 17 W |21 33 F |31 49 N |4165 F702 2 1 |12 18 E |22 34 G |32 50 M |4266 F803 3 2 |13 19 R |23 35 H |33 51 , |4367 F904 4 3 |14 20 T |24 36 J |34 52 . |4468 F1005 5 4 |15 21 Y |25 37 K |35 53 / |4569 Num06 6 5 |16 22 U |26 38 L |36 54 RShift|46 70 Scroll07 7 6 |17 23 I |27 39 ; |37 55 PrtSc |4771 Home08 8 7 |18 24 O |28 40 ' |38 56 Alt |4872 Up09 9 8 |19 25 P |29 41 ` |39 57 Space |4973 PgUp0A 10 9 |1A 26 [ |2A 42 LShift|3A 58 Caps |4A 74 -0B 11 0 |1B 27 ] |2B 43 \ |3B 59 F1 |4B75 Left0C 12 - |1C 28 |2C 44 Z |3C 60 F2 |4C76 Center0D 13 = |1D 29 CTRL |2D 45 X |3D 61 F3 |4D77 Right0E 14 bs |1E 30 A |2E 46 C |3E 62 F4 |4E78 +0F 15 Tab |1F 31 S |2F 47 V |3F 63 F5 |4F79 End---------------+---------------+---------------+---------------+---------------50 80 Down | | | |51 81 PgDn | | | |52 82 Ins | | | |53 83 Del | | | | ---------------+---------------+---------------+---------------+---------------Keyboard Scan Codes (Read from Port HEX 60 = DEC 96) (Keyboard Layout)Top number ... DECBottom number ... HEX+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F1|F2|ESC| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BkS|NumLok|Scr Lok|| | | | | | | | | | | | | | | | || ||59|60| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 | 69 | 70 | |3B|3C|01 |02 |03 |04 |05 |06 |07 |08 |09 |0A |0B |0C |0D |0E| 45 | 46 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F3|F4|TAB| Q | W | E | R | T | Y | U | I | O | P | [ | ] | | 7 38 | 9 3 - || | | | | | | | | | | | | | | | | 3| 3 ||61|62|15 |16 |17 |18 |19 |20 |21 |22 |23 |24 |25 |26 |27 | |71 372|73 374 ||3D|3E|0F |10 |11 |12 |13 |14 |15 |16 |17 |18 |19 |1A |1B | |47 348|49 34A |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F5|F6|CTR| A | S | D | F | G | H | J | K | L | ; | ' | ` |28 | 4 35 |6 3 || | | | | | | | | | | | | | | | | 3| 3 ||63|64|29 |30 |31 |32 |33 |34 |35 |36 |37 |38 |39 |40 |41 | |75 376|77 3 ||3F|40|1D |1E |1F |20 |21 |22 |23 |24 |25 |26 |27 |28 |29 | |4B 34C|4D 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F7|F8|Shf| \ | Z | X | C | V | B | N | M | , | . | / |Shf|Prt| 1 32 |3 3 + || | | | | | | | | | | | | | | | | 3| 3 ||65|66|42 |43 |44 |45 |46 |47 |48 |49 |50 |51 |52 |53 |54 |55 |78 380|81 378 ||41|42|2A |2B |2C |2D |2E |2F |30 |31 |32 |33 |34 |35 |36 |37 |4F 350|51 34E |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+|F9|F0| A|t | | | | |pac| | | | |Cap|Lok| I|s 3D|l 3 || | | | | | | | | | | | | | | | | 3| 3 ||67|68| 5| | | | | |57| | | | | 5| | 8| 3 8| 3 ||43|44| 3| | | | | |39| | | | | 3| | 5| 3 5| 3 |+--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+-------+Extended ASCII Special Key Codes (Numerical Order)... composed of 2 bytes, the 2nd byte being 00 (00 signifies that the special codes are to be applied.)HEX DEC keys-------------------------------03 3 CTRL-2; same as CHR$(0)0F 15 Shift-tab10 16 Alt-Q11 17 Alt-W12 18 Alt-E13 19 Alt-R14 20 Alt-T15 21 Alt-Y16 22 Alt-U17 23 Alt-I18 24 Alt-O19 25 Alt-P1E 30 Alt-A1F 31 Alt-S20 32 Alt-D21 33 Alt-F22 34 Alt-G23 35 Alt-H24 36 Alt-J25 37 Alt-K26 38 Alt-L2C 44 Alt-Z2D 45 Alt-X2E 46 Alt-C2F 47 Alt-V30 48 Alt-B31 49 Alt-N32 50 Alt-M3B 59 F13C 60 F23D 61 F33E 62 F43F 63 F540 64 F641 65 F742 66 F843 67 F944 68 F1047 71 Home48 72 Up49 73 PgUp4B 75 Left4D 77 Right4F 79 End50 80 Down51 81 PgDn52 82 Ins53 83 Del54 84 Shift-F155 85 Shift-F256 86 Shift-F357 87 Shift-F458 88 Shift-F559 89 Shift-F6 5A 90 Shift-F7 5B 91 Shift-F8 5C 92 Shift-F9 5D 93 Shift-F105F 95 Ctrl-F260 96 Ctrl-F361 97 Ctrl-F462 98 Ctrl-F563 99 Ctrl-F664 100 Ctrl-F765 101 Ctrl-F866 102 Ctrl-F967 103 Ctrl-F1068 104 Alt-F169 105 Alt-F26A 106 Alt-F36B 107 Alt-F46C 108 Alt-F56D 109 Alt-F66E 110 Alt-F76F 111 Alt-F870 112 Alt-F971 113 Alt-F1072 114 Ctrl-PrtSc73 115 Ctrl-Left74 116 Ctrl-Right75 117 Ctrl-End76 118 Ctrl-PgDn77 119 Ctrl-Home78 120 Alt-179 121 Alt-27A 122 Alt-37B 123 Alt-47C 124 Alt-57D 125 Alt-67E 126 Alt-77F 127 Alt-880 128 Alt-981 129 Alt-082 130 Alt--83 131 Alt-=84 132 Ctrl-PgUp85 133 Ctrl-Up86 134 Ctrl--(num)87 135 Ctrl-Center88 136 Ctrl-+(num)89 137 Ctrl-Down8B 139 Ctrl-Del8C 140 Alt-Home8D 141 Alt-Up8E 142 Alt-PgUp8F 143 Alt--(num)90 144 Alt-Left91 145 Alt-Center92 146 Alt-Right93 147 Alt-+(num)94 148 Alt-End95 149 Alt-Down96 150 Alt-PgDn97 151 Alt-Ins98 152 Alt-DelExtended ASCII Special Key Codes (Keyboard Layout)------------------+-------------------+-------------------+--------------------HEX DEC keys | HEX DEC keys | HEX DEC keys | HEX DECkeys------------------+-------------------+-------------------+--------------------03 3 nul | 0F 15 Shift-tab | 72 114 Ctrl-PrtSc|------------------+-------------------+-------------------+--------------------47 71 Home | | 77 119 Ctrl-Home | 8C140 Alt-Home48 72 Up | | 85 133 Ctrl-Up | 8D141 Alt-Up49 73 PgUp | | 84 132 Ctrl-PgUp | 8E142 Alt-PgUp4A 74 -(num) | | 86 134 Ctrl--(nu)| 8F143 Alt--(num)4B 75 Left | | 73 115 Ctrl-Left | 90144 Alt-Left4C 76 Center | | 87 135 Ctrl-Centr| 91145 Alt-Center4D 77 Right | | 74 116 Ctrl-Right| 92146 Alt-Right4E 78 +(num) | | 88 136 Ctrl-+(nu)| 93147 Alt-+(num)4F 79 End | | 75 117 Ctrl-End | 94148 Alt-End50 80 Down | | 89 137 Ctrl-Down | 95149 Alt-Down51 81 PgDn | | 76 118 Ctrl-PgDn | 96150 Alt-PgDn52 82 Ins | | 8A 138 Ctrl-Ins | 97151 Alt-Ins53 83 Del | | 8B 139 Ctrl-Del | 98152 Alt-Del------------------+-------------------+-------------------+--------------------3B 59 F1 | 54 84 Shift-F1 | 5E 94 Ctrl-F1 | 68104 Alt-F13C 60 F2 | 55 85 Shift-F2 | 5F 95 Ctrl-F2 | 69105 Alt-F23D 61 F3 | 56 86 Shift-F3 | 60 96 Ctrl-F3 | 6A106 Alt-F33E 62 F4 | 57 87 Shift-F4 | 61 97 Ctrl-F4 | 6B107 Alt-F43F 63 F5 | 58 88 Shift-F5 | 62 98 Ctrl-F5 | 6C108 Alt-F540 64 F6 | 59 89 Shift-F6 | 63 99 Ctrl-F6 | 6D109 Alt-F641 65 F7 | 5A 90 Shift-F7 | 64 100 Ctrl-F7 | 6E110 Alt-F742 66 F8 | 5B 91 Shift-F8 | 65 101 Ctrl-F8 | 6F111 Alt-F843 67 F9 | 5C 92 Shift-F9 | 66 102 Ctrl-F9 | 70112 Alt-F944 68 F10 | 5D 93 Shift-F10 | 67 103 Ctrl-F10 | 71113 Alt-F10------------------+-------------------+-------------------+--------------------1E 30 Alt-A | 31 49 Alt-N | 78 120 Alt-1 |30 48 Alt-B | 18 24 Alt-O | 79 121 Alt-2 |2E 46 Alt-C | 19 25 Alt-P | 7A 122 Alt-3 |20 32 Alt-D | 10 16 Alt-Q | 7B 123 Alt-4 |12 18 Alt-E | 13 19 Alt-R | 7C 124 Alt-5 |21 33 Alt-F | 1F 31 Alt-S | 7D 125 Alt-6 |22 34 Alt-G | 14 20 Alt-T | 7E 126 Alt-7 |23 35 Alt-H | 16 22 Alt-U | 7F 127 Alt-8 |17 23 Alt-I | 2F 47 Alt-V | 80 128 Alt-9 |24 36 Alt-J | 11 17 Alt-W | 81 129 Alt-0 |25 37 Alt-K | 2D 45 Alt-X | 82 130 Alt-- |26 38 Alt-L | 15 21 Alt-Y | 83 131 Alt-= |32 50 Alt-M | 2C 44 Alt-Z |PC机和键盘部分通信命令字PC机向键盘发出的命令共有10条,键盘向PC机发出的键盘响应共有7条。

表二101、102、104键键盘(第二套扫描码集)

表二101、102、104键键盘(第二套扫描码集)
F0,4B
L GUI
E0,1F
E0,F0,1F
NUM
77
F0,77
M
3A
F0,3A
L ALT
11
F0,11
KP /
E0,4A
E0,F0,4A
N
31
F0,31
R SHFT
59
F0,59
KP *
7C
F0,7C
O
44
F0,44
R CTRL
E0,14
E0,F0,14
KP -
7B
F0,7B
P
4D
F0,4D
R GUI
表二101、102、104键键盘(第二套扫描码集):
键 名
通 码
断 码
-
键 名
通 码
断 码
-
键 名
通 码
断 码
A
1C
F0,1C
9
46
F0,46
[
54
FO,54
B
32
F0,32
`
0E
F0,0E
INSERT
E0,70
E0,F0,70
C
21
F0,21
-
4E
F0,4E
HOME
E0,6C
E0,F0,6C
D
23
Previous Track
E0, 15
E0, F0, 15
Stop
E0, 3B
E0, F0, 3B
Play/Pause
E0, 34
E0, F0, 34
Mute
E0, 23
E0, F0, 23
Volume Up
E0, 32
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

键盘扫描码
键盘上除了ASCII码外,还有非ASCII码(如左移键“←”对应的编码),叫扩充键盘码。

我们把扩充键盘码放在高八位,ASC II码放在低八位所组成的代码称为扫描码。

对于某一特定的扫描码,若其低8位不为零,则此8位就是相应字符的ASCII码值;若低8位是零,则高8位是扩充键盘码,需要再读取人第二个字节,根据它的值来判断它是那一个功能键。

下表给出了单功能键和组合功能键的键值,表中代码系指第二个字节键值的十进制数。

例如,“←”的扫描码低8位应为零,而高8位是0x4b,所以,“←”键的扫描码为O x4b00;而“回车键”有对应的ASCII码,故其扫描码的低8位是回车键的ASCII码值0xod。

测试键盘扫描码
调用标准库函数b ioskey()读取键盘扫描码。

注意要使用b io skey()函数,应在文件头部加上#includ e “b ios.h”。

函数b io skey()的功能是用于识别用户按键和获得按键值。

函数原
型是:
int b ioskey(int cmd);
在<b ios.h>中定义,在使用它时,应用include命令将b ios.h文件包含进来。

其中参数cmd可取值0或1。

①当cmd=1时,检测键盘是否有击键,如果没有击键,函数将返回0,否则返回非零;
②当cmd=0时,返回从键盘输入的扫描码。

语句key=b ioskey(0);读取键盘输入的扫描码,并存储在变量k ey 中。

相关文档
最新文档