Ports.ppt - RMIT University by xiuliliaofz

VIEWS: 42 PAGES: 82

									 Integrate data acquisition and interfacing
             system ISYS 7549c


Interfacing The Standard Parallel Port
        The Serial Connection
      Universal Serial Bus (USB)


                                              1
How Parallel Ports Work?
   If you have a printer connected to your computer,
    there is a very good chance that it uses the parallel
    port. While USB is becoming increasingly popular,
    the parallel port is still the most used interface for
    printers.




                                                         2
What is computer interfacing?
   Computer interfacing: the art of connecting
    computers and peripherals. In a lot of circumstances,
    it looks more like magic than art.
   It is not uncommon that you end up removing all
    unnecessary hardware from your computer to get
    that communication device to work.
   Despite all plug-and-play internal hardware solutions
    for the PC, connecting a number of external devices
    still requires some amount of technical knowledge
    and experience.



                                                      3
                        INTERFACING COMPONENTS
          10/100/1000
                                            USB2.0
           Ethernet

802.11x
                                                     Office
                                                     (opt)




                                  Monitor
                                  2-4Gbps



                                   Office
                                   (core)


                                                      etc…
                                                              4
   In computer interfacing it is often difficult to find the
    right cable for a specific purpose.
    Although the USB interface tries to solve this
    problem, there are many situations where you need
    to search for the right cable.
   This can be the case when you need a RS-232 or
    parallel cable to connect a device to your computer.
   There is also information about modular cables and
    cables for connecting PLC's if you happen to work in
    the industrial automation business


                                                           5
A typical parallel port on the back of your computer




                                                  6
Standard Parallel Port
   This is the original parallel port, it's been used on all
    PC computers since the very beginning and has
    mostly remained unchanged over the years.
   When IBM came up with the first PC, they opted to
    go along the lines of the the most prominent printer
    manufacturer at the time, Centronics.
    This printer manufacturer had developed a set of
    control signals that was up to the task of controlling
    computer printers and since many printer
    manufacturers had been adopting this now standard
    design, it was the obvious choice to make.



                                                           7
   The parallel port socket on your computer uses 25
    pins. On most peripherals, the 36 pins Centronics
    version is used. Both connector pinouts are shown
    here.
   The centronics socket is named after the company
    that introduced the first dot matrix printer in 1970,
    but after IBM and Epson took over the dot matrix
    printer market (later followed by Hewlett Packard in
    the laser and deskjet printer segment) most people
    only associate the word centronics with the port
    interface itself, not with a manufacturer.


                                                        8
   But when IBM constructed it's PC they opted to not
    use the true Centronics connector which was a 36
    conductor Amphenol connector (also known as the
    Centronics connector).
   IBM opted for a 25 pin D shell connector also called a
    DB-25 connector. Since then, printer manufacturers
    have always used Centronics connectors and PC
    manufacturers have been using DB-25 connectors.
   This is the reason why you need this special adapter
    cable that is known as a printer cable and is now a
    standard accessory.



                                                       9
   Following are pictures of the connectors pin view and
    it's signal assignments, also are a description of each
    signal.




   Each signal is identified by its pin number on a DB-25
    and Centronics 36 pin connector and its signal name.

                                                       10
Parallel DB 25 pin   Centronics pin




                                      11
                DB 25 male
Line                         C
                (computer)
Strobe          1            1

Data bit 0      2            2

Data bit 1      3            3

Data bit 2      4            4

Data bit 3      5            5

Data bit 4      6            6

Data bit 5      7            7

Data bit 6      8            8

Data bit 7      9            9

Acknowledge     10           10

Busy            11           11

Paper out       12           12

Select          13           13

Autofeed        14           14           Parallel printer cable
Error           15           32

Reset           16           31

Select          17           36

Signal ground   18           33

Signal ground   19           19 + 20

Signal ground   20           21 + 22

Signal ground   21           23 + 24

Signal ground   22           25 + 26

Signal ground   23           27

Signal ground   24           28 + 29

Signal ground   25           16 + 30

Shield          Cover        Cover + 17
                                                             12
Standard Centronics Parallel Cable Db-25 To
Centronics 36

DB-25 PIN Male (PC) Centronics 36 Male
CENTRONICS 36 MALE CENTRONICS 36 FEMALE
      1 --------------------------------------> 1 Strobe *
      2 <-------------------------------------> 2 Data bit   0+
      3 <-------------------------------------> 3 Data bit   1+
      4 <-------------------------------------> 4 Data bit   2+
      5 <-------------------------------------> 6 Data bit   3+
      6 <-------------------------------------> 6 Data bit   4+
      7 <-------------------------------------> 7 Data bit   5+
      8 <-------------------------------------> 8 Data bit   6+
      9 <-------------------------------------> 9 Data bit   7+

                                                                  13
 10 <------------------------------------- 10 Acknowledge *
11 <------------------------------------- 11 Busy +
12 <------------------------------------- 12 Paper out +
13 <------------------------------------- 13 Select (in) *
14 -------------------------------------> 14 Auto Feed *
15 <------------------------------------- 32 Error *
16 -------------------------------------> 31 Initialize printer *
17 -------------------------------------> 36 Select (out) *
18 thru 25 Gnd 16, 19 thru 30, 33 Ground
15, 17, 18, 34, 35 No connection



                                                                14
   Note!!
   * denotes and active low signal. This pin out depicts
    the newer bi-directional parallel port with input and
    output capabilities often used with external tape
    drives and accessory devices.
   If pins 31 or 32 are grounded on a cable the printer
    will fail to come ready when attached to the PC.
   This is common on low cost parallel printer cables.




                                                       15
       Strobe
   The strobe line is the heart of the parallel port, it tells the
    printer when to sample the information of the data lines, it
    is usually high and goes low when a byte of data is
    transmitted.
   The timing is critical for the data to be read correctly, all
    bits on the data lines must be present before the strobe
    line goes low, to insure data integrity when the printer
    samples the data lines.
   The time needed for each byte is about half a microsecond
    then the the strobe line goes low for about one
    microsecond and then the data is usually still present for
    another half microsecond after the strobe goes high. So
    the total time needed to transmit a full byte is around two
    microseconds.
                                                                16
Data

   These 8 lines carry the information to be printed and
    also special printer codes to set the printer in
    different modes like italics, each line carries a bit of
    information to be sent, the information here travels
    only from the computer to the printer or other
    parallel device.
   These lines function with standard TTL voltages, 5
    volts for a logical 1 and 0 volts for a logical 0.




                                                         17
Acknowledge

   This line is used for positive flow control, it lets the
    computer know that the character was successfully
    received and that it's been dealt with.
   It's normally high and goes low when it has received
    the character and is ready for the next one, this
    signal stays low for about 8 microseconds.




                                                         18
Busy
   As seen previously (strobe line), each byte takes
    about 2 microseconds to be sent to the printer, this
    means the printer is receiving about 500,000 bytes
    per second (1 sec divided by 2 microseconds).
   No printer can print this fast, so they came up with a
    busy line.
   Each time the printer receives a byte this line will
    send high to tell the computer to stop sending, when
    the printer is done manipulating the byte (printing,
    putting it in the buffer or setting it's internal
    functions) it then goes back low, to let the computer
    know that it can send the next byte.


                                                       19
Paper End

   Also referred to as Paper Empty, this line will go high
    when you run out of paper, just like the paper out
    light on your printer, this way the computer will know
    and can tell you of the problem.
   When this happens the busy line will also go high so
    the computer stops sending data. Without this line
    when you would run out of paper the busy line would
    go high and the computer would seem to be hanged.




                                                       20
Select

   This line tells the computer when it is selected (or
    online), just like the light on your printer. When the
    select line is high the printer is online and is ready to
    receive data, when it's low the computer will not
    send data.




                                                          21
       Auto Feed
   Not all printers treat the carriage return the same way,
    some will just bring the print head to the beginning of the
    the line being printed and some will also advance the paper
    one line down (or roll the paper one line up).
   Most printers have a DIP switch or some other way to tell
    your preference of how to interpret the carriage return.
   The auto feed signal lets your computer do the job for you,
    when it puts this signal low, the printer will feed one line
    when it gets a carriage return, by holding the signal high
    the software must send a line feed along with the carriage
    return to obtain the same effect.



                                                             22
Error

   This is a general error line, there is no way of
    knowing the exact error from this line. When no
    errors are detected, this line is high, when an error is
    detected it goes low.
    Some of the errors that can arise through this line
    are: cover open, print head jammed, a broken belt by
    detecting that the head does not come back to it's
    home position or any other error that your printer
    can detect.



                                                        23
Initialize Printer

   This line is used to reinitialise the printer, the
    computer will accomplish this by putting the line,
    which is normally high, to it's low state.
   This is very useful when starting a print job, since
    special formatting codes might have been sent to the
    printer on the last job, by reinitialising the printer you
    are sure of not messing up the whole thing, like
    printing the whole document in italics or something.




                                                          24
Select Input

   Many computers give the option of letting the
    computer the option of putting the printer online or
    not, by putting this signal high the printer is kept in
    it's offline state and putting it low the printer is online
    and will accept data from the computer.
   Many printers have a DIP switch to let decide if the
    computer can control the online state, when the
    switch is active it will keep this line always low, thus
    keeping the computer from putting the printer offline.



                                                           25
Ground

   This is a regular signal ground and is used as a
    reference for the low signal or logical 0.




                                                       26
   Newer Parallel Port’s are standardized under the IEEE
    1284 standard first released in 1994. This standard
    defines 5 modes of operation which are as follows:
       1. Compatibility Mode
       2. Nibble Mode
       3. Byte Mode
       4. EPP Mode (Enhanced Parallel Port).
       5. ECP Mode (Extended Capabilities Mode).




                                                     27
   The aim was to design new drivers and devices which
    were compatible with each other and also backwards
    compatible with the Standard Parallel Port (SPP).
    Compatibility, Nibble & Byte modes use just the
    standard hardware available on the original Parallel
    Port cards while EPP & ECP modes require additional
    hardware which can run at faster speeds, while still
    being downwards compatible with the Standard
    Parallel Port.



                                                    28
Port Addresses
   The Parallel Port has three commonly used base
    addresses.
   The 3BCh base address was originally introduced
    used for Parallel Ports on early Video Cards. This
    address then disappeared for a while, when Parallel
    Ports were later removed from Video Cards. They has
    now reappeared as an option for Parallel Ports
    integrated onto motherboards, upon which their
    configuration can be changed using BIOS.



                                                   29
   LPT1 is normally assigned base address 378h, while
    LPT2 is assigned 278h. However this may not always
    be the case as explained later.
   378h & 278h have always been commonly used for
    Parallel Ports. The lower case h denotes that it is in
    hexadecimal.
   These addresses may change from machine to
    machine.




                                                       30
Address                    Notes
3BCh - 3BFh   Used for Parallel Ports which were
              incorporated on to Video Cards.
              Doesn't support ECP addresses.

378h - 37Fh   Usual Address For LPT 1.

278h - 27Fh   Usual Address For LPT 2.



                                              31
   When the computer is first turned on, BIOS (Basic
    Input/Output System) will determine the number of
    ports you have and assign device labels LPT1 and
    LPT2 to them. BIOS first looks at address 3BCh. If a
    Parallel Port is found here, it is assigned as LPT1,
    then it searches at location 378h.
   If a Parallel card is found there, it is assigned the
    next free device label. This would be LPT1 if a card
    wasn't found at 3BCh or LPT2 if a card was found at
    3BCh.
   The last port of call, is 278h and follows the same
    procedure than the other two ports. Therefore it is
    possible to have a LPT2 which is at 378h and not at
    the expected address 278h.                            32
   What can make this even confusing, is that some manufacturers
    of Parallel Port Cards, have jumpers which allow you to set your
    Port to LPT1, LPT2. Now what address is LPT1? - On the
    majority of cards LPT1 is 378h, and LPT2, 278h, but some will
    use 3BCh as LPT1, 378h as LPT1 and 278h as LPT2. Life wasn't
    meant to be easy.
   The assigned devices LPT1 and LPT2 should not be a worry to
    people wishing to interface devices to their PC's. Most of the
    time the base address is used to interface the port rather than
    LPT1 etc.
   However should you want to find the address of LPT1 or any of
    the Line Printer Devices, you can use a lookup table provided by
    BIOS. When BIOS assigns addresses to your printer devices, it
    stores the address at specific locations in memory, so we can
    find them.


                                                                33
LPT Addresses in the BIOS Data Area

Start Address
  Function
0000:0408                      LPT1's
  Base Address

0000:040A                      LPT2's
  Base Address

                                        34
How Serial Ports Work?
   Considered to be one of the most basic external
    connections to a computer, the serial port has been
    an integral part of most computers for more than 20
    years. Although many of the newer systems have
    done away with the serial port completely in favour of
    USB connections, most modems still use the serial
    port, as do PDAs and digital cameras. Few
    computers have more than two serial ports.




                                                       35
Two serial ports on the back of a PC




                                       36
   Almost nothing in computer interfacing is more
    confusing than selecting the right RS232 serial cable.
    This page is intented to provide information about
    the most common serial RS232 cables in normal
    computer use.
   Essentially, serial ports provide a standard connector
    and protocol to let you attach devices, such as
    modems, to your computer.
   All computer operating systems in use today support
    serial ports, because serial ports have been around
    for decades. Parallel ports are a more recent
    invention and are much faster than serial ports.


                                                       37
   The RS232 connector was originaly developed to use 25
    pins. In this DB25 connector pinout provisions were made
    for a secondary serial RS232 communication channel.
   In practice, only one serial communication channel with
    accompanying handshaking is present. Only very few
    computers have been manufactured where both serial
    channels are implemented.
   It can be used to query the modem status while the
    modem is on-line and busy communicating. On personal
    computers, the smaller DB9 version is more commonly
    used today. Note, that the protective ground is assigned to
    a pin at the large connector where the connector outside is
    used for that purpose with the DB9 connector version.

                                                            38
Where the definition of RS232 focussed on the connection of DTE,
data terminal equipment (computers, printers, etc.) with DCE, data
communication equipment (modems),
                          R
                          S
                          2
                          3
                          2

                          D
                          B
                          9

                          p
                          i
                          n

                          a
                          s
                          s
                          i
                          g
                          n
                          m
                          e
                          n
                          t




                                                              39
   The name "serial" comes from the fact that a serial
    port "serializes" data.
   The advantage is that a serial port needs only one
    wire to transmit the 8 bits (while a parallel port needs
    8).
   The disadvantage is that it takes 8 times longer to
    transmit the data than it would if there were 8 wires.
    Serial ports lower cable costs and make cables
    smaller.
   Before each byte of data, a serial port sends a start
    bit, which is a single bit with a value of 0. After each
    byte of data, it sends a stop bit to signal that the byte
    is complete. It may also send a parity bit.            40
   Serial ports, also called communication (COM)
    ports, are bi-directional. Bi-directional
    communication allows each device to receive data as
    well as transmit it. Serial devices use different pins to
    receive and transmit data -- using the same pins
    would limit communication to half-duplex, meaning
    that information could only travel in one direction at a
    time. Using different pins allows for full-duplex
    communication, in which information can travel in
    both directions at once.


                                                         41
       RS232 null modem cables
   The easiest way to connect two PC's is using an RS232 null
    modem cable.
   The only problem is the large variety of RS232 null modem
    cables available. For simple connections, a three line RS232
    cable connecting the signal ground and receive and
    transmit lines is sufficient.
   Depending of the software used, some sort of handshaking
    may however be necessary.
   Use the RS232 null modem selection table to find the right
    null modem cable for each purpose.
   For a Windows 95/98/ME Direct Cable Connection, the
    RS232 null modem cable with loop back handshaking is a
    good choice.
                                                             42
RS232 null modem cables with handshaking can be defined in numerous ways,
with loopback handshaking to each PC, or complete handshaking between the
two systems. The most common null modem cable types are shown here. See
Figure 1.0

                                      Connect     Connect
                                                              Function
                                      or 1        or 2
                                                              R
                                      2           3                    Tx
                                                              x
                                                                       R
                                      3           2           Tx
                                                                       x
                                                              Signal
       Figure 1.0                     5           5
                                                              ground

                                                                       43
   If you read about null modems, this three wire null modem cable is
    often talked about. Yes, it is simple but can we use it in all
    circumstances? There is a problem, if either of the two devices checks
    the DSR or CD inputs.
   These signals normaly define the ability of the other side to
    communicate. As they are not connected, their signal level will never
    go high. This might cause a problem.
   The same holds for the RTS/CTS handshaking sequence. If the
    software on both sides is well structured, the RTS output is set high
    and then a waiting cycle is started until a ready signal is received on
    the CTS line.
   This causes the software to hang because no physical connection is
    present to either CTS line to make this possible. The only type of
    communication which is allowed on such a null modem line is data-
    only traffic on the cross connected Rx/Tx lines.


                                                                       44
   This does however not mean, that this null modem
    cable is useless. Communication links like present in
    the Norton Commander program can use this null
    modem cable.
   This null modem cable can also be used when
    communicating with devices which do not have modem
    control signals like electronic measuring equipment etc.
   As you can imagine, with this simple null modem cable
    no hardware flow control can be implemented. The
    only way to perform flow control is with software flow
    control using the XOFF and XON characters.


                                                         45
UART, an introduction
   An UART, universal asynchronous receiver / transmitter
    is responsible for performing the main task in serial
    communications with computers. The device changes
    incomming parallel information to serial data which can be
    sent on a communication line. A second UART can be
    used to receive the information.
   The UART performs all the tasks, timing, parity checking,
    etc. needed for the communication. The only extra devices
    attached are line driver chips capable of transforming the
    TTL level signals to line voltages and vice versa.



                                                          46
     UART types

   Serial communication on PC compatibles started with the 8250 UART in the
    IBM XT. In the years after, new family members were introduced like the
    8250A and 8250B revisions and the 16450.
   The last one was first implemented in the AT. The higher bus speed in this
    computer could not be reached by the 8250 series. The differences between
    these first UART series were rather minor. The most important property
    changed with each new release was the maximum allowed speed at the
    processor bus side.
   The 16450 was capable of handling a communication speed of 38.4 kbs
    without problems. The demand for higher speeds led to the development of
    newer series which would be able to release the main processor from some of
    its tasks.
   The main problem with the original series was the need to perform a software
    action for each single byte to transmit or receive. To overcome this problem,
    the 16550 was released which contained two on-board FIFO buffers, each
    capable of storing 16 bytes. One buffer for incomming, and one buffer for
    outgoing bytes.

                                                                             47
   This 40-pin Dual Inline Package (DIP) chip is a
    variation of the National Semiconductor NS16550D
    UART chip.




                                                   48
The Serial Connection
   The external connector for a serial port can be either
    9 pins or 25 pins. Originally, the primary use of a
    serial port was to connect a modem to your
    computer. The pin assignments reflect that. Let's take
    a closer look at what happens at each pin when a
    modem is connected.




                                                      49
Close-up of 9-pin and 25-pin serial connectors




                                                 50
9-pin Connector

1.   Carrier Detect - Determines if the modem is
     connected to a working phone line.
2.   Receive Data - Computer receives information
     sent from the modem.
3.   Transmit Data - Computer sends information to
     the modem.
4.   Data Terminal Ready - Computer tells the modem
     that it is ready to talk.
5.   Signal Ground - Pin is grounded.


                                                51
6.   Data Set Ready - Modem tells the computer that it
     is ready to talk.
7.   Request To Send - Computer asks the modem if it
     can send information.
8.   Clear To Send - Modem tells the computer that it
     can send information.
9.   Ring Indicator - Once a call has been placed,
     computer acknowledges signal (sent from modem)
     that a ring is detected.


                                                   52
25-pin Connector
1.   Not Used
2.   Transmit Data - Computer sends information to
     the modem.
3.   Receive Data - Computer receives information
     sent from the modem.
4.   Request To Send - Computer asks the modem if it
     can send information.
5.   Clear To Send - Modem tells the computer that it
     can send information.
6.   Data Set Ready - Modem tells the computer that it
     is ready to talk.

                                                   53
7.    Signal Ground - Pin is grounded.
8.    Received Line Signal Detector - Determines if the
      modem is connected to a working phone line.
9.    Not Used: Transmit Current Loop Return (+)
10.   Not Used
11.   Not Used: Transmit Current Loop Data (-)
12.   Not Used
13.   Not Used
14.   Not Used

                                                   54
15.   Not Used
16.   Not Used
17.   Not Used
18.   Not Used: Receive Current Loop Data (+)
19.   Not Used
20.   Data Terminal Ready - Computer tells the modem
      that it is ready to talk.
21.   Not Used



                                                 55
22.   Ring Indicator - Once a call has been placed,
      computer acknowledges signal (sent from modem)
      that a ring is detected.
23.   Not Used
24.   Not Used
25.   Not Used: Receive Current Loop Return (-)




                                                 56
Introduction to How USB Ports Work
   Just about any computer that you buy today
    comes with one or more Universal Serial
    Bus connectors on the back. These USB
    connectors let you attach everything from
    mice to printers to your computer quickly and
    easily. The operating system supports USB as
    well, so the installation of the device drivers is
    quick and easy, too. Compared to other ways
    of connecting devices to your computer
    (including parallel ports, serial ports and
    special cards that you install inside the
    computer's case), USB devices are incredibly
    simple!
                                                   57
58
What is USB?
   Anyone who has been around computers for
    more that two or three years knows the
    problem that the Universal Serial Bus is trying
    to solve -- in the past, connecting devices to
    computers has been a real headache!
       Printers connected to parallel printer ports, and most
        computers only came with one. Things like Zip
        drives, which need a high-speed connection into the
        computer, would use the parallel port as well, often
        with limited success and not much speed.




                                                          59
   Modems used the serial port, but so did some
    printers and a variety of odd things like Palm Pilots
    and digital cameras. Most computers have at most
    two serial ports, and they are very slow in most
    cases.
   Devices that needed faster connections came with
    their own cards, which had to fit in a card slot inside
    the computer's case. Unfortunately, the number of
    card slots is limited and you needed a Ph.D. to install
    the software for some of the cards.




                                                       60
   The goal of USB is to end all of these
    headaches. The Universal Serial Bus gives you
    a single, standardized, easy-to-use way to
    connect up to 127 devices to a computer.
    Each device can consume up to a maximum of
    6 megabits per second (Mbps) of bandwidth,
    which is fast enough for the vast majority of
    peripheral devices that most people want to
    connect to their machines.
   Just about every peripheral made now comes
    in a USB version. A sample list of USB devices
    that you can buy today includes:

                                               61
   Printers
   Scanners
   Mice
   Joysticks
   Flight yokes
   Digital cameras
   Web cams
   Scientific data acquisition devices
   Modems
   Speakers
   Telephones
   Video phones
   Storage devices such as Zip drives
   Network connections                   62
   Connecting a USB device to a computer is
    simple -- you find the USB connector on the
    back of your machine and plug the USB
    connector into it.




                                              63
   The rectangular socket is a typical USB socket on the
    back of the computer.




                                                        64
   A typical USB connector for a device, called an "A"
    connection




                                                          65
   If it is a new device, the operating system
    auto-detects it and asks for the driver disk. If
    the device has already been installed, the
    computer activates it and starts talking to it.
    USB devices can be connected and
    disconnected at any time.
   Many USB devices come with their own built-in
    cable, and the cable has an "A" connection on
    it. If not, then the device has a socket on it
    that accepts a USB "B" connector.


                                                66
   A typical "B" connection




                               67
   The USB standard uses "A" and "B"
    connectors to avoid confusion:
       "A" connectors head "upstream" toward the computer.
       "B" connectors head "downstream" and connect to
        individual devices.
   By using different connectors on the upstream
    and downstream end, it is impossible to ever
    get confused -- if you connect any USB cable's
    "B" connector into a device, you know that it
    will work. Similarly, you can plug any "A"
    connector into any "A" socket and know that it
    will work.

                                                          68
Running Out of Ports?
   Most computers that you buy today come with
    one or two USB sockets. With so many USB
    devices on the market today, you easily run
    out of sockets very quickly. For example, on
    the computer that I am typing on right now, I
    have a USB scanner, a USB Digital camera and
    a USB mouse. My computer has only two USB
    connectors on it, so the obvious question is,
    "How do you hook up all the devices?"



                                              69
   The easy solution to the problem is to buy an
    inexpensive USB hub. The USB standard
    supports up to 127 devices, and USB hubs are
    a part of the standard.




                                              70
   A typical USB four-port hub accepts 4 "A" connections.




                                                        71
   A hub typically has four new ports, but may
    have many more. You plug the hub into your
    computer, and then plug your devices (or
    other hubs) into the hub. By chaining hubs
    together, you can build up dozens of available
    USB ports on a single computer.
   Hubs can be powered or unpowered. As you
    will see on the next page, the USB standard
    allows for devices to draw their power from
    their USB connection.


                                               72
   Obviously, a high-power device like a printer or scanner
    will have its own power supply, but low-power devices
    like mice and digital cameras get their power from the
    bus in order to simplify them. The power (up to 500
    milliamps at 5 volts) comes from the computer. If you
    have lots of self-powered devices (like printers and
    scanners), then your hub does not need to be powered
    -- none of the devices connecting to the hub needs
    additional power, so the computer can handle it. If you
    have lots of unpowered devices like mice and cameras,
    you probably need a powered hub. The hub has its own
    transformer and it supplies power to the bus so that the
    devices do not overload the computer's supply.

                                                        73
The Universal Serial Bus has the following
features:

   The computer acts as the host.
   Up to 127 devices can connect to the host,
    either directly or by way of USB hubs.
   Individual USB cables can run as long as 5
    meters; with hubs, devices can be up to 30
    meters (six cables' worth) away from the host.
   The bus has a maximum data rate of 12
    megabits per second.




                                               74
   Any individual device can request up to 6
    Mbps (obviously, you cannot really have more
    than one device requesting 6 Mbps or you
    would exceed the 12-Mbps maximum for the
    bus).
   A USB cable has two wires for power (+5 volts
    and ground) and a twisted pair of wires to
    carry the data.
   On the power wires, the computer can supply
    up to 500 milliamps of power at 5 volts.

                                              75
   Low-power devices (such as mice) can draw
    their power directly from the bus. High-power
    devices (such as printers) have their own
    power supplies and draw minimal power from
    the bus. Hubs can have their own power
    supplies to provide power to devices
    connected to the hub.
   USB devices are hot-swappable, meaning
    you can plug them into the bus and unplug
    them any time.
   Many USB devices can be put to sleep by the
    host computer when the computer enters a
    power-saving mode.
                                               76
   The devices connected to a USB port rely on
    the USB cable to carry power and data.
   Inside a USB cable: There are two wires for
    power -- +5 volts (red) and ground (brown) --
    and a twisted pair (yellow and blue) of wires
    to carry the data. The cable is also shielded.




                                               77
   When the host powers up, it queries all of the
    devices connected to the bus and assigns each
    one an address. This process is called
    enumeration -- devices are also enumerated
    when they connect to the bus. The host also
    finds out from each device what type of data
    transfer it wishes to perform:




                                               78
   Interrupt - A device like a mouse or a
    keyboard, which will be sending very little
    data, would choose the interrupt mode.
   Bulk - A device like a printer, which receives
    data in one big packet, uses the bulk transfer
    mode. A block of data is sent to the printer (in
    64-byte chunks) and verified to make sure it is
    correct.
   Isochronous - A streaming device (such as
    speakers) uses the isochronous mode. Data
    streams between the device and the host in
    real-time, and there is no error correction.
                                                79
   The host can also send commands or query
    parameters with control packets.
   As devices are enumerated, the host is
    keeping track of the total bandwidth that all of
    the isochronous and interrupt devices are
    requesting.
   They can consume up to 90 percent of the 12
    Mbps of bandwidth that is available. After 90
    percent is used up, the host denies access to
    any other isochronous or interrupt devices.
    Control packets and packets for bulk transfers
    use any bandwidth left over (at least 10
    percent).

                                                 80
   The Universal Serial Bus divides the available
    bandwidth into frames, and the host controls
    the frames. Frames contain 1,500 bytes, and a
    new frame starts every millisecond. During a
    frame, isochronous and interrupt devices get a
    slot so they are guaranteed the bandwidth
    they need. Bulk and control transfers use
    whatever space is left.




                                               81
   The USB 2.0 spec promises a speed increase
    by a factor of 10 or 20, while maintaining
    backward compatibility with older devices and
    using the same cables. This sort of speed will
    make it possible to connect almost anything to
    your computer via USB, including external
    hard drives and video cameras.
   Speed of USB 480Mbps




                                               82

								
To top