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

📄 the ps-2 keyboard interface.htm

📁 PS2 KeyBoard very good info
💻 HTM
📖 第 1 页 / 共 4 页
字号:
  <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 cellSpacing=0 cellPadding=0 width="90%" border=1>
    <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>30.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>08h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>15.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>10h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>7.5</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>18h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>3.7</TT></CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER><TT>01h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>26.7</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>09h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>13.3</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>11h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>6.7</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>19h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>3.3</TT></CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER><TT>02h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>24.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>0Ah</TT></CENTER></TD>
      <TD>
        <CENTER><TT>12.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>12h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>6.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>1Ah</TT></CENTER></TD>
      <TD>
        <CENTER><TT>3.0</TT></CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER><TT>03h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>21.8</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>0Bh</TT></CENTER></TD>
      <TD>
        <CENTER><TT>10.9</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>13h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>5.5</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>1Bh</TT></CENTER></TD>
      <TD>
        <CENTER><TT>2.7</TT></CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER><TT>04h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>20.7</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>0Ch</TT></CENTER></TD>
      <TD>
        <CENTER><TT>10.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>14h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>5.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>1Ch</TT></CENTER></TD>
      <TD align=middle><FONT 
        face="Courier New, Courier, monospace"><SMALL>2.5</SMALL></FONT><BR></TD></TR>
    <TR>
      <TD>
        <CENTER><TT>05h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>18.5</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>0Dh</TT></CENTER></TD>
      <TD>
        <CENTER><TT>9.2</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>15h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>4.6</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>1Dh</TT></CENTER></TD>
      <TD>
        <CENTER><TT>2.3</TT></CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER><TT>06h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>17.1</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>0Eh</TT></CENTER></TD>
      <TD>
        <CENTER><TT>8.6</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>16h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>4.3</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>1Eh</TT></CENTER></TD>
      <TD>
        <CENTER><TT>2.1</TT></CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER><TT>07h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>16.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>0Fh</TT></CENTER></TD>
      <TD>
        <CENTER><TT>8.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>17h</TT></CENTER></TD>
      <TD>
        <CENTER><TT>4.0</TT></CENTER></TD>
      <TD bgColor=#cccccc>&nbsp;</TD>
      <TD>
        <CENTER><TT>1Fh</TT></CENTER></TD>
      <TD align=middle><SMALL><FONT 
        face="Courier New, Courier, monospace">2.0</FONT></SMALL><BR></TD></TR></TBODY></TABLE>
  <DIV align=center></DIV></CENTER>
  <CENTER>
  <P><B>Delay</B></P></CENTER>
  <CENTER>
  <TABLE cellSpacing=0 cols=2 cellPadding=0 width=217 border=1>
    <TBODY>
    <TR>
      <TD>
        <CENTER>Bits 5-6</CENTER></TD>
      <TD>
        <CENTER>Delay (seconds)</CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER>00b</CENTER></TD>
      <TD>
        <CENTER>0.25</CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER>01b</CENTER></TD>
      <TD>
        <CENTER>0.50</CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER>10b</CENTER></TD>
      <TD>
        <CENTER>0.75</CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER>11b</CENTER></TD>
      <TD>
        <CENTER>1.00</CENTER></TD></TR></TBODY></TABLE></CENTER><BR>&nbsp; 
  <LI>*0xF2 (Read ID) - The keyboard responds by sending a two-byte device ID of 
  0xAB, 0x83. (0xAB is sent first, followed by 0x83.) 
  <LI>*0xF0 (Set Scan Code Set) -&nbsp; Keyboard responds with "ack", then reads 
  argument byte from the host. &nbsp;This argument byte may be 0x01, 0x02, or 
  0x03 to select scan code set 1, 2, or 3, respectively.&nbsp; The keyboard 
  responds to this argument byte with "ack". &nbsp;If the argument byte is 0x00, 
  the keyboard responds with "ack" followed by the current scan code set. 
  <LI>0xEE (Echo) - The keyboard responds with "Echo" (0xEE). 
  <LI>0xED (Set/Reset LEDs) - The host follows this command with one argument 
  byte, that specifies the state of the keyboard's Num Lock, Caps Lock, and 
  Scroll Lock LEDs.&nbsp; This argument byte is defined as follows: </LI></UL>
<CENTER>
<TABLE cellSpacing=0 cols=8 cellPadding=3 width=400 border=0>
  <TBODY>
  <TR vAlign=center align=middle>
    <TD>MSb</TD>
    <TD><BR></TD>
    <TD><BR></TD>
    <TD><BR></TD>
    <TD><BR></TD>
    <TD><BR></TD>
    <TD><BR></TD>
    <TD>LSb</TD></TR></TBODY></TABLE></CENTER>
<CENTER>
<TABLE cellSpacing=0 cols=8 cellPadding=2 width=400 border=1>
  <TBODY>
  <TR vAlign=center align=middle>
    <TD>Always 0</TD>
    <TD>Always 0</TD>
    <TD>Always 0</TD>
    <TD>Always 0</TD>
    <TD>Always 0</TD>
    <TD>Caps Lock</TD>
    <TD>Num Lock</TD>
    <TD>Scroll Lock</TD></TR></TBODY></TABLE></CENTER>
<BLOCKQUOTE>
  <BLOCKQUOTE>
    <BLOCKQUOTE>
      <UL>
        <UL>
          <LI>"Scroll Lock" - Scroll Lock LED off(0)/on(1) 
          <LI>"Num Lock" - Num Lock LED off(0)/on(1) 
          <LI>"Caps Lock" - Caps Lock LED off(0)/on(1) 
  </LI></UL></UL></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>*Originally available in 
PS/2 keyboards only. 
<P><B>Emulation:</B> </P>
<UL>Click here for keyboard/mouse routines.&nbsp; Source in MPASM for PIC 
  microcontrollers. </UL><B>The i8042 Keyboard Controller:</B> 
<P>Up to this point in the article, all information has been presented from a 
hardware point-of-view.&nbsp; However, if you're writing low-level 
keyboard-related software for the host PC, you won't be communicating directly 
with the keyboard.&nbsp; Instead, a keyboard controller provides an interface 
between the keyboard and the peripheral bus.&nbsp; This controller takes care of 
all the signal-level and protocol details, as well as providing some conversion, 
interpretation, and handling of scan codes and commands.&nbsp; </P>
<P>An Intel 8042/compatible microcontroller is used as the PC's keyboard 
controller.&nbsp; In modern computers, this microcontroller is hidden within the 
motherboard's chipset, which integrates many controllers in a single 
package.&nbsp; Nonetheless, this device is still there, and the keyboard 
controller is still commonly referred to as "the 8042". </P>
<P>Depending on the motherboard, the keyboard controller may operate in one of 
two modes: "AT-compatible" mode, or "PS/2-compatible" mode.&nbsp; The latter is 
used if a PS/2 mouse is supported by the motherboard.&nbsp; If this is the case, 
the 8042 acts as the keyboard controller and the mouse controller.&nbsp; The 
keyboard controller auto-detects which mode it is to use according to how it's 
wired to the keyboard port. </P>
<P>The 8042 contains the following registers: </P>
<UL>
  <LI>A one-byte input buffer - contains byte read from keyboard; read-only 
  <LI>A one-byte output buffer - contains byte to-be-written to keyboard; 
  write-only 
  <LI>A one-byte status register - 8 status flags; read-only 
  <LI>A one-byte control register - 7 control flags; read/write&nbsp; 
</LI></UL>The first three registers (input, output, status) are directly 
accessible via ports 0x60 and 0x64.&nbsp; The last register (control) is read 
using the "Read Command Byte" command, and written using the "Write Command 
Byte" command.&nbsp; The following table shows how the peripheral ports are used 
to interface the 8042: <BR>&nbsp; 
<CENTER>
<TABLE cellSpacing=0 cellPadding=3 border=1>
  <TBODY>
  <TR>
    <TD>
      <CENTER>Port</CENTER></TD>
    <TD>
      <CENTER>Read /&nbsp; <BR>Write</CENTER></TD>
    <TD>
      <CENTER>Function</CENTER></TD></TR>
  <TR>
    <TD>0x60</TD>
    <TD>Read</TD>
    <TD>Read Input Buffer</TD></TR>

⌨️ 快捷键说明

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