⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 at keyboard interfacing.htm

📁 关于PS/2和USB键盘、鼠标的各种扫描码的资料。
💻 HTM
📖 第 1 页 / 共 5 页
字号:
        14</CENTER></TD></TR></TBODY></TABLE></BLOCKQUOTE></BLOCKQUOTE>Example:&nbsp; 
        What sequence of make codes and break codes should be sent to your 
        computer for the character "G" to appear in a word processor?&nbsp; 
        Since this is an upper-case letter, the sequence of events that need to 
        take place are: press the "Shift" key, press the "G" key, release the 
        "G" key, release the "Shift" key.&nbsp; The scan codes associated with 
        these events are the following:&nbsp; make code for the "Shift" key 
        (12h), make code for the "G" key (34h), break code for the "G" 
        key(F0h,34h), break code for the "Shift" key (F0h,12h).&nbsp; Therefore, 
        the data sent to your computer would be: 12h, 34h, F0h, 34h, F0h, 
      12h.</BLOCKQUOTE>If you press a key, its make code is sent to the 
      computer.&nbsp; When you press and hold down a key, that key becomes 
      <I>typematic</I>, which means the keyboard will keep sending that key's 
      make code until the key is released or another key is pressed.&nbsp; To 
      verify this, open a text editor and hold down the "A" key.&nbsp; When you 
      first press the key, the character "a" immediately appears on your 
      screen.&nbsp; After a short delay, another "a" will appear followed by a 
      whole stream of "a"s until you release the "A" key.&nbsp; There are two 
      important parameters here:&nbsp; the <I>typematic delay</I>, which is the 
      short delay between the first and second "a", and the <I>typematic 
      rate</I>, which is how many characters per second will appear on your 
      screen after the typematic delay.&nbsp; The typematic delay can range from 
      0.25 seconds to 1.00 second and the typematic rate can range from 2.0 cps 
      (characters per second) to 30.0 cps.&nbsp; You may change the typematic 
      rate and delay using the "Set Typematic Rate/Delay" (0xF3) command. 
      <P>Typematic data is not buffered within the keyboard.&nbsp; In the case 
      where more than one key is held down, only the last key pressed becomes 
      typematic.&nbsp; Typematic repeat then stops when that key is released, 
      even though other keys may be held down. </P>
      <P><A name="MakeBreakTypematic FN"></A><BR><I>Footnote 1) Actually, the 
      "Pause/Break" key does not have a break code in scan code sets one and 
      two.&nbsp; When this key is pressed, its make code is sent; when it's 
      released, it doesn't send anything. &nbsp;So how do you tell when this key 
      has been released? &nbsp;You can't.</I> </P>
      <P><B>Reset:</B> </P>
      <P>At power-on or software reset (see the "Reset" command) the keyboard 
      performs a diagnostic self-test referred to as BAT (Basic Assurance Test) 
      and loads the following default values:&nbsp; </P>
      <UL>
        <LI>Typematic delay 500 ms. 
        <LI>Typematic rate 10.9 cps. 
        <LI>Scan code set 2. 
        <LI>Set all keys typematic/make/break. </LI></UL>
      <P>When entering BAT, the keyboard enables its three LED indicators, and 
      turns them off when BAT has completed.&nbsp; At this time, a BAT 
      completion code of either 0xAA (BAT successful) or 0xFC (Error) is sent to 
      the host. &nbsp; This BAT completion code must be sent 500~750 
      milliseconds after power-on. </P>
      <P>Many of the keyboards I've tested ignore their CLOCK and DATA lines 
      until <I>after</I> the BAT completion code has been sent.&nbsp; Therefore, 
      an "Inhibit" condition (CLOCK line low) may not prevent the keyboard from 
      sending its BAT completion code. </P>
      <P><B>Command Set:</B> </P>
      <P>A few notes regarding commands the host can issue to the 
      keyboard:<BR></P>
      <UL>
        <LI>The keyboard clears its output buffer when it recieves any command. 
        <LI>If the keyboard receives an invalid command or argument, it must 
        respond with "resend" (0xFE). 
        <LI>The keyboard must not send any scancodes while processing a command. 

        <LI>If the keyboard is waiting for an argument byte and it instead 
        receives a command, it should discard the previous command and process 
        this new one. </LI></UL>Below are all the commands the host may send to 
      the keyboard:<BR>
      <UL>
        <LI>0xFF (Reset) - Keyboard responds with "ack" (0xFA), then enters 
        "Reset" mode.&nbsp; (See "Reset" section.) 
        <LI>0xFE (Resend) - Keyboard responds by resending the last-sent byte. 
        &nbsp;The exception to this is if the last-sent byte was "resend" 
        (0xFE). &nbsp;If this is the case, the keyboard resends the last 
        non-0xFE byte. &nbsp;This command is used by the host to indicate an 
        error in reception. </LI></UL>
      <BLOCKQUOTE>The next six commands can be issued when the keyboard is in 
        any mode, but it only effects the behavior of the keyboard when in "mode 
        3" (ie, set to scan code set 3.) <BR></BLOCKQUOTE>
      <UL>
        <LI>*0xFD (Set Key Type Make) - Disable break codes and typematic repeat 
        for specified keys. &nbsp;Keyboard responds with "ack" (0xFA), then 
        disables scanning (if enabled) and reads a list of keys from the host. 
        &nbsp;These keys are specified by their set 3 make codes. &nbsp;Keyboard 
        responds to each make code with "ack". &nbsp;Host terminates this list 
        by sending an invalid set 3 make code (eg, a valid command.) &nbsp;The 
        keyboard then re-enables scanning (if previously disabled). 
        <LI>*0xFC (Set Key Type Make/Break) - Similar to previous command, 
        except this one only disables typematic repeat. 
        <LI>*0xFB (Set Key Type Typematic) - Similar to previous two, except 
        this one only disables break codes. 
        <LI>*0xFA (Set All Keys Typematic/Make/Break) - Keyboard responds with 
        "ack" (0xFA). &nbsp;Sets all keys to their normal setting (generate scan 
        codes on make, break, and typematic repeat) 
        <LI>*0xF9 (Set All Keys Make) - Keyboard responds with "ack" (0xFA). 
        &nbsp;Similar to 0xFD, except applies to all keys. 
        <LI>*0xF8 (Set All Keys Make/Break) - Keyboard responds with "ack" 
        (0xFA). &nbsp;Similar to 0xFC, except applies to all keys. 
        <LI>*0xF7 (Set All Keys Typematic) - Keyboard responds with "ack" 
        (0xFA). &nbsp;Similar to 0xFB, except applies to all keys. 
        <LI>0xF6 (Set Default) - Load default typematic rate/delay (10.9cps / 
        500ms), key types (all keys typematic/make/break), and scan code set 
        (2). 
        <LI>0xF5 (Disable) - Keyboard stops scanning, loads default values (see 
        "Set Default" command), and waits further instructions. 
        <LI>0xF4 (Enable) - Re-enables keyboard after disabled using previous 
        command. 
        <LI>0xF3 (Set Typematic Rate/Delay) - Host follows this command with one 
        argument byte that defines the typematic rate and delay as follows: 
        <BR>. 
        <CENTER><B>Repeat Rate</B></CENTER>
        <CENTER>
        <TABLE border=1 cellPadding=0 cellSpacing=0 width="90%">
          <TBODY>
          <TR>
            <TD>
              <CENTER>Bits 0-4</CENTER></TD>
            <TD>
              <CENTER>Rate(cps)</CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER>Bits 0-4</CENTER></TD>
            <TD>
              <CENTER>Rate(cps)</CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER>Bits 0-4</CENTER></TD>
            <TD>
              <CENTER>Rate(cps)</CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER>Bits 0-4</CENTER></TD>
            <TD>
              <CENTER>Rate(cps)</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER><TT>00h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>2.0</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>08h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>4.0</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>10h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>8.0</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>18h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>16.0</TT></CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER><TT>01h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>2.1</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>09h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>4.3</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>11h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>8.6</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>19h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>17.1</TT></CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER><TT>02h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>2.3</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>0Ah</TT></CENTER></TD>
            <TD>
              <CENTER><TT>4.6</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>12h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>9.2</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>1Ah</TT></CENTER></TD>
            <TD>
              <CENTER><TT>18.5</TT></CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER><TT>03h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>2.5</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>0Bh</TT></CENTER></TD>
            <TD>
              <CENTER><TT>5.0</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>13h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>10.0</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>1Bh</TT></CENTER></TD>
            <TD>
              <CENTER><TT>20.0</TT></CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER><TT>04h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>2.7</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>0Ch</TT></CENTER></TD>
            <TD>
              <CENTER><TT>5.5</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>14h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>10.9</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>1Ch</TT></CENTER></TD>
            <TD>
              <CENTER><TT>21.8</TT></CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER><TT>05h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>3.0</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>0Dh</TT></CENTER></TD>
            <TD>
              <CENTER><TT>6.0</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>15h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>12.0</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>1Dh</TT></CENTER></TD>
            <TD>
              <CENTER><TT>24.0</TT></CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER><TT>06h</TT></CENTER></TD>
            <TD>
              <CENTER><TT>3.3</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>0Eh</TT></CENTER></TD>
            <TD>
              <CENTER><TT>6.7</TT></CENTER></TD>
            <TD bgColor=#cccccc>&nbsp;</TD>
            <TD>
              <CENTER><TT>16h</TT></CENTER></TD>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -