📄 at keyboard interfacing.htm
字号:
<TABLE border=1 cellPadding=2 cellSpacing=0>
<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>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 border=0 cellPadding=5 cellSpacing=0>
<TBODY>
<TR>
<TD>Port 1 (Input Port):
<CENTER>
<TABLE border=1 cellPadding=2 cellSpacing=0>
<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 border=1 cellPadding=2 cellSpacing=0>
<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 border=1 cellPadding=2 cellSpacing=0>
<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.
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. 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. They contain
error information, status information, and indicate whether or not data is
present in the input and output buffers. The flags are defined as
follows: <BR> </P>
<CENTER>
<TABLE border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD><BR></TD>
<TD>
<CENTER>
<TABLE border=0 cellPadding=3 cellSpacing=0 cols=8 width=400>
<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 border=1 cellPadding=2 cellSpacing=0 cols=8 width=400>
<TBODY>
<TR>
<TD>
<CENTER>PERR</CENTER></TD>
<TD>
<CENTER>RxTO</CENTER></TD>
<TD>
<CENTER>TxTO</CENTER></TD>
<TD>
<CENTER>INH</CENTER></TD>
<TD>
<CENTER>A2</CENTER></TD>
<TD>
<CENTER>SYS</CENTER></TD>
<TD>
<CENTER>IBF</CENTER></TD>
<TD>
<CENTER>OBF</CENTER></TD></TR></TBODY></TABLE></CENTER></TD></TR>
<TR>
<TD>PS/2-compatible mode: </TD>
<TD>
<CENTER>
<TABLE border=1 cellPadding=2 cellSpacing=0 cols=8 width=400>
<TBODY>
<TR>
<TD>
<CENTER>PERR</CENTER></TD>
<TD>
<CENTER>TO</CENTER></TD>
<TD>
<CENTER>MOBF</CENTER></TD>
<TD>
<CENTER>INH</CENTER></TD>
<TD>
<CENTER>A2</CENTER></TD>
<TD>
<CENTER>SYS</CENTER></TD>
<TD>
<CENTER>IBF</CENTER></TD>
<TD>
<CENTER>OBF</CENTER></TD></TR></TBODY></TABLE></CENTER></TD></TR></TBODY></TABLE></CENTER>
<UL>
<LI>OBF (Output Buffer Full) - Indicates when it's okay to write to
output buffer. <BR>0: Output buffer empty - Okay to write to port 0x60
<BR>1: Output buffer full - Don't write to port 0x60
<LI>IBF (Input Buffer Full) - Indicates when input is available in the
input buffer. <BR>0: Input buffer empty - No unread input at port 0x60
<BR>1: Input buffer full - New input can be read from port 0x60
<LI>SYS (System flag) - Post reads this to determine if power-on reset,
or software reset. <BR>0: Power-up value - System is in power-on reset.
<BR>1: BAT code received - System has already beed initialized.
<LI>A2 (Address line A2) - Used internally by the keyboard controller
<BR>0: A2 = 0 - Port 0x60 was last written to <BR>1: A2 = 1 - Port 0x64
was last written to
<LI>INH (Inhibit flag) - Indicates whether or not keyboard communication
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -