E书:USB Complete 在线阅读,下载,代码共享
E书:USB Complete 在线阅读,下载,代码共享Introduction
The Universal Serial Bus (USB) is a fast and flexible interface for connecting
devices to computers. Every new PC has at least a couple of USB ports. The
interface is versatile enough to use with standard peripherals like keyboards
and disk drives as well as more specialized devices, including one-of-a-kind
designs. USB is designed from the ground up to be easy for end users, with
no user configuring required in hardware or software.
In short, USB is very different from the legacy interfaces it's replacing. A
USB device may use any of four transfer types and three speeds. On attaching
to a PC, a device must respond to a series of requests that enable the PC
to learn about the device and establish communications with it. In the PC,
every device must have a low-level driver to manage communications
between applications and the system's USB drivers.
Developing a USB device and the software that communicates with it
requires knowing something about how USB works and how the PC's operating
system implements the interface. In addition, the right choice of con-
USB Complete
密码:
Winrar解压,拖"直接拖本文件到桌面get密码.htm"到桌面,
打开就是密码
减少盗链,一般默认密码: tenyear.net
C语言经典书籍下载,陆续提供... tenyear.net/bbs
提供专业站点采集制作,发布数千文章!
IPTV论坛整站域名及系统iptvforum.cn出售,价格50000 RMB.
有意者联系 [email]tenyearnet@gmail.com[/email]
域名iptvforum.cn权威,勿失良机! 文本无图部分:
Introduction
trailer chip, device class, and tools and techniques can go a long way in
avoiding snags and simplifying what needs to be done. This book is a guide
for developers of USB devices. Its purpose is to introduce you to USB and to
help get your project up and running and troublefree as quickly and easily as
possible.
Who should read this book?
This book is for you if you want to know how to design a USB peripheral,
or if you want to know how to communicate with USB peripherals from the
applications you write. These are some of questions the book answers:
.
What is USB and how do peripherals use it to communicate with PCs?
There's a lot to the USB interface. Learning about it can be daunting at
first. This book's focus is on the practical knowledge you'll need to com
plete your project.
.
How can I decide if my project should use a USB interface? Maybe your
design isn't suited for USB. I'll show you how to decide whether it is. If
the answer is yes, I'll help you decide which of USB's speeds and transfer
types to use.
.
How do I choose a USB controller chip for my peripheral design? Every USB
peripheral must contain an intelligent controller. There are dozens of
controller chips designed for use in USB peripherals. In this book, I com
pare popular chip families and offer tips on how to decide, based on both
your projects needs and your own background and preferences.
.
How do applications communicate with USB peripherals? To communicate
with a USB peripheral, a PC needs two things: a device driver that knows
how to communicate with the PC's USB drivers and an application that
knows how to talk to the device driver. Some peripherals can use drivers
that are built into Windows. Others may require a custom driver. This
book will show you when you can use Windows' built-in drivers and how
to communicate with devices from Visual Basic and Visual C++ applica
tions. You'll also find out what's involved in writing a device driver and
what tools can help to speed up the process.
USB Complete How do USB peripherals communicate? USB peripherals typically use a
combination of hardware and embedded code to communicate with
PCs. In this book, I show how to write the code that enables Windows to
identify a device and load the appropriate device driver, as well as the
code required for exchanging data with applications.
.
How do I decide whether my peripheral can use bus power, or whether it
needs its own supply? A. big advantage to USB is that many peripherals can
be powered entirely from the bus. Find out whether your device can use
this capability and how to manage power use, especially for devices that
use battery power.
.
How can I be sure that my device will operate as smoothly as possible for its
end users? On the peripheral side, smooth operation requires understand
ing the specification's requirements and how the device can meet them.
In the PC, proper operation requires a correctly structured information
(INF) file that enables Windows to identify the device and software that
knows how to communicate with the device as efficiently as possible.
This book has information and examples to help with each of these.
What's new in the Second Edition?
In the months after the publication of the first edition of USB Complete,
much happened in the world of USB, including the release of version 2.0 of
the USB specification. USB 2.0 supports a bus rate of 480 Megabits per second,
forty times faster than USB 1.1. This and other developments in hardware
and software prompted this second edition of the book.
Rather than just tacking on a chapter about USB 2.0, I've revised the book
from start to finish to reflect the changes in 2.0. By popular request, another
addition is Visual C++ code to accompany the Visual Basic examples for
application communications with USB devices. I've also expanded the material
about Windows drivers and applic ations to include Windows 2000, and
have added information on new controller chips and development tools.
Other additions and updates are sprinkled throughout, many prompted by
reader suggestions.
USB Complete
Introduction
Is this book really complete?
Although the title is USB Complete, please don't expect this book to contain
every possible fact about USB. That would take a library. The Complete in
the title means that this book will guide you from knowing nothing about
USB to developing all of the code required to get a USB peripheral up and
communicating with a PC.
There are many other worthy topics related to USB, but limitations of time
and space prevent me from including them all.
My focus is on communicating with Windows PCs. Although the basic
principles are the same, I don't include details about how to communicate
with peripherals on a Macintosh or a PC running Linux or other non-Windows
operating systems.
I cover the basics of the device driver's responsibilities and what's involved in
writing a driver, but the details of driver writing can easily fill a book (and in
fact there are excellent—and lengthy—books on this topic). This book will
help you decide when you need to write a custom driver and when and how
to use a class driver included with Windows.
To understand the material in the book, it's helpful to have basic knowledge
in a few areas. I assume you have some experience with digital logic, application
programming for PCs and writing embedded code for peripherals. You
don't have to know anything at all about USB.
Additional Resources, Updates, and Corrections
For more about using USB, I invite you to visit my USB Central page at
Lakeview Research's website, [url]www.Lvr.com.[/url] This is where you'll find complete
code examples, updates, links to vendors, information and tools from
other sources, as well as links to anything else I find that's relevant to developing
USB products. If you have a suggestion, code, or other informatior
that you'd like me to post or link to, let me know at [email]jan@lvr.com[/email].
In spite of my very best efforts, I know from experience that errors will slif
through in this book. As they come to light, I'll document them and make
USB Complete
Introduction
list available at Lakeview Research's website. If you find an error in the book,
please let me know and I'll add it.
Thanks!
USB is way too complicated to write about without help. I have many peo
ple to thank.
I owe an enormous thank you to my technical reviewers, who generously
read my rough and rocky drafts and provided feedback that has improved
the book enormously. (With that said, every error in this book is mine and
mine alone.)
I thank Paul E. Berg of PEB Consulting; Brian Buchanan, Mark Hastings,
Lane Hauck, Bijan Kamran, Kosta Koeman, Tim Williams, and Dave
Wright of Cypress Semiconductor; Joshua Buergel of BSQUARE Inc.; Gary
Crowell of Micron Technology; Fred Dart of Future Technology Devices
International (FTDI); Dave Dowler; Mike Fahrion and the engineers at
B&B Electronics; John M. Goodman, author of Hard Disk Secrets, Peter
Norton's Inside the PC, Memory Management for All of Us, and other books;
John Hyde, USB enthusiast and author of USB Design by Example; David
James of 1Zerol Technologies; Christer Johansson of High Tech Horizon;
Jon Lueker of Intel Corporation; Bob Nathan of NCR Corporation; Robert
Severson of USBMicro; and Craig R. Smith of Ford Motor Company,
R&VT department.
Others I want to thank for their help in my researching and writing this
book are Walter Banks of Byte Craft; Jason Bock; Michael DeVault of
DeVaSys Embedded Systems; Pete Fowler, Joseph McCarthy, and Don Park-
man of Cypress Semiconductor; Brad Markisohn of INDesign LLC; Daniel
McClure of Tyco Electronics; Tawnee McMullen of Belkin Components;
Rich Moran of RPM Systems Corporation; Dave Navarro of PowerBasic;
and Amar Rajan of American Concepts Consulting.
I hope you find the book useful. Comments invited!
Jan Axelson, June 2001
[email]jan@lvr.com[/email]
USB Complete
A Fresh Start
1
A Fresh Start
Computer hardware doesn't often get a chance to start fresh. Anything new
usually has to remain compatible with whatever came before it. This is true
of both computers and the peripherals that connect to them. Even the most
revolutionary new peripheral has to use an interface supported by the computers
it connects to.
But what if you had the chance to design a peripheral interface from scratch?
What qualities and features would you include? It's likely that your wish list
would include these:
.
Easy to use, so there's no need to fiddle with configuration and setup
details.
.
Fast, so the interface doesn't become a bottleneck of slow communica
tions.
.
Reliable, so that errors are rare, with automatic correction of errors that
do occur.
.
Flexible, so many kinds of peripherals can use the interface.
Chapter 1
.
Inexpensive, so users (and the manufacturers who will build the inter
face into their products) don't balk at the price.
.
Power-conserving, to save battery power on portable computers.
.
Supported by the operating system, so developers don't have to strug
gle with writing low-level drivers for the peripherals that use the inter
face.
The good news is that you don't have to create this ideal interface, because
the developers of the Universal Serial Bus (USB) have done it for you. USB
was designed from the ground up to be a simple and efficient way to communicate
with many types of peripherals, without the limitations and frustrations
of existing interfaces.
Every new PC has a couple of USB ports that you can connect to a keyboard,
mouse, scanners, external disk drives, printers, and standard and custom
hardware of all kinds. Inexpensive hubs enable you to add more ports
and peripherals as needed.
But one result of USB's ambitious goals has been challenges for the developers
who design and program USB peripherals. A result of USB's versatility
and ease of use is an interface that's more complicated than the interfaces it
replaces. Plus, any new interface will have difficulties just because it's new.
When USB first became available on PCs, Windows didn't yet include
device drivers for all popular peripheral types. Protocol analyzers and other
development tools couldn't begin to be designed until there was a specification
to follow, so the selection of these was limited at first. Problems like
these are now disappearing, and the advantages are increasing with the availability
of more controller chips, new development tools, and improved operating-
system support. This book will show you ways to get a USB peripheral
up and running as simply and quickly as possible by making the best possible
use of tools available now.
This chapter introduces USB, including its advantages and drawbacks, a
look at what's involved in designing and programming a device with a USB
interface, and a bit of the history behind the interface.
A Fresh Start
What USB Can Do
USB is a likely solution any time you want to use a computer to communicate
with devices outside the computer. The interface is suitable for one-
of-kind and small-scale designs as well as mass-produced, standard
peripheral types.
To be successful, an interface has to please two audiences: the users who
want to use the peripherals and the developers who design the hardware and
write the code that communicates with the device. USB has features to
please both.
Benefits for Users
From the user's perspective, the benefits to USB are ease of use, fast and reliable
data transfers, flexibility, low cost, and power conservation. Table 1-1
compares USB with other popular interfaces.
Ease of Use
Ease of use was a major design goal for USB, and the result is an interface
that's a pleasure to use for many reasons:
One interface for many devices. USB is versatile enough to be usable with
many kinds of peripherals. Instead of having a different connector type and
supporting hardware for each peripheral, one interface serves many.
Automatic configuration. When a user connects a USB peripheral to
a
powered system, Windows automatically detects the peripheral and loads
the appropriate software driver. The first time the peripheral connects, Win-
dows may prompt the user to insert a disk with driver software, but other
than that, installation is automatic. There's no need to locate and run
a
setup program or restart the system before using the peripheral.
No user settings. USB peripherals don't have user-selectable settings such as
port addresses and interrupt-request (IRQ) lines. Available IRQ lines are in
short supply on PCs, and not having to allocate one for a new peripheral is
often reason enough to use USB.
Chapter 1
Table 1-1: Comparison of popular computer interfaces. Where a standard
doesn't specify a maximum, the table shows the typical maximum.
Interface Format
Number of
Devices
(maximum)
Length
(maximum,
feet)
Speed
(maximum,
bits/sec.)
Typical Use
USB asynchronous
serial 127
16 (or up to
96 ft. with 5
hubs)
1.5M, 12M,
480M
Mouse,
keyboard, disk
drive, modem,
audio
RS-232
(EIA/TIA-
232)
asynchronous
serial 2 50-100
20k (115k
with some
hardware)
Modem, mouse,
instrumentation
RS-485
(TIA/EIA-
485)
asynchronous
serial
32 unit loads
(up to 256
devices with
some
hardware)
4000 10M
Data acquisition
and control
systems
IrDA
asynchronous
serial infrared 2 6 115k
Printers, handheld
computers
Microwire
synchronous
serial 8 10 2M
Microcotroller
communications
SPI
synchronous
serial 8 10 2.1M
Microcotroller
communications
I2C
synchronous
serial 40 18 3.4M
Microcotroller
communications
IEEE- 1394
(Fire Wire) serial 64 15
400M
(increasing to
3.2G with
IEEE-1394b
Video, mass
storage
IEEE-488
(GPIB) parallel 15 60 8M Instrumentation
Ethernet serial 1024 1600
10M/100M/
1G Networked PC
MIDI
serial current
loop
2 (more with
flow-through
mode)
50 31.5k
Music, show
control
Parallel Printer
Port parallel
2 (8 with
daisy-chain
support)
10-30 8M
Printers,
scanners, disk
drives
A Fresh Start
Figure 1-1: The two USB connectors (right) are much more compact than typical
RS-232 serial (left) and Centronics parallel (center) connectors.
Frees hardware resources for other devices. Using USB for as many
peripherals as possible frees up IRQ lines for the peripherals that do require
them. The PC dedicates a series of port addresses and one interrupt-request
(IRQ) line to the USB interface, but beyond this, individual peripherals
don't require additional resources. In contrast, each non-USB peripheral
requires dedicated port addresses, often an IRQ line, and sometimes an
expansion slot (for a parallel-port card, for example).
Easy to connect. With USB, there's no need to open the computer's enclosure
to add an expansion card for each peripheral. A typical PC has at least
two USB ports. You can expand the number of ports by connecting a USB
hub to an existing port. Each hub has additional ports for attaching more
peripherals or hubs.
Simple cables. The USB's cable connectors are keyed so you can't plug
them in wrong. Cables can be as long as 5 meters. With hubs, a device can
be as far as 30 meters from its host PC. Figure 1-1 shows that the USB connectors
are small and compact in contrast to typical RS-232 and parallel
Chapter 1
connectors. To ensure reliable operation, the specification includes detailed
requirements that all cables and connectors must meet.
Hot pluggable. You can connect and disconnect a peripheral whenever you
want, whether or not the system and peripheral are powered, without dam
aging the PC or peripheral. The operating system detects when a device is
attached and readies it for use.
No power supply required (sometimes). The USB interface includes
power-supply and ground lines that provide +5V from the computer's or
hub's supply. A peripheral that requires up to 500 milliamperes can draw all
of its power from the bus instead of having its own supply. In contrast, most
other peripherals have to choose between including a power supply in the
device or using a bulky and inconvenient external supply.
Speed
USB supports three bus speeds: high speed at 480 Megabits per second, full
speed at 12 Megabits per second, and low speed at 1.5 Megabits per second.
Every USB-capable PC supports low and full speeds. High speed was added
in version 2.0 of the specification, and requires USB 2.0-capable hardware
on the motherboard or an expansion card.
These speeds are signaling speeds, or the bit rates supported by the bus. The
rates of data transfer that individual devices can expect are lower. In addition
to data, the bus must carry status, control, and error-checking signals. Plus,
multiple peripherals may be sharing the bus. The theoretical maximum rate
for a single transfer is over 53 Megabytes per second at high speed, about 1.2
Megabytes per second at full speed, and 800 bytes per second at low speed.
Why three speeds? Low speed was included for two reasons. Low-speed
peripherals can often be built more cheaply. And for mice and devices that
require flexible cables, low-speed cables can be more flexible because they
don't require as much shielding.
Full speed is comparable to or better than the speeds attainable with existing
serial and parallel ports and can serve as a replacement for these.
A Fresh Start
After the release of USB 1.0, it became clear that a faster interface would be
useful. Investigation showed that a speed increase of forty times was feasible
while keeping the interface backwards-compatible with low- and full-speed
devices. High speed became an option with the release of version 2.0 of the
USB specification.
Reliability
The reliability of USB results from both the hardware design and the data-
transfer protocols. The hardware specifications for USB drivers, receivers,
and cables eliminate most noise that could otherwise cause data errors. In
addition, the USB protocol enables detecting of data errors and notifying
the sender so it can retransmit. The detecting, notifying, and retransmitting
are typically done in hardware and don't require any programming or user
intervention.
Low Cost
Even though USB is more complex than earlier interfaces, its components
and cables are inexpensive. A device with a USB interface is likely to cost the
same or less than its equivalent with an older interface. For very low-cost
peripherals, the low-speed option has less stringent hardware requirements
that may reduce the cost further.
Low Power Consumption
Power-saving circuits and code automatically power down USB peripherals
when not in use, yet keep them ready to respond when needed. In addition
to the environmental benefits of reduced power consumption, this feature is
especially useful on battery-powered computers where every milliampere
counts.
Benefits for Developers
The above advantages for users are also important to hardware designers and
programmers. The advantages make users eager to use USB peripherals, so
there's no need to fear wasting time developing for an unpopular interface.
And many of the user advantages also make things easier for developers. For
Chapter 1
example, USB's defined cable standards and automatic error checking mean
that developers don't have to worry about specifying cable characteristics or
providing error checking in software.
USB also has advantages that benefit developers specifically. The developers
include the hardware designers who select components and design the circuits,
the programmers who write the software that communicates with
USB peripherals, and the programmers who write the embedded code inside
the peripherals.
The benefits to developers result from the flexibility built into the USB pro
tocol, the support in the controller chips and operating system, and the fact
that the interface isn't controlled by a single vendor. Although users aren't
likely to be aware of these benefits, they'll enjoy the result, which is inexpensive,
trouble-free, and feature-rich peripherals.
Flexibility
USB's four transfer types and three speeds make it feasible for many types of
peripherals. There are transfer types suited for exchanging large and small
blocks of data, with and without time constraints. For data that can't tolerate
delays, USB can guarantee a transfer rate or maximum time between
transfers. These abilities are especially welcome under Windows, where
accessing peripherals in real time is often a challenge. The operating system,
device drivers, and application software can still introduce unavoidable
delays, but USB makes it as easy as possible to achieve transfers that are
close to real time.
Unlike other interfaces, USB doesn't assign specific functions to signals or
make other assumptions about how the interface will be used. For example,
the status and control lines on the PC's parallel port were defined with the
intention of communicating with line printers. There are five input lines
with assigned functions such as indicating a busy or paper-out condition.
When developers began using the port for scanners and other peripherals
that send large amounts of data to the PC, the limitation of having just five
inputs was an obstacle. (Eventually the interface was expanded to allow
eight
usbcomplete不完全文本.zip 不错,:victory: :lol :lol :victory: how can i get prestige? 感謝感謝 thanks
[url=http://www.huarenydya.info/bbs1/adget.php?id=678874]华人伊甸园—成人图片、情色BT、在线影视、美艳幼女、欢乐同志、裸聊交友、另类换妻、乱伦兽交、强奸诱奸、香艳文学-应有尽有!点击进入![/url] THANK YOU 好东东,3KS for sharing 谢谢!