Sie sind auf Seite 1von 139

Communications Protocols

One way to think of Communications


Protocols is a standard procedure for
regulating data transmission.
Communication is typically between
computers, or some electronic devices.



Communications Protocols
All communications between devices require that the devices
agree on the format and characteristics of the data.

The set of rules defining these is called a protocol.

The communications protocol must define the following:
Rate of transmission (in baud or bps)
Whether transmission is to be synchronous or asynchronous
Whether data transmission is half-duplex or full-duplex mode
Ways to encode and decode data
Signal levels
Dynamic Signal Characteristics (T
r
, T
f
, PW, etc.)
Handshaking techniques (#of signals, timing, signal levels, etc.)
I nterrupt System
Hardware used in the system.

Communications Protocols

In addition, protocols can include sophisticated
techniques for detecting and recovering from
transmission errors (techniques such as Reed-
Solomon codes, BCH codes, the binary Golay
code, a binary Goppa code, a Viterbi decoder
and more).

Protocols can also describe encoding /
decoding data and handshaking techniques.

Before discussing any specific
protocols, first lets define a standard

Standards
WHAT IS A STANDARD
An agreed upon set of rules describing both the structure and
the operation characteristics of a communication technique.
They are created by organizations representing many industrial
segments from both a regulatory position as well as a
commercial position.
Examples of organizations are
Electronics Industry Alliance (EIA) (RS). (One of a set of standards
from the Electronics Industries Association for hardware devices and
their interfaces - RS-232 is a well-known standard for transmitting
serial data by wire.)
Institute of Electrical and Electronic Engineers (IEEE): Example of a
standard from IEEE is the GPIB - IEEE 488
International Standards Organization (IS0)
Why Have Standards
Compatibility among devices from different
manufacturers.
Standardization of devices, driving cost down
Helps reduced design time/cost.
Users know what they are getting in terms of
operational performance NO SURPRISES


Standards In Bus Structures
or Communications Protocols
Several structures in use today.

Structures evolve because requirements
change as technology changes.

Different structures required for different
applications.




Bus Structures in
Use Today

Parallel/Serial Name of Bus Standards Group Name of Bus Number of wires

P VME
P PCI Peripheral Communication Interface 4
S USB Universal Serial Bus
S FIREWIRE IEEE 1394
P GPIB IEEE 488.2
S RS232C EIA
S RS422 EIA
S RS423 EIA
MECH RS449 EIA
S RS485 EIA
S CAN Controller Area Network
S Mil Std 1553 Military Communication bus
S IIC Inter Integrated Circuits 2
S SPI Serial Peripheral Interface 4
S MICROWIRE
S MAXIM 3-WIRE 3
S MAXIM 1-WIRE 1 (if gnd provided)
S SSI Synchronous Serial Interface
P SCSI Small Computer Systems Interface 8 or 16 bit bus
ISA Industry Standard Architecture
EISA Extended Industry Standard Arch.
VXI
PC104


**This is not all inclusive, rather only a sample.
Precautions
Always be cautious about buying a device
or product that advertise NEAR specific
BUS performance characteristics.
The specific characteristic you want will
probably not be available.

Now lets look at some
examples of Specific
Communication Protocols
Protocol for connecting hardware together

Parallel Structure

Serial Structure

Developed by manufacturers like HP





Requirements
Many times it is required to interconnect
many devices to one system on a single bus
10 to 20 devices.
If each was to be handled by a single C
port, this would require extensive I/O on the
computer.

Requirements
The alternative:
Use a bus that has some established
operation that allows the C to I/F with
minimal I/O.
Possible Solutions
Several structures or protocols would lend
themselves to satisfy this requirement:
Parallel structure IEEE 488 Standard bus
Serial Controller Area Network (CAN bus)
Serial USB
Serial Mil Std 1553 Bus
Serial Firewire IEEE 1384
However some are more efficient and have
the necessary features already designed in.
IEEE 488
We will first look at a solution that is most
related to Data Acquisition system
Developed by HP as an 8 bit parallel, byte
serial I/F bus to overcome the problem of
lack of standardization
It is most efficient to handle a complex
hardware arrangement.
IEEE History
The IEEE-488 bus was developed to connect and
control programmable instruments.
It would provide a standard interface for
communication between instruments from
different sources.
Hewlett-Packard originally developed the
interfacing technique, and called it HP-IB.
The interface quickly gained popularity in the
computer industry because the interface was so
versatile.
The IEEE committee renamed it GPIB (General
Purpose interface Bus).
IEEE 488
Purpose of this protocol is to provide a
standardized parallel communication
method to connect 2 to 15 devices to
enhance data transfer.
IEEE-488 Overview
Almost any instrument can be used with the
IEEE-488 specification, because it says nothing
about the function of the instrument itself, or
about the form of the instrument's data.
The specification defines a separate component,
the interface device, that can be added to the
instrument.
The signals passing into the interface from the
IEEE-488 bus and from the instrument are
defined in the standard.
The instrument does not have complete control
over the interface. Often the bus controller tells
the interface what to do.
The Active Controller performs the bus control
functions for all the bus instruments.

I EEE 488 Features
IEEE 488 is a cable based bus with a special connector which
allows several instruments to be connected in a star or linear
configuration or in any combination.
Each cable end has a combined male and female connector to
allow parallel connection of cables at any device.
Some of the key features of the IEEE 488 interface are:
- Up to 15 devices may be connected to one bus.
- Total bus length may be up to 20m and the distance
between devices may be up to 2m.
- One byte (8 bit) of digital information is sent in
parallel each time.
- Message transactions are hardware handshake using
special bus lines.
- Maximum data rate is 1 Mbyte/s.
(8 Mbytes with HS488 bus)

I EEE 488 Features
The limitations in maximum distance and
number of units may be avoided by using
special units - bus extenders, bus expanders
- from various companies.
National Instruments suggested a new
transfer protocol HS488 which allows up to
8 Mbyte/s transfer rate on the usual GPIB-
cable.

IEEE 488 Configuration
Is a 24 wire bus that has
8 control lines
8 data lines
8 ground and shields
Specific mechanical connection (24 pin
connector)
Operates at 500KHz.
8 bit wide data bus

IEEE488 Connector Configuration



IEEE488 logic
Signal drivers must be open collector logic
which allows for a parallel, multidrop,
connection of all devices.
Logical TRUE and data 1 is defined for
voltages <0.8V and FALSE, data 0 for
>+2V (ca. TTL-levels).
IEEE488 System Controller
and Active Controller
At power-up time, the IEEE-488 interface that
is programmed to be the System Controller
becomes the Active Controller in charge.
The System Controller has several unique
capabilities including the ability to send
Interface Clear (IFC) and Remote Enable
(REN) commands.
IFC clears all device interfaces and returns
control to the System Controller.
REN allows devices to respond to bus data
once they are addressed to listen.
The System Controller may optionally Pass
Control to another controller, which then
becomes Active Controller.
IEEE488 Listeners, Talkers and Controllers
There are 3 types of devices that can be
connected to the IEEE-488 bus (Listeners,
Talkers, and Controllers).

Master
Slave Slave
IEEE488 Listeners, Talkers and Controllers
The Active Controller may pass
control to another controller which in
turn can pass it back or on to another
controller.
A Listener is a device that can receive
data from the bus when instructed by
the controller.
A Talker transmits data on to the bus
when instructed.
The Controller can set up a talker and
a group of listeners so that it is possible
to send data between groups of devices
as well.

IEEE488 Listeners, Talkers and Controllers
Some devices include more than one of
these functions.
The standard allows a maximum of 15
devices to be connected on the same
bus. A minimum system consists of one
Controller and one Talker or Listener
device (i.e., a microcontroller with an
IEEE-488 interface and a voltmeter with
an IEEE-488 interface).
It is possible to have several Controllers
on the bus but only one may be active
at any given time.

IEEE488 Data Lines
The lines DIO1 through DIO8 are used to transfer
addresses, control information and data.

The formats for addresses and control bytes are
defined by the IEEE 488 standard. Data formats
are undefined and may be ASCII (with or without
parity) or binary.

DIO1 is the Least Significant Bit (note that this
will correspond to bit 0 on most computers).

IEEE488 Handshake Lines
Three lines asynchronously control the transfer of
message bytes between devices.

The process is called a 3-wire interlocked handshake.
This handshaking process guarantees that the bytes on
the data lines are sent and received without any
transmission errors and is one of the unique features of
the IEEE-488 bus

IEEE488 Handshake Lines
The three handshake lines (NRFD, NDAC, DAV) control
the transfer of message bytes among the devices and
form the method for acknowledging the transfer of data.
These lines are identified as:

NRFD (Not Ready for Data) handshake line is asserted by a
Listener (pulled low) to indicate it is not yet ready for the next data
or control byte. Note that the Controller will not see NRFD
released (i.e., ready for data) until all devices have released it.

NDAC (Not Data Accepted) handshake line is asserted by a
Listener to indicate it has not yet accepted the data or control byte
on the data lines. Note that the Controller will not see NDAC
released (i.e., data accepted) until all devices have released it.

DAV (Data Valid) handshake line is asserted (pulled low) by the
Talker to indicate that a data or control byte has been placed on
the data lines and has had the minimum specified stabilizing time.
The byte can now be safely accepted by the devices.

IEEE488 Handshaking
The handshaking process is outlined as follows: When
the Controller or a Talker wishes to transmit data on
the bus, it sets the DAV line high (data not valid), and
checks to see that the NRFD and NDAC lines are both
low, and then it puts the data on the data lines. When
all the devices that can receive the data are ready,
each releases its NRFD (not ready for data) line. When
the last receiver releases NRFD, and it goes high, the
Controller or Talker takes DAV low indicating that valid
data is now on the bus.

In response each receiver (listner) takes NRFD low
again to indicate it is busy and releases NDAC (not data
accepted) when it has received the data. When the last
receiver (listner) has accepted the data, NDAC will go
high and the Controller or Talker can set DAV high
again to transmit the next byte of data.
IEEE488 Handshaking
Note that if after setting the DAV line high, the
Controller or Talker senses that both NRFD
and NDAC are high, an error will occur. Also if
any device fails to perform its part of the
handshake and releases either NDAC or NRFD,
data cannot be transmitted over the bus.
Eventually a timeout error will be generated.

The speed of the data transfer is controlled by
the response of the slowest device on the bus,
for this reason it is difficult to estimate data
transfer rates on the IEEE-488 bus as they are
always device dependent.

IEEE488 Operation


Master Slave Slave
IEEE488 Operation
The following block diagram depicts bus
operation
Master
Listner
Listner
Listner
Listner Talker
Listner
Start
Master Assigns
Talker
Talker sends
DATA VALID
command (DAV)
Talker puts data on data bus
Listeners configure
data bus as inputs
Talker configures
data bus as output
Master gives up
bus to the talker
Master Assigns
Listeners
As each Listener receives data, it
acknowledges that it ahs read the data
When last Listener receives data, it
signals the Talker
Is there more
data??
Talker puts new data on
Bus
Talker indicates
data is valid
Talker notifies Master that data
exchange is complete
Master takes over bus
Master assigns Talker and Listeners
and cycle repeats
End
No
Yes
IEEE488 Operation
See timing diag next slide
HANDSHAKE

Handshake Process
Data byte
Data byte DIO1-8
DAV
valid
valid
not valid
NRFD
not ready
All
ready
All
ready
NDAC
All
accepted
All
accepted
not accepted
not accepted

Note: No time scale shown; asynchronous transmission.
CONTROL SIGNALS

IEEE488 Interface Management Lines
Interface Management Lines
The five interface management lines (ATN, EOI, IFC, REN, SRQ)
manage the flow of control and data bytes across the interface.

ATN (Attention) signal is asserted by the Controller to
indicate that it is placing an address or control byte on the
data bus. ATN is released to allow the assigned Talker to place
status or data on the data bus. The Controller regains control
by reasserting ATN; this is normally done synchronously with
the handshake to avoid confusion between control and data
bytes.

EOI (End or Identify) signal has two uses. A Talker may assert
EOI simultaneously with the last byte of data to indicate end-
of-data. The Controller may assert EOI along with ATN to
initiate a parallel poll. Although many devices do not use
parallel poll, all devices should use EOI to end transfers
(many currently available ones do not).

IFC (Interface Clear) signal is asserted only by the System
Controller in order to initialize all device interfaces to a known
state. After releasing IFC, the System Controller is the Active
Controller.
IEEE488 Interface Management Lines
REN (Remote Enable) signal is asserted only by
the System Controller. Its assertion does not place
devices into remote control mode; REN only
enables a device to go into remote mode when
addressed to listen. When in remote mode, a
device should ignore its local front panel controls.

SRQ (Service Request) line is like an interrupt: it
may be asserted by any device to request the
Controller to take some action. The Controller
must determine which device is asserting SRQ.
The requesting device releases SRQ when it is
serviced.
Service Request (Interrupt)
When a device on the IEEE 488 bus
requests service, it does so through an
interrupt-like activity using the SRQ line
The controller reacts to this by talking to the
device and providing the necessary service
Depending on how many devices are on the
bus, different techniques are employed.
Service Request (Interrupt)
If there are fewer than 9 devices, typically
each device is assigned one of the data lines
as a interrupt response.
The controller does a parallel poll in
which the data bus is viewed and the
interrupting equipment indicates via the
data line assigned to it.
Service Request (Interrupt)
If there are >8 devices, the controller must
do a serial poll.
A serial poll is one in which the controller
interfaces with each device, one at a time, to
identify the cause of the interrupt.
Typically a slower process

IEEE488 Summary
The IEEE-488.1 standard greatly simplified the
interconnection of programmable instruments by clearly
defining mechanical, hardware, and electrical protocol
specifications.

For the first time, instruments from different manufactures
were connected by a standard cable.

This standard does not address data formats, status
reporting, message exchange protocol, common
configuration commands, or device specific commands.

The IEEE-488.2 standard enhances and strengthens the
IEEE-488.1 standard by specifying data formats, status
reporting, error handling, controller functionality, and
common instruments commands.

It focuses mainly on the software protocol issues and thus
maintains compatibility with the hardware- oriented IEEE-
488.1 standard. IEEE-488.2 systems tend to be more
compatible and reliable.

IEEE488 Connector Configuration



IEEE488 Connector Configuration
1 13
2 14
3 15
4 16
5 17
6 18
7 19
8 20
9 21
10 22
11 23
12 24
DIO1
DIO2
DIO3
DIO4
EOI
DAV
NRFD
NDAC
IFC
SRQ
ATN
SHIELD
DIO5
DIO6
DIO7
DIO8
REN
GND (Twisted pair with DAV)
GND (Twisted Pair with NRFD)
GND (Twistedd Pair with NDAC)
GND (Twisted Pair with IFC)
GND (Twisted Pair with SRQ)
GND (Twisted Pair with ATN)
Signal Ground
50
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.
51
Office
(opt)
USB2.0
Monitor
2-4Gbps
Office
(core)
etc
10/100/1000
Ethernet
802.11x
INTERFACING COMPONENTS
52
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

53
A typical parallel port on the back of your computer
54
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.



55
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.
56

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.


57

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.


58


Parallel DB 25 pin
Centronics pin
59
Parallel printer cable
Line
DB 25 male
(computer)
C
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
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
60
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 +
61

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
62

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.
63
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.

64
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.

65
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.

66
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.

67
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.

68
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.

69
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.

70
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.

71
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.

72
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.

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


74

Newer Parallel Ports 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).

75

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.

76
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.

77

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.

78

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.

79

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.
80

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.

81
LPT Addresses in the BIOS Data Area
Start Address
Function
0000:0408 LPT1's Base
Address

0000:040A LPT2's Base
Address

82
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.

83
Two serial ports on the back of a PC

84

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.
85
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.
86
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













































































D
E
C

M
M
J

p
i
n

a
s
s
i
g
m
e
n
t























































































































87

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.

88

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.

89
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.
90
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

Figure 1.0
Connect
or 1
Connect
or 2
Function
2 3
R
x


Tx
3 2 Tx


R
x
5 5
Signal
ground
91
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.
92
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.

93
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.

94
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.
95

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


96
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.
97
Close-up of 9-pin and 25-pin serial connectors

98
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.

99

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.

100
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.

101

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

102

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

103

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 (-)

104
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!

105
106
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.

107

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.

108

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:

109

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

110

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.

111

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


112

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

113

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.

114

A typical "B" connection

115

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.

116
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?"
117

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.

118

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


119

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.

120

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.

121
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.


122

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.

123

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.

124

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.


125

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:

126

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.

127

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).

128

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.

129
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
Thats
All
Folks

Lecture
CAN
USB
RS 232
What is the
Controller Area Network (CAN)
Controller Area Network (CAN) is a serial
communications network
Originally designed for the automotive industry, but
has also become a very popular bus in industrial
automation as well as other applications.
The CAN bus is primarily used in embedded systems
It is a two-wire, half duplex, high-speed network
system, well suited for high speed applications using
short messages.
Its robustness, reliability and large following in the
semiconductor industry are some of the benefits with
CAN.
It is a broadcast message transmission system
Broadcast

CAN Applications
Industrial applications
Marine Control and Navigation systems
Elevators
Machine tools
Toys
Copiers
Medical equipment
Agricultural machinery
Factory automation
Etc.
Thats
All
Folks

Das könnte Ihnen auch gefallen