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

📄 ps-2 mouse interfacing.htm

📁 PS2 mouse very good info
💻 HTM
📖 第 1 页 / 共 4 页
字号:
    1 if Remote Mode is enabled; 0 if Stream mode is enabled. (See commands F0h 
    and EAh) <BR>&nbsp;</P></LI></UL>
  <LI>E8h (Set Resolution) - The mouse responds with acknowledge (FAh) then 
  reads one byte from the host and again responds with acknowledge (FAh) then 
  resets its movement counters.&nbsp; The byte read from the host determines the 
  resolution as follows:&nbsp; <BR>&nbsp; 
  <CENTER>
  <TABLE width=300 border=1>
    <TBODY>
    <TR>
      <TD>
        <CENTER>Byte Read from Host</CENTER></TD>
      <TD>
        <CENTER>Resolution</CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER>0x00</CENTER></TD>
      <TD>
        <CENTER>1 count/mm</CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER>0x01</CENTER></TD>
      <TD>
        <CENTER>2 count/mm</CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER>0x02</CENTER></TD>
      <TD>
        <CENTER>4 count/mm</CENTER></TD></TR>
    <TR>
      <TD>
        <CENTER>0x03</CENTER></TD>
      <TD>
        <CENTER>8 count/mm</CENTER></TD></TR></TBODY></TABLE></CENTER></LI></UL>
<UL>
  <LI>E7h (Set Scaling 2:1) - The mouse responds with acknowledge (FAh) then 
  enables 2:1 scaling (discussed earlier in this document.) 
  <LI>E6h (Set Scaling 1:1) - The mouse responds with acknowledge (FAh) then 
  enables 1:1 scaling (discussed earlier in this document.) </LI></UL>The only 
commands the standard PS/2 mouse will send to the host are the "Resend" (FEh) 
and "Error" (FCh). &nbsp;They both work the same as they do as host-to-device 
commands.&nbsp; 
<P><B>Initialization:</B> </P>
<P>The PS/2 mouse is normally detected/initialized only when the computer is 
booting up.&nbsp; That is, the mouse is not hot-pluggable and you must restart 
your computer whenever you add/remove a PS/2 mouse (furthermore, some 
motherboards may be damaged if you add/remove a PS/2 mouse while the computer is 
running.) </P>
<P>The initial detection of the PS/2 mouse occurrs during POST.&nbsp; If a mouse 
is detected, the BIOS will allow the operating system to configure/enable the 
mouse.&nbsp; Otherwise, it will inhibit communication on the mouse's bus.&nbsp; 
If you boot the computer with a mouse attached, then detach/reattach the mouse 
while in Windows, the OS <I>may</I> be able to detect the mouse was 
reattached.&nbsp; Microsoft tried to support this, but it only works about 50% 
of the time. </P>
<P>The following is the communication between my computer (running Win98SE) and 
mouse when it boots up with a standard PS/2 mouse attached.&nbsp; It is fairly 
typical of how a PS/2 mouse is initialized and if you want to emulate a PS/2 
mouse it must (at minimum) be able to support the following sequence of 
commands...&nbsp; </P>
<UL>
  <LI><TT>Power-on Reset:</TT> <BR><TT>Mouse: AA&nbsp; Self-test 
  passed</TT><BR><TT>Mouse: 00&nbsp; Mouse ID</TT><BR><TT>Host:&nbsp; FF&nbsp; 
  Reset command</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Mouse: 
  AA&nbsp; Self-test passed</TT><BR><TT>Mouse: 00&nbsp; Mouse 
  ID</TT><BR><TT>Host:&nbsp; FF&nbsp; Reset command</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge</TT><BR><TT>Mouse: AA&nbsp; Self-test passed</TT><BR><TT>Mouse: 
  00&nbsp; Mouse ID</TT><BR><TT>Host:&nbsp; FF&nbsp; Reset 
  command</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Mouse: AA&nbsp; 
  Self-test passed</TT><BR><TT>Mouse: 00&nbsp; Mouse ID</TT><BR><TT>Host:&nbsp; 
  F3&nbsp; Set Sample Rate&nbsp;&nbsp; : Attempt to Enter 
  Microsoft</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Scrolling Mouse 
  mode</TT><BR><TT>Host:&nbsp; C8&nbsp; decimal 
  200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Host:&nbsp; 
  F3&nbsp; Set Sample Rate&nbsp;&nbsp; :</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Host:&nbsp; 
  64&nbsp; decimal 100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Mouse: 
  FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  :</TT><BR><TT>Host:&nbsp; F3&nbsp; Set Sample Rate&nbsp;&nbsp; 
  :</TT><BR><TT>Mouse: FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  :</TT><BR><TT>Host:&nbsp; 50&nbsp; decimal 
  80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Host:&nbsp; 
  F2&nbsp; Read Device Type&nbsp; :</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Mouse: 00&nbsp; 
  Mouse ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Response 03 
  if microsoft scrolling mouse</TT><BR><TT>Host:&nbsp; F3&nbsp; Set Sample 
  Rate&nbsp;</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Host:&nbsp; 
  0A&nbsp; decimal 10</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge</TT><BR><TT>Host:&nbsp; F2&nbsp; Read Device 
  Type</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Mouse: 00&nbsp; Mouse 
  ID</TT><BR><TT>Host:&nbsp; E8&nbsp; Set resolution</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge</TT><BR><TT>Host:&nbsp; 03&nbsp; 8 Counts/mm</TT><BR><TT>Mouse: 
  FA&nbsp; Acknowledge</TT><BR><TT>Host:&nbsp; E6&nbsp; Set Scaling 
  1:1</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Host:&nbsp; F3&nbsp; 
  Set Sample Rate</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge</TT><BR><TT>Host:&nbsp; 28&nbsp; decimal 40</TT><BR><TT>Mouse: 
  FA&nbsp; Acknowledge</TT><BR><TT>Host:&nbsp; F4&nbsp; 
  Enable</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Initialization 
  complete...</TT> 
  <P><TT>If I then press the Left Button...</TT> <BR><TT>Mouse: 09 1 1 00001001; 
  bit0 = Left button state; bit3 = always 1</TT> <BR><TT>Mouse: 00 1 1 No 
  X-movement</TT> <BR><TT>Mouse: 00 1 1 No Y-movement</TT> <BR><TT>... and 
  release the Left Button:</TT> <BR><TT>Mouse: 08 0 1 00001000 bit0 = Left 
  button state; bit3 = always 1</TT> <BR><TT>Mouse: 00 1 1 No X-movement</TT> 
  <BR><TT>Mouse: 00 1 1 No Y-movement</TT></P></LI></UL>The following is the 
communication between my computer (running Win98SE) and mouse when it boots up 
with an (emulated) Intellimouse...&nbsp; 
<UL>
  <LI><TT>Power-on Reset:</TT> <BR><TT>Mouse: AA&nbsp; Self-test 
  passed</TT><BR><TT>Mouse: 00&nbsp; Mouse ID</TT><BR><TT>Host:&nbsp; FF&nbsp; 
  Reset command</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Mouse: 
  AA&nbsp; Self-test passed</TT><BR><TT>Mouse: 00&nbsp; Mouse 
  ID</TT><BR><TT>Host:&nbsp; FF&nbsp; Reset command</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge</TT><BR><TT>Mouse: AA&nbsp; Self-test passed</TT><BR><TT>Mouse: 
  00&nbsp; Mouse ID</TT><BR><TT>Host:&nbsp; FF&nbsp; Reset 
  command</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Mouse: AA&nbsp; 
  Self-test passed</TT><BR><TT>Mouse: 00&nbsp; Mouse ID</TT><BR><TT>Host:&nbsp; 
  F3&nbsp; Set Sample Rate&nbsp;&nbsp; : Attempt to Enter 
  Microsoft&nbsp;</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Scrolling Mouse 
  mode</TT><BR><TT>Host:&nbsp; C8&nbsp; decimal 
  200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Host:&nbsp; 
  F3&nbsp; Set Sample Rate&nbsp;&nbsp; :</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Host:&nbsp; 
  64&nbsp; decimal 100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Mouse: 
  FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  :</TT><BR><TT>Host:&nbsp; F3&nbsp; Set Sample Rate&nbsp;&nbsp; 
  :</TT><BR><TT>Mouse: FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  :</TT><BR><TT>Host:&nbsp; 50&nbsp; decimal 
  80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Host:&nbsp; 
  F2&nbsp; Read Device Type&nbsp; :</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT><BR><TT>Mouse: 03&nbsp; 
  Mouse ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Response 03 
  if microsoft scrolling mouse</TT><BR><TT>Host:&nbsp; E8&nbsp; Set 
  Resolution&nbsp;</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;</TT><BR><TT>Host:&nbsp; 03&nbsp; 8 
  counts/mm</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Host:&nbsp; 
  E6&nbsp; Set scaling 1:1</TT><BR><TT>Dev:&nbsp;&nbsp; FA&nbsp; 
  Acknowledge</TT><BR><TT>Host:&nbsp; F3&nbsp; Set Sample 
  Rate&nbsp;</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT><BR><TT>Host:&nbsp; 
  28&nbsp; decimal 40</TT><BR><TT>Mouse: FA&nbsp; 
  Acknowledge</TT><BR><TT>Host:&nbsp; F4&nbsp; Enable 
  device&nbsp;</TT><BR><TT>Mouse: FA&nbsp; Acknowledge</TT> 
  <P><TT>If I then press the left mouse button:</TT> <BR><TT>Mouse: 09&nbsp; 
  00001001 bit0 = Left button state; bit3 = always 1</TT> <BR><TT>Mouse: 
  00&nbsp; No X-movement</TT> <BR><TT>Mouse: 00&nbsp; No Y-movement</TT> 
  <BR><TT>Mouse: 00&nbsp; No Z-movement</TT> </P>
  <P><TT>...and then release the left mouse button button:</TT> <BR><TT>Mouse: 
  08&nbsp; 00001000 bit0 = Left button state; bit3 = always 1</TT> 
  <BR><TT>Mouse: 00&nbsp; No X-movement</TT> <BR><TT>Mouse: 00&nbsp; No 
  Y-movement</TT> <BR><TT>Mouse: 00&nbsp; No 
Z-movement</TT></P></LI></UL><TT>After I downloaded/installed the Microsoft's 
Intellimouse drivers with support for the 4th and 5th buttons, the following 
sequence was found:</TT> 
<BLOCKQUOTE><TT>... (starts same as before) ...</TT> <BR><TT>Host:&nbsp; 
  F3&nbsp; Set Sample Rate&nbsp;&nbsp; : Attempt to Enter Microsoft&nbsp;</TT> 
  <BR><TT>Mouse: FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 
  Scrolling Mouse mode.</TT> <BR><TT>Host:&nbsp; C8&nbsp; decimal 
  200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Host:&nbsp; 
  F3&nbsp; Set Sample Rate&nbsp;&nbsp; :</TT> <BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Host:&nbsp; 
  64&nbsp; decimal 100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Mouse: 
  FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> 
  <BR><TT>Host:&nbsp; F3&nbsp; Set Sample Rate&nbsp;&nbsp; :</TT> <BR><TT>Mouse: 
  FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> 
  <BR><TT>Host:&nbsp; 50&nbsp; decimal 
  80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Host:&nbsp; 
  F2&nbsp; Read Device Type&nbsp; :</TT> <BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Mouse: 03&nbsp; 
  Mouse ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Response 03 
  if microsoft scrolling mouse.</TT> <BR><TT>Host:&nbsp; F3&nbsp; Set Sample 
  Rate&nbsp;&nbsp; : Attempt to Enter Microsoft 5-button&nbsp;</TT> 
  <BR><TT>Mouse: FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 
  Scrolling Mouse mode.</TT> <BR><TT>Host:&nbsp; C8&nbsp; decimal 
  200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Host:&nbsp; 
  F3&nbsp; Set Sample Rate&nbsp;&nbsp; :</TT> <BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Host:&nbsp; 
  C8&nbsp; decimal 200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Mouse: 
  FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> 
  <BR><TT>Host:&nbsp; F3&nbsp; Set Sample Rate&nbsp;&nbsp; :</TT> <BR><TT>Mouse: 
  FA&nbsp; Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> 
  <BR><TT>Host:&nbsp; 50&nbsp; decimal 
  80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Host:&nbsp; 
  F2&nbsp; Read Device Type&nbsp; :</TT> <BR><TT>Mouse: FA&nbsp; 
  Acknowledge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</TT> <BR><TT>Mouse: 04&nbsp; 
  Mouse ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Response 04 if 
  5-button scrolling mouse.</TT> <BR><TT>... rest of initialization same as 
  before ...</TT></BLOCKQUOTE><B>Emulation/Interfacing:</B> 
<UL>
  <LI>Click here for routines that emulate a PS/2 mouse or keyboard 
  <LI>Click here for routines that emulate a PS/2 host (ie, interface a 
  mouse/keyboard) 
  <LI>Click <A 
  href="http://panda.cs.ndsu.nodak.edu/~achapwes/PICmicro/code/Projects/mouse/ps2mouse.html">here</A> 
  for a fully-functional PS/2 mouse written for the PIC16F </LI></UL>
<BLOCKQUOTE>
  <UL></UL></BLOCKQUOTE>
<P><A name=Footnotes></A><B>Footnotes:</B> </P>
<BLOCKQUOTE>1) 2:1 scaling only applies to the automatic data reporting in 
  Stream mode. It does not effect the reported data sent in response to the 
  "Read Data" command. 
  <P>2)&nbsp; The mouse and host do not buffer "Resend" commands. This means 
  "Resend" will never be sent in response to the "Resend" command.&nbsp; </P>
  <P>3)&nbsp;&nbsp; A "packet" may be a 3-byte movement data packet, a 4-byte 
  movement data packet (for the Intellimouse), a 3-byte status packet (see 
  "Status Request" command) a 2-byte completion-code-ID packet (AAh,00h or 
  FCh,00h), or a 1-byte response to a 
command.<BR></P></BLOCKQUOTE><BR><BR></BODY></HTML>

⌨️ 快捷键说明

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