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

📄 the ps-2 keyboard interface.htm

📁 PS/2接口的键盘与鼠标接口规范
💻 HTM
📖 第 1 页 / 共 4 页
字号:
  <TR>
    <TD>0x60</TD>
    <TD>Write</TD>
    <TD>Write Output Buffer</TD></TR>
  <TR>
    <TD>0x64</TD>
    <TD>Read</TD>
    <TD>Read Status Register</TD></TR>
  <TR>
    <TD>0x64</TD>
    <TD>Write</TD>
    <TD>Send Command</TD></TR></TBODY></TABLE></CENTER>
<P>Writing to port 0x64 doesn't write to any specific register, but sends a 
command for the 8042 to interpret.&nbsp; If the command accepts a parameter, 
this parameter is sent to port 0x60.&nbsp; Likewise, any results returned by the 
command may be read from port 0x60. </P>
<P>When describing the 8042, I may occasionally refer to its physical I/O 
pins.&nbsp; These pins are defined below: </P>
<P><U>AT-compatible mode</U> </P>
<CENTER>
<TABLE cellSpacing=0 cellPadding=5 border=0>
  <TBODY>
  <TR>
    <TD>Port 1 (Input Port): 
      <CENTER>
      <TABLE cellSpacing=0 cellPadding=2 border=1>
        <TBODY>
        <TR>
          <TD>Pin</TD>
          <TD>Name</TD>
          <TD>Function</TD></TR>
        <TR>
          <TD>0</TD>
          <TD>P10</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>1</TD>
          <TD>P11</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>2</TD>
          <TD>P12</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>3</TD>
          <TD>P13</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>4</TD>
          <TD>P14</TD>
          <TD>External RAM <BR>1: Enable external RAM <BR>0: Disable external 
            RAM</TD></TR>
        <TR>
          <TD>5</TD>
          <TD>P15</TD>
          <TD>Manufacturing Setting <BR>1: Setting enabled <BR>0: Setting 
            disabled</TD></TR>
        <TR>
          <TD>6</TD>
          <TD>P16</TD>
          <TD>Display Type Switch <BR>1: Color display <BR>0: Monochrome</TD></TR>
        <TR>
          <TD>7</TD>
          <TD>P17</TD>
          <TD>Keyboard Inhibit Switch <BR>1: Keyboard enabled <BR>0: Keyboard 
            inhibited</TD></TR></TBODY></TABLE></CENTER></TD>
    <TD>Port 2 (Output Port): 
      <TABLE cellSpacing=0 cellPadding=2 border=1>
        <TBODY>
        <TR>
          <TD>Pin</TD>
          <TD>Name</TD>
          <TD>Function</TD></TR>
        <TR>
          <TD>0</TD>
          <TD>P20</TD>
          <TD>System Reset <BR>1: Normal <BR>0: Reset computer</TD></TR>
        <TR>
          <TD>1</TD>
          <TD>P21</TD>
          <TD><BR>Gate A20 <BR>.</TD></TR>
        <TR>
          <TD>2</TD>
          <TD>P22</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>3</TD>
          <TD>P23</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>4</TD>
          <TD>P24</TD>
          <TD><BR>Input Buffer Full <BR>.</TD></TR>
        <TR>
          <TD>5</TD>
          <TD>P25</TD>
          <TD><BR>Output Buffer Empty <BR>.</TD></TR>
        <TR>
          <TD>6</TD>
          <TD>P26</TD>
          <TD>Keyboard Clock <BR>1: Pull Clock low <BR>0: High-Z</TD></TR>
        <TR>
          <TD>7</TD>
          <TD>P27</TD>
          <TD>Keyboard Data: <BR>1: Pull Data low <BR>0: 
      High-Z</TD></TR></TBODY></TABLE></TD>
    <TD>Port 3 (Test Port): 
      <CENTER>
      <TABLE cellSpacing=0 cellPadding=2 border=1>
        <TBODY>
        <TR>
          <TD>Pin</TD>
          <TD>Name</TD>
          <TD>Function</TD></TR>
        <TR>
          <TD>0</TD>
          <TD>T0</TD>
          <TD>Keyboard Clock&nbsp; <BR>(Input) <BR>.</TD></TR>
        <TR>
          <TD>1</TD>
          <TD>T1</TD>
          <TD>Keyboard Data <BR>(Input) <BR>.</TD></TR>
        <TR>
          <TD>2</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>3</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>4</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>5</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>6</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>7</TD>
          <TD>--</TD>
          <TD><BR>Undefined 
<BR>.</TD></TR></TBODY></TABLE></CENTER></TD></TR></TBODY></TABLE></CENTER>
<P><U>PS/2-compatible mode</U> </P>
<CENTER>
<TABLE cellSpacing=0 cellPadding=5 border=0>
  <TBODY>
  <TR>
    <TD>Port 1 (Input Port): 
      <CENTER>
      <TABLE cellSpacing=0 cellPadding=2 border=1>
        <TBODY>
        <TR>
          <TD>Pin</TD>
          <TD>Name</TD>
          <TD>Function</TD></TR>
        <TR>
          <TD>0</TD>
          <TD>P10</TD>
          <TD>Keyboard Data <BR>(Input) <BR>.</TD></TR>
        <TR>
          <TD>1</TD>
          <TD>P11</TD>
          <TD>Mouse Data <BR>(Input) <BR>.</TD></TR>
        <TR>
          <TD>2</TD>
          <TD>P12</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>3</TD>
          <TD>P13</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>4</TD>
          <TD>P14</TD>
          <TD>External RAM <BR>1: Enable external RAM <BR>0: Disable external 
            RAM</TD></TR>
        <TR>
          <TD>5</TD>
          <TD>P15</TD>
          <TD>Manufacturing Setting <BR>1: Setting enabled <BR>0: Setting 
            disabled</TD></TR>
        <TR>
          <TD>6</TD>
          <TD>P16</TD>
          <TD>Display Type Switch <BR>1: Color display <BR>0: Monochrome</TD></TR>
        <TR>
          <TD>7</TD>
          <TD>P17</TD>
          <TD>Keyboard Inhibit Switch <BR>1: Keyboard enabled <BR>0: Keyboard 
            disabled</TD></TR></TBODY></TABLE></CENTER></TD>
    <TD>Port 2 (Output Port): 
      <CENTER>
      <TABLE cellSpacing=0 cellPadding=2 border=1>
        <TBODY>
        <TR>
          <TD>Pin</TD>
          <TD>Name</TD>
          <TD>Function</TD></TR>
        <TR>
          <TD>0</TD>
          <TD>P20</TD>
          <TD>System Reset <BR>1: Normal <BR>0: Reset computer</TD></TR>
        <TR>
          <TD>1</TD>
          <TD>P21</TD>
          <TD><BR>Gate A20 <BR>.</TD></TR>
        <TR>
          <TD>2</TD>
          <TD>P22</TD>
          <TD>Mouse Data: <BR>1: Pull Data low <BR>0: High-Z</TD></TR>
        <TR>
          <TD>3</TD>
          <TD>P23</TD>
          <TD>Mouse Clock: <BR>1: Pull Clock low <BR>0: High-Z</TD></TR>
        <TR>
          <TD>4</TD>
          <TD>P24</TD>
          <TD>Keyboard IBF interrupt: <BR>1: Assert IRQ 1 <BR>0: De-assert IRQ 
            1</TD></TR>
        <TR>
          <TD>5</TD>
          <TD>P25</TD>
          <TD>Mouse IBF interrupt: <BR>1: Assert IRQ 12 <BR>0: De-assert IRQ 
          12</TD></TR>
        <TR>
          <TD>6</TD>
          <TD>P26</TD>
          <TD>Keyboard Clock: <BR>1: Pull Clock low <BR>0: High-Z</TD></TR>
        <TR>
          <TD>7</TD>
          <TD>P27</TD>
          <TD>Keyboard Data: <BR>1: Pull Data low <BR>0: 
      High-Z</TD></TR></TBODY></TABLE></CENTER></TD>
    <TD>Port 3 (Test Port): 
      <CENTER>
      <TABLE cellSpacing=0 cellPadding=2 border=1>
        <TBODY>
        <TR>
          <TD>Pin</TD>
          <TD>Name</TD>
          <TD>Function</TD></TR>
        <TR>
          <TD>0</TD>
          <TD>T0</TD>
          <TD>Keyboard Clock <BR>(Input) <BR>.</TD></TR>
        <TR>
          <TD>1</TD>
          <TD>T1</TD>
          <TD>Mouse Clock <BR>(Input) <BR>.</TD></TR>
        <TR>
          <TD>2</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>3</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>4</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>5</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>6</TD>
          <TD>--</TD>
          <TD><BR>Undefined <BR>.</TD></TR>
        <TR>
          <TD>7</TD>
          <TD>--</TD>
          <TD><BR>Undefined 
<BR>.</TD></TR></TBODY></TABLE></CENTER></TD></TR></TBODY></TABLE></CENTER>
<P>(Note: Reading keyboard controller datasheets can be confusing--it will refer 
to the "input buffer" as the "output buffer" and vice versa.&nbsp; This makes 
sense from the point-of-view of someone writing firmware for the controller, but 
for somebody used to interfacing the controller, this can cause problems.&nbsp; 
Throughout this document, I only refer to the "input buffer" as the one 
containing input from the keyboard, and the "output buffer" as the one that 
contains output to be sent to the keyboard.) </P>
<P><I>Status Register:</I> </P>
<P>The 8042's status flags are read from port 0x64.&nbsp; They contain error 
information, status information, and indicate whether or not data is present in 
the input and output buffers.&nbsp; The flags are defined as follows: <BR>&nbsp; 
</P>
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 border=0>
  <TBODY>
  <TR>
    <TD><BR></TD>
    <TD>
      <CENTER>
      <TABLE cellSpacing=0 cols=8 cellPadding=3 width=400 border=0>
        <TBODY>
        <TR>
          <TD>MSb</TD>
          <TD><BR></TD>
          <TD><BR></TD>
          <TD><BR></TD>
          <TD><BR></TD>
          <TD><BR></TD>
          <TD><BR></TD>
          <TD>
            <DIV align=right>LSb</DIV></TD></TR></TBODY></TABLE></CENTER></TD></TR>
  <TR>
    <TD>AT-compatible mode:</TD>
    <TD>
      <CENTER>
      <TABLE cellSpacing=0 cols=8 cellPadding=2 width=400 border=1>
        <TBODY>
        <TR>
          <TD>
            <CENTER>PERR</CENTER></TD>
          <TD>
            <CENTER>RxTO</CENTER></TD>
          <TD>
            <CENTER>TxTO</CENTER></TD>
          <TD>

⌨️ 快捷键说明

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