📄 ps-2 mouse interfacing.htm
字号:
that value by using the "Set Sample Rate" (0xF3) command. Stream
mode is the default mode of operation. </P>
<P><B>Remote Mode:</B> </P>
<P>In this mode, the mouse reads its inputs and updates its counters/flags
at the current sampling rate, but it only notifies the host of movement
(and change in button state) when that information is requested by the
host. The host does this by issuing the "Read Data" (0xEB) command. After
receiveing this command, the mouse will send a movement data packet, and
reset its movement counters. </P>
<P><B>Wrap Mode:</B> </P>
<P>This is an "echoing" mode in which every byte received by the mouse is
sent back to the host. Even if the byte represents a valid command, the
mouse will not respond to that command--it will only echo that byte back
to the host. There are two exceptions to this: the "Reset" (0xFF) command
and "Reset Wrap Mode" (0xEC) command. The mouse treats these as valid
commands and does not echo them back to the host. </P>
<P><B>Intellimouse Extensions:</B> </P>
<P>A popular extension to the standard PS/2 mouse is the Microsoft
Intellimouse. This includes support for a total of five mouse
buttons and three axises of movement (right-left, up-down, and a scrolling
wheel). These additional features require the use of a 4-byte
movement data packet rather than the standard 3-byte packet. Since
standard PS/2 mouse drivers cannot recognize this packet format, the
Microsoft Intellimouse is required to operate exactly like a standard PS/2
mouse unless it knows the drivers support the extended packet
format. This way, if a Microsoft Intellimouse is used on a computer
which only supports the standard PS/2 mouse, the Microsoft Intellimouse
will still function, except for its scrolling wheel and 4th and 5th
buttons. </P>
<P>The Microsoft Intellimouse operates just like a standard PS/2 mouse
(ie, it uses a 3-byte movement data packet, responds to all commands in
the same way as a standard PS/2 mouse, and reports a device ID of
0x00.) To enter scrolling wheel mode, the host sends the following
command sequence: </P>
<BLOCKQUOTE>Set sample rate 200 <BR>Set sample rate 100 <BR>Set sample
rate 80</BLOCKQUOTE>The host then issues the "Get device ID" command
(0xF2) and waits for a response. If a standard PS/2 mouse (ie,
non-Intellimouse) is attached, it will respond with a device ID of
0x00. In this case, the host will recognize the fact that the mouse
does have a scrolling wheel and will continue to treat it as a standard
PS/2 mouse. However, if a Microsoft Intellimouse is attached, it
will respond with an ID of 0x03. This tells the host that the
attached pointing device has a scrolling wheel and the host will then
expect the mouse to use the following 4-byte movement data packet:
<BLOCKQUOTE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=650>
<TBODY>
<TR>
<TD><BR><FONT face=Arial,Helvetica><FONT size=-1>Byte
1 </FONT></FONT></TD>
<TD>
<TABLE border=0 cellPadding=0 cols=8 width="100%">
<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 border=1 cellPadding=0 cellSpacing=0 cols=8 width="100%">
<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 border=1 cellPadding=0 cellSpacing=0 cols=1 width="100%">
<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 border=1 cellPadding=0 cellSpacing=0 cols=1 width="100%">
<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 border=1 cellPadding=0 cellSpacing=0 cols=1 width="100%">
<TBODY>
<TR>
<TD>
<CENTER><FONT face=Arial,Helvetica><FONT size=-1>Z
Movement</FONT></FONT></CENTER></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>Z
Movement is a 2's complement number that represents the scrolling
wheel's movement since the last data report. Valid values are in
the range of -8 to +7. This means the number is actually represented
only by the least significant four bits; the upper four bits act only as
sign extension bits.</BLOCKQUOTE>To enter scrolling wheel + 5 button mode,
the host sends the following command sequence:
<BLOCKQUOTE>Set sample rate 200 <BR>Set sample rate 200 <BR>Set sample
rate 80</BLOCKQUOTE>The host then issues the "Get device ID" command
(0xF2) and waits for a response. A Microsoft Intellimouse will
respond with a device ID of 0x04, then use the following 4-byte movement
data packet:
<BLOCKQUOTE>
<BLOCKQUOTE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=650>
<TBODY>
<TR>
<TD><BR><FONT face=Arial,Helvetica><FONT size=-1>Byte
1 </FONT></FONT></TD>
<TD>
<TABLE border=0 cellPadding=0 cols=8 width="100%">
<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 border=1 cellPadding=0 cellSpacing=0 cols=8
width="100%"><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 border=1 cellPadding=0 cellSpacing=0 cols=1
width="100%"><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 border=1 cellPadding=0 cellSpacing=0 cols=1
width="100%"><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 border=1 cellPadding=0 cellSpacing=0 cols=8
width="100%"><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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -