ImageVerifierCode 换一换
格式:DOCX , 页数:16 ,大小:22.14KB ,
资源ID:6345356      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-6345356.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(The PS2 Mouse Interface.docx)为本站会员(b****4)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

The PS2 Mouse Interface.docx

1、The PS2 Mouse InterfaceThe PS/2 Mouse InterfaceSource: http:/www.Computer-Engineering.orgAuthor: Adam ChapweskeLast Updated: 04/01/03Legal Information:All information within this article is provided as is and without any express or implied warranties, including, without limitation, the implied warra

2、nties of merchantibility and fitness for a particular purpose. This article is protected under copyright law. This document may be copied only if the source, author, date, and legal information is included.Abstract:This article attempts to explain every aspect of the PS/2 mouse interface including t

3、he physical and electrical interface, low-level protocol, modes of operation, commands, and extensions. All code samples involving the mouse encoder are written in assembly for Microchips PIC microcontrollers. All code samples related to the auxiliary device controller (keyboard controller) are writ

4、ten in x86 assemblyGeneral Description:There are many types of pointing devices available for modern PCs, including mice, trackballs, touchpads, electronic whiteboards, etc. Virtually all of these pointing devices communicate with a computer using one of two interfaces: Universal Serial Bus (USB) or

5、 the PS/2 Mouse Interface. See the following table for a comparison:USB (v1.1)PS/2 Mouse Interface Number of Devices SupportedUp to 127OneMaximum Data Rate12 Mbps40 kbpsPower (max)5V 500mA5V 100mAHot-Pluggable?YesNoDocumentationWell-documented: http:/www.usb.orgOut-of-print (IBM Tech Reference)Older

6、 pointing device interfaces include the Apple Desktop Bus (ADB), RS-232 serial port, and the bus mouse interface. These are obsolete and are not covered in this article.The PS/2 mouse interface originally appeared in IBMs Personal System/2 computers in the late 80s. It still remains a widely-support

7、ed interface for the sake of constantly maintaining backward compatibility. However, USB has quickly caught on these last few years and will eventually replace the PS/2 mouse interface entirely.The PS/2 mouse interface uses a bidirectional serial protocol to transmit movement and button-position dat

8、a to the computers auxiliary device controller (keyboard controller). The computer, in turn, may send a number of commands to the mouse to set the report rate, resolution, reset the mouse, disable the mouse, etc. The computer also provides the mouse with an overload-protected 5V power supply.Electri

9、cal Interface / Protocol: The PS/2 mouse uses the same protocol as the PS/2 keyboard (aka AT keyboard). Click here for detailed information on this protocol. Inputs, Resolution, and Scaling: The standard PS/2 mouse interface supports the following inputs: X (right/left) movement, Y (up/down) movemen

10、t, left button, middle button, and right button. The mouse reads these inputs at a regular freqency and updates various counters and flags to reflect movement and button states. There are many PS/2 pointing devices that have additional inputs and may report data differently than described in this do

11、cument. One popular extension I cover later in this document is the Microsoft Intellimouse, which includes support for the standard inputs as well as a scrolling wheel and two additional buttons. The standard mouse has two counters that keep track of movement: the X-movement counter and the Y-moveme

12、nt counter. These are 9-bit 2s complement values and each has an associated overflow flag. Their contents, along with the state of the three mouse buttons, are sent to the host in the form of a 3-byte movement data packet (as described in the next section.) The movement counters represent the amount

13、 of movement that has occurred since the last movment data packet was sent to the host (ie, they do not represent absolute positions.) When the mouse reads its inputs, it records the current state of its buttons and checks for movement. If movement has occurred it increments (for +X or +Y movement)

14、or decrements (for -X or -Y movement) its X and/or Y movement counters. If either of the counters has overflowed, it sets the appropriate overflow flag. The parameter that determines the amount by which the movement counters are incremented/decremented is the resolution. The default resolution is 4

15、counts/mm and the host may change that value using the Set Resolution (0xE8) command. There is a parameter that does not effect the movement counters, but does effect the reported(1) value of these counters. This parameter is scaling. By default, the mouse uses 1:1 scaling, which has no effect on th

16、e reported mouse movement. However, the host may select 2:1 scaling by sending the Set Scaling 2:1 (0xE7) command. If 2:1 scaling is enabled, the mouse will apply the following algorithm to the counters before sending their contents to the host: Movement CounterReported Movement001121334659N 52 * NM

17、ovement Data Packet: The standard PS/2 mouse sends movement/button information to the host using the following 3-byte packet (4): Byte 1Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0Y overflowX overflowY sign bitX sign bitAlways 1Middle BtnRight BtnLeft BtnByte 2X MovementByte 3Y MovementThe movement coun

18、ters are 9-bit 2s complement integers, where the most significant bit appears as a sign bit in Byte 1 of the movement data packet. These counters are updated when the mouse reads its input and finds movement has occurred. Their value is the amount of movement that has occurred since the last movemen

19、t data packet was sent to the host (ie, after a packet is sent to the host, the movement counters are reset.) The range of values that can be expressed by the movement counters is -255 to +255. If this range is exceeded, the appropriate overflow bit is set. As I mentioned earlier, the movement count

20、ers are reset whenever a movement data packet is successfully sent to the host. They are also reset after the mouse receives any command from the host other than the Resend (0xFE) command. Modes of Operation: Data reporting is handled according to the mode in which the mouse is operating. There are

21、four standard modes of operation: Reset - The mouse enters Reset mode at power-up or after receiving the Reset (0xFF) command. Stream - This is the default mode (after Reset finishes executing) and is the mode in which most software uses the mouse. If the host has previously set the mouse to Remote

22、mode, it may re-enter Stream mode by sending the Set Stream Mode (0xEA) command to the mouse. Remote - Remote mode is useful in some situations and may be entered by sending the Set Remote Mode (0xF0) command to the mouse. Wrap - This mode isnt particularly useful except for testing the connection b

23、etween the mouse and its host. Wrap mode may be entered by sending the Set Wrap Mode (0xEE) command to the mouse. To exit Wrap mode, the host must issue the Reset (0xFF) command or Reset Wrap Mode (0xEC) command. If the Reset (0xFF) command is recieved, the mouse will enter Reset mode. If the Reset

24、Wrap Mode (0xEC) command is received, the mouse will enter the mode it was in prior to Wrap Mode. (Note: The mouse may also enter extended modes of operation, as described later in this document. However, this is not a feature of the standard PS/2 mouse.) Reset Mode: The mouse enters reset mode at p

25、ower-on or in response to the Reset (0xFF) command. After entring this mode, the mouse performs a diagnostic self-test referred to as BAT (Basic Assurance Test) and sets the following default values: Sample Rate = 100 samples/sec Resolution = 4 counts/mm Scaling = 1:1 Data Reporting Disabled It then

26、 sends a BAT completion code of either AAh (BAT successful) or FCh (Error). The hosts response to a completion code other than AAh is undefined. Following the BAT completion code (AAh or FCh), the mouse sends its device ID of 00h. This distinguishes it from a keyboard, or a mouse in an extended mode

27、. I have read documents saything the host is not supposed to transmit any data until it receives a device ID. However Ive found that some BIOSs will send the Reset command immediately following the 0xAA received after a power-on reset. After the mouse has sent its device ID to the host, it will ente

28、r Stream Mode. Note that one of the default values set by the mouse is Data Reporting Disabled. This means the mouse will not issue any movement data packets until it receives the Enable Data Reporting command. Stream Mode: In stream mode, the mouse sends movement data when it detects movement or a

29、change in state of one or more mouse buttons. The maximum rate at which this data reporting may occur is known as the sample rate. This parameter ranges from 10 samples/sec to 200 samples/sec. Its default value is 100 samples/sec and the host may change that value by using the Set Sample Rate comman

30、d. Stream mode is the default mode of operation following reset. Remote Mode: In this mode the mouse reads its inputs and updates its counters/flags at the current sample rate, but it does not automatically issue data packets when movement has occured. Instead, the host must poll the mouse using the

31、 Read Data command. Upon receiving this command the mouse will send a single movement data packet and reset its movement counters.Wrap Mode: 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 command and Reset Wrap Mode command. The mouse treats these as valid commands and does not echo them back to the host. Intellimouse Extensions: A popular extension to t

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2