📄 ps-2 mouse interfacing.htm
字号:
<TD>
<CENTER>Bit 2</CENTER></TD>
<TD>
<CENTER>Bit 1</CENTER></TD>
<TD>
<CENTER>Bit 0</CENTER></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cols=8 cellPadding=0 width="100%" border=1>
<TBODY>
<TR>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Y
overflow</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>X
overflow</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Y sign
bit</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>X sign
bit</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Always
1</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Middle
Btn</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Right
Btn</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Left
Btn</FONT></FONT></CENTER></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD><FONT face=Arial,Helvetica><FONT size=-1>Byte 2</FONT></FONT></TD>
<TD>
<TABLE cellSpacing=0 cols=1 cellPadding=0 width="100%" border=1>
<TBODY>
<TR>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>X
Movement</FONT></FONT></CENTER></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD><FONT face=Arial,Helvetica><FONT size=-1>Byte
3 </FONT></FONT></TD>
<TD>
<TABLE cellSpacing=0 cols=1 cellPadding=0 width="100%" border=1>
<TBODY>
<TR>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Y
Movement</FONT></FONT></CENTER></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD><FONT face=Arial,Helvetica><FONT size=-1>Byte 4</FONT></FONT></TD>
<TD>
<TABLE cellSpacing=0 cols=8 cellPadding=0 width="100%" border=1>
<TBODY>
<TR>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Always
0</FONT></FONT></CENTER></TD>
<TD>
<CENTER>Always 0</CENTER></TD>
<TD>
<CENTER>5th Btn</CENTER></TD>
<TD>
<CENTER>4th Btn</CENTER></TD>
<TD>
<CENTER>Z3</CENTER></TD>
<TD>
<CENTER>Z2</CENTER></TD>
<TD>
<CENTER>Z1</CENTER></TD>
<TD>
<CENTER>Z0</CENTER></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>Z0-Z3
is a 2's complement number which represents the amount of movement that has
occurred since the last data report. Valid values range from -8 to +7.
<BR>4th Btn: 1 = 4th mouse button is pressed; 0 = 4th mouse button is not
pressed. <BR>5th Btn: 1 = 5th mouse button is pressed; 0 = 5th mouse button
is not pressed.</BLOCKQUOTE></BLOCKQUOTE>You may have seen mice with two
scrolling wheels--one vertical and the other horizontal. These mice use
the Microsoft Intellimouse data packet format as described above. If the
vertical wheel is scrolled upward, the Z-counter is incremented by one and if
that wheel is scrolled down, the Z-counter is decremented by one. This is
normal operation for a scrolling wheel. However, if the <I>horizontal</I>
wheel is scrolled right, the Z-counter is incremented by <I>two</I> and if it is
scrolled left, the Z-counter is decremented by <I>two</I>. This seems like
an odd way to implement the second scrolling wheel, but it works since the
placement of the two wheels make it impossible to use both of them at the same
time (and if you try to trick the software and use both at the same time, it
will ignore the horizontal wheel.)
<P><B>Command Set:</B> </P>
<P>The following is the set of command accepted by the standard PS/2 mouse.
If the mouse is in Stream mode, the host should disable data reporting
(command F5h) before sending any other commands. </P>
<UL>
<LI>FFh (Reset) - The mouse responds to this command with "acknowledge" (FAh)
then enters Reset Mode.
<LI>FEh (Resend) - The host sends this command whenever it receives invalid
data from the mouse. The mouse responds by resending the last<A
href="http://www.computer-engineering.org/ps2mouse/#Footnotes">(2)</A>
packet<A
href="http://www.computer-engineering.org/ps2mouse/#Footnotes">(3)</A> it sent
to the host. If the mouse responds to the "Resend" command with
another invalid packet, the host may either issue another "Resend" command,
issue an "Error" command, cycle the mouse's power supply to reset the mouse,
or it may inhibit communication (by bringing the Clock line low). The
action taken depends on the host.
<LI>F6h (Set Defaults) - The mouse responds with "acknowledge" (FAh) then
loads the following values: Sampling rate = 100, Resolution = 4
counts/mm, Scaling = 1:1, Disable Data Reporting. The mouse then resets
its movement counters and enters stream mode.
<LI>F5h (Disable Data Reporting) - The mouse responds with "acknowledge" (FAh)
then disables data reporting and resets its movement counters. This only
effects data reporting in Stream mode and does not disable sampling.
Disabled stream mode funcions the same as remote mode.
<LI>F4h (Enable Data Reporting) - The mouse responds with "acknowledge" (FAh)
then enables data reporting and resets its movement counters. This
command may be issued while the mouse is in Remote Mode (or Stream mode), but
it will only effect data reporting in Stream mode.
<LI>F3h (Set Sample Rate) - The mouse responds with "acknowledge" (FAh) then
reads one more byte from the host. The mouse saves this byte as the new
sample rate. After receiving the sample rate, the mouse again responds with
"acknowledge" (0xFA) and resets its movement counters. Valid sample
rates are 10, 20, 40, 60, 80, 100, and 200 samples/sec.
<LI>F2h (Get Device ID) - The mouse responds with "acknowledge" (FAh) followed
by its device ID (00h for the standard PS/2 mouse.) The mouse should
also reset its movement counters.
<LI>F0h (Set Remote Mode) - The mouse responds with "acknowledge" (FAh) then
resets its movement counters and enters remote mode.
<LI>EEh (Set Wrap Mode) - The mouse responds with "acknowledge" (FAh) then
resets its movement counters and enters wrap mode.
<LI>ECh (Reset Wrap Mode) - The mouse responds with "acknowledge" (FAh) then
resets its movement counters and enters the mode it was in prior to wrap mode
(Stream Mode or Remote Mode.)
<LI>EBh (Read Data) - The mouse responds with acknowledge (FAh) then sends a
movement data packet. This is the only way to read data in Remote Mode.
After the data packets has been successfully sent, it resets its movement
counters.
<LI>EAh (Set Stream Mode) - The mouse responds with "acknowledge" then resets
its movement counters and enters steram mode.
<LI>E9h (Status Request) - The mouse responds with "acknowledge" then sends
the following 3-byte status packet (then resets its movement counters.):
<UL>
<LI>
<TABLE cellSpacing=0 cellPadding=0 width=650 border=0>
<TBODY>
<TR>
<TD><BR><FONT face=Arial,Helvetica><FONT size=-1>Byte
1 </FONT></FONT></TD>
<TD>
<TABLE cols=8 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD>
<CENTER>Bit 7</CENTER></TD>
<TD>
<CENTER>Bit 6</CENTER></TD>
<TD>
<CENTER>Bit 5</CENTER></TD>
<TD>
<CENTER>Bit 4</CENTER></TD>
<TD>
<CENTER>Bit 3</CENTER></TD>
<TD>
<CENTER>Bit 2</CENTER></TD>
<TD>
<CENTER>Bit 1</CENTER></TD>
<TD>
<CENTER>Bit 0</CENTER></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cols=8 cellPadding=0 width="100%" border=1>
<TBODY>
<TR>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Always
0</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT
size=-1>Mode</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT
size=-1>Enable</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT
size=-1>Scaling</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Always
0</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Left
Btn</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Middle
Btn</FONT></FONT></CENTER></TD>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Right
Btn</FONT></FONT></CENTER></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD><FONT face=Arial,Helvetica><FONT size=-1>Byte 2</FONT></FONT></TD>
<TD>
<TABLE cellSpacing=0 cols=1 cellPadding=0 width="100%" border=1>
<TBODY>
<TR>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT
size=-1>Resolution</FONT></FONT></CENTER></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD><FONT face=Arial,Helvetica><FONT size=-1>Byte
3 </FONT></FONT></TD>
<TD>
<TABLE cellSpacing=0 cols=1 cellPadding=0 width="100%" border=1>
<TBODY>
<TR>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Sample
Rate</FONT></FONT></CENTER></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<P><I>Right, Middle, Left Btn</I> = 1 if button pressed; 0 if button is not
pressed. <BR><I>Scaling</I> = 1 if scaling is 2:1; 0 if scaling is 1:1. (See
commands E7h and E6h) <BR><I>Enable</I> = 1 if data reporting is enabled; 0
if data reporting is disabled. (See commands F5h and F4h) <BR><I>Mode</I> =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -