参数资料
型号: DM163010
厂商: Microchip Technology
文件页数: 26/80页
文件大小: 0K
描述: BOARD DEMO PICDEM USB
标准包装: 1
PICDEM? USB User’s Guide
2.2.10
2.2.11
DS41174A-page 22
Soft Detach
The soft detach command is one of the most useful features on the USB
PICmicro MCU. The reason the soft detach command is so useful is that in
applications such as the PS/2 mouse/keyboard example, no special driver
has to be created for the host. Most often for this application, the PICmicro
MCU would have two configurations - one for a mouse and the other for a
keyboard. A special driver would have to be created for the host that would
instruct the PICmicro MCU to change configurations. Furthermore, in order to
do this, the host’s driver would have to be able to detect what peripheral is
attached. An easy way to avoid difficulty with creating a unique driver for the
host, is to give the PICmicro MCU control over whether it will send the host
mouse or keyboard data. Based on the type of data it will send to the PC, the
PICmicro MCU can soft detach and re-enumerate as the peripheral of choice.
In this example, several events precede the implementation of a soft detach.
As mentioned before, an interrupt is generated when the data line goes low.
This initiates the receive routine, because it is assumed that the data line
dropping low is the result of a START bit being sent by the device. However,
the data line will also drop if the user disconnects the device. To distinguish
between these two cases, the firmware starts a timer when the data line goes
low. If the timer times out before the clock line goes high, the device has been
disconnected. Otherwise, the data line going low is the result of a START bit.
Once it has been determined that a device has been disconnected, the firm-
ware waits for another device to be attached. When the clock and data lines
are both high, a device has been attached. At this point, the PICmicro MCU
will ask the device to identify itself (see Appendix B for keyboard and mouse
commands). Based on the device’s response, the firmware will know whether
the newly attached device is a keyboard or mouse and perform a soft detach.
During the soft detach process, several things occur. First, the PICmicro MCU
turns off the pull-up resistor to V USB . The firmware does this by clearing the
DEV_ATT bit. Turning the pull-up resistor off, removes the PICmicro MCU
from the bus. After approximately 50 ms, which is enough time for the host to
see the device disconnect, the firmware sets DEV_ATT and reconnects the
PICmicro MCU to the bus. The host then re-enumerates the PICmicro MCU.
Translation to USB
In order to act like a USB mouse or keyboard, the PICmicro MCU has to
translate the PS/2 data format for each device to its USB data format. For the
mouse, this is very simple. For the keyboard, however, the process is more
complex.
2001 Microchip Technology Inc.
相关PDF资料
PDF描述
DM163012 BOARD DEMO PICDEM FOR 16C781/782
DM163024 BOARD DEMO PICDEM.NET 2
DM163025 PIC DEM FULL SPEED USB DEMO BRD
DM163028 BOARD DEMO PICDEM LCD
DM163029 BOARD PICDEM FOR MECHATRONICS
相关代理商/技术参数
参数描述
DM163010 制造商:Microchip Technology Inc 功能描述:DEMONSTRATION BOARD ((NW))
DM163011 功能描述:开发板和工具包 - PIC / DSPIC For PIC18FXX8 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163011 制造商:Microchip Technology Inc 功能描述:DEVELPMENT TOOLS ((NW))
DM163012 功能描述:开发板和工具包 - PIC / DSPIC For PIC16C781/782 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163014 功能描述:开发板和工具包 - PIC / DSPIC PICDEM 4 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压: