Download - 49 Hardware Interfacing
-
7/27/2019 49 Hardware Interfacing
1/42
SEMINAR REPORT
ON
HARDWARE INTERFACING
C.U.SHAH COLLEGE OF ENGINEERING AND
TECHNOLOGY
WADHWAN CITY 363030
-
7/27/2019 49 Hardware Interfacing
2/42
WADHWAN CITY
DIST: SURENDRANAGAR
CERTIFICATE
This is to certify that Mr. / Ms. BHAVESH B. SONI
is / are studying in Sem VI of B.E. Information Technology having
Roll No 49 has / have completed his / her / their seminar on the
following topic successfully.
Topic Name: HARDWARE INTERFACING
Staff Incharge Head of Dept.
Mr. HARDIK KOTHARI
(Miss Saroj Bodar)
Date : ___________
-
7/27/2019 49 Hardware Interfacing
3/42
SEMINAR REPORT
ON
HARDWARE INTERFACING
Submitted By:
Bhavesh Soni
Guided By:
Mr. Hardik Kothari
(CE Dept)
HOD
Miss. Saroj Bodar
(IT Dept)
C.U. SHAH COLLEGE OF ENGINEERING AND
TECHNOLOGY
WADHWAN CITY 363030
-
7/27/2019 49 Hardware Interfacing
4/42
ACKNOWLEDGEMENT
I hereby thankfully appreciate all those who have been a grant support to me for
accomplishing my work.
I gratefully thank my seminar guide Mr. Hardik Kothari who helped me immensely in
completing my seminar.
I am also indebted to Miss. Saroj Bodar without motivation of which this seminar would
have never been a reality.
I would also like to thank Miss. Vanita Suthar for helping me in defining the aim of my
seminar and guiding me for about this topic.
-
7/27/2019 49 Hardware Interfacing
5/42
INDEX
1. What is an interface 1
1.1 What is hardware interfacing 1
2. Printer port 2
2.1 Pin Assignment 32.2 Introduction to parallel port 4
2.3 Hardware properties 5
2.4 Centronics 72.5 Port addresses 8
2.6 Program to obtain addresses of printer port 9
2.7 Parallel port programming considerations 102.8 Software registers-standard parallel port (spp) 10
2.9 Parallel port modes in bios 122.10 How to use parallel port output capabilities
132.10.1 How to calculate your own values to send to program 13
2.11 controlling some real life electronics 14
2.11.1 Circuit to operate DC devices 142.11.2 Circuit to operate AC devices 14
2.12 PC to PC file transfer 15
2.12.1 Objective 152.12.2 Description 15
2.12.3 Requirements 15
2.12.4 Details 16
3. Serial port 17
3.1 The serial connection 18
3.1.1 Rs-232 serial (com) pc port connector db-9 183.1.2 Rs-232 serial (com) pc port connector db-25 19
3.1.3 D type 9 pin to 9 pin serial cable 19
3.1.4 D type 25 pin to 9 pin serial cable 203.1.5 D type 9 pin and d type 25 pin connectors 20
3.2 Pin functions 21
3.3 Port addresses & Irq's 21
3.4 Com port addresses in the bios data area 21
4. USB Port 22
4.1 What is USB?224.2 Running out of ports 254.3 How USB ports work 27
4.4 USB 2.0 284.5 USB Converter 29
-
7/27/2019 49 Hardware Interfacing
6/42
4.5.1 USB to Serial Converter 29
4.5.2 USB to Parallel Converter 29
4.5.3 USB to PS/2 and ADB converter 294.5.4 USB 2.0 to IDE/ATAPI Converter 30
4.5.5 USB to SCSI-2 Converter 30
4.5.6 USB to IRDA Converter 304.5.7 USB to Game port Converter 30
4.6 Connect 4 serial devices to your computer 30
4.6.1 Features31
4.7 USB cables data and extension 31
4.7.1 USB Link Cable 314.7.2 USB 2.0 Link Cable 314.7.3 USB Extension Cable 314.7.4 USB 2.0 Extension Cable 324.7.5 USB Network Cable 32
4.8 USB hubs 324.8.1 USB 2.0 Ultra Slim 4-Port Hub 32
4.8.2 USB 2.0 4-Port Hub 324.8.3 USB 2-Port Compact Hub 32
4.9 USB computer peripherals 33
4.9.1 Multimedia Keyboard with USB Hub 334.9.2 USB Wireless Mouse 33
4.10 USB Data Storage and Memory Cards 33
4.10.1 40, 60 & 80 GB (2.5 & 3.5 inch) USB 2.0 Hard Drives 334.10.2 USB Flash Drives 33
4.10.3 6-in-1 USB 2.0 Memory Card Reader 33
4.10.4 5-in-1 Memory Card Reader 34
5. Conclusion 35
6. Bibliography 36
-
7/27/2019 49 Hardware Interfacing
7/42
1. WHAT IS AN INTERFACE?
An interface is a system consisting of hardware, software, or both that allows twodissimilar components to interact. Consider, for example, the problem of connecting a
special type of printer system manufactured on the planet Mars with a PC on the Earth.
The manufacturer of the printer has provided complete specifications for the inputsignals, but these specifications unfortunately do not correspond to either the RS-232 port
or the Centronics printer port attached to the PC. To interface this Martian printer with
the earthbound PC, you must do two things. First, you must build suitable hardware thatcan connect the PC to the printer and generate all the signals required by this printer. The
signals generated by the PC should meet the timing as well as the voltage level (or
current level) requirements of the printer. Second, you must provide suitable software
routines and drivers that will translate user commands such as m_print file_name into
signals that the printer will understand.
1.1 WHAT IS HARDWARE INTERFACING?
Hardware interfacing means the interface between computer and any device or circuits.
For interfacing, we pass the voltages from computer hardware.
There are three ways for doing hardware interfacing.
Printer port ( Parallel port )
Serial port
USB port
Ports back to your PC
From these ports, you can pass the voltages and operate any devices or circuits.
You can make programs for hardware interfacing in C, C++, VB, Qbasic, etc language.
The description of these ports is given below:
-
7/27/2019 49 Hardware Interfacing
8/42
2. PRINTER PORT
A PC printer port is an inexpensive and yet powerful platform for implementing projects
dealing with the control of real world peripherals. The printer port provides eight TTL
outputs, five inputs and four bidirectional leads and it provides a very simple means to
use the PC interrupt structure.
It is commonly used for interfacing and easy to operate and to make programs for it.
Printer Data port Status Control
LPT 1 0X3BC 0X3BD 0X3BE
LPT 2 0X378 0X37A 0X37A
LPT 3 0X278 0X27A 0X27A
Machines are assigned a base address for LPT1 of either 0x378 or 0x3bc.
To definitively identify the assignments for a particular machine, use the DOS debug
program to display memory location 0040:0008.
For example:
Debug
-d 0040:0008 L80040:0008 78 03 78 02 00 00 00 00
In above example that LPT1 is at 0x378, LPT2 is at 0x278 and LPT3 and LPT4 are notassigned.
Thus, for this hypothetical machine:
Printer Data port Status Control
LPT 1 0X378 0X379 0X37A
LPT 2 0X278 0X279 0X27A
LPT 3 NONE --- ---
LPT4 NONE --- ---
An alternate technique is used to run Microsoft Diagnostics (MSD.EXE) and review the
LPT assignments.
2.1 PIN ASSIGNMENT: -
-
7/27/2019 49 Hardware Interfacing
9/42
8 output pins accessed via the DATA Port
5 input pins (one inverted) accessed via the STATUS Port
4 output pins (three inverted) accessed via the CONTROL Port
The remaining 8 pins are grounded
PARALLEL PRINTER CONNECTOR DB-25
1 ------------------------------- > STROBE *
2 ------------------------------- > DATA 0
3 ------------------------------- > DATA 1
4 ------------------------------- > DATA 25 ------------------------------- > DATA 3
6 ------------------------------- > DATA 4
7 ------------------------------- > DATA 58 ------------------------------- > DATA 6
9 ------------------------------- > DATA 7
10< ------------------------------ ACK *11< ------------------------------ BUSY
12< ------------------------------ PAPER END
13 -------------------------------- SLCT (select)14 ----------------------------- > AUTOFEED *
15< ------------------------------ ERROR *
16 ------------------------------->INITIALIZE PRINTER *
17 -------------------------------- SLCTIN (select in)18 thru 25 --------------------- GND
Note!! * Denotes an active low signal.
Output pins
Input pins
Control pins
25-way Female D-Type Connector
-
7/27/2019 49 Hardware Interfacing
10/42
There are eight outputs on the Data port and four additional outputs on the low nibble of
the Control port. /Select In, Init, /Auto feed and /Strobe.
With /Select In, the in refers to the printer. For normal printer operation, The PC exerts
a logic Zero to indicate to the printer is selected. The function of INIT was to initialize
the printer, AUTO FEED to advance the paper. In normal printing, STROBE is high. Thecharacter to be printed is output on the Data port and STROBE is momentarily brought
low.
2.2 INTRODUCTION TO PARALLEL PORTS
If you have a printer connected to your computer, there is a good chance that it uses the
parallel. While USB is becoming increasingly popular, the parallel port is still a
commonly used to interface for printers.
Parallel ports can be used to connect a host of popular computer peripherals:
Printers
Scanners
CD burners
External hard drives
Iomega Zip removable drives
Network adapters
Tape backup drives
The Parallel Port is the most commonly used port for interfacing home made projects.
This port will allow the input of up to 9 bits or the output of 12 bits at any one given time,
thus requiring minimal external circuitry to implement many simpler tasks. The port iscomposed of 4 control lines, 5 status lines and 8 data lines. It's found commonly on the
back of your PC as a D-Type 25 Pin female connector. There may also be a D-Type 25
pin male connector. This will be a serial RS-232 port and thus, is a totally incompatibleport.
Printer Port
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,
-
7/27/2019 49 Hardware Interfacing
11/42
1. Compatibility Mode.
2. Nibble Mode. (Protocol not Described in this Document)
3. Byte Mode. (Protocol not Described in this Document)4. EPP Mode (Enhanced Parallel Port).
5. ECP Mode (Extended Capabilities Mode).
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.
Compatibility mode or "Centronics Mode" as it is commonly known can only send data
in the forward direction at a typical speed of 50 Kbytes per second but can be as high as
150+ Kbytes a second. In order to receive data, you must change the mode to either
Nibble or Byte mode. Nibble mode can input a nibble (4 bits) in the reverse direction.
E.g. from device to computer. Byte mode uses the Parallel's bi-directional feature (foundonly on some cards) to input a byte (8 bits) of data in the reverse direction.
Extended and Enhanced Parallel Ports use additional hardware to generate and manage
handshaking. To output a byte to a printer (or anything in that matter) using compatibilitymode, the software must,
1. Write the byte to the Data Port.
2. Check to see is the printer is busy. If the printer is busy, it will not accept any data,
thus any data, which is written, will be lost.
3. Take the Strobe (Pin 1) low. This tells the printer that there is the correct data on the
data lines. (Pins 2-9)
4. Put the strobe high again after waiting approximately 5 microseconds after putting the
strobe low. (Step 3)
This limits the speed at which the port can run at. The EPP & ECP ports get around this
by letting the hardware check to see if the printer is busy and generate a strobe and /or
appropriate handshaking. This means only one I/O instruction need to be performed, thusincreasing the speed. These ports can output at around 1-2 megabytes per second. The
ECP port also has the advantage of using DMA channels and FIFO buffers, thus data can
be shifted around without using I/O instructions.
2.3 HARDWARE PROPERTIES
Below is a table of the "Pin Outs" of the D-Type 25 Pin connector and the Centronics 34
Pin connector. The D-Type 25 pin connector is the most common connector found on theParallel Port of the computer, while the Centronics Connector is commonly found on
-
7/27/2019 49 Hardware Interfacing
12/42
printers. The IEEE 1284 standard however specifies 3 different connectors for use with
the Parallel Port. The first one, 1284 Type A is the D-Type 25 connector found on the
back of most computers. The 2nd is the 1284 Type B which is the 36 pin CentronicsConnector found on most printers.
IEEE 1284 Type C however, is a 36 conductor connector like the Centronics, but smaller.This connector is claimed to have a better clip latch, better electrical properties and is
easier to assemble. It also contains two more pins for signals which can be used to seewhether the other device connected, has power. 1284 Type C connectors are
recommended for new designs, so we can look forward on seeing these new connectors
in the near future.
Pin No (D-
Type 25)
Pin No
(Centronics)SPP Signal
Direction
In/outRegister
Hardware
Inverted
1 1 nStrobe In/Out Control Yes
2 2 Data 0 Out Data
3 3 Data 1 Out Data
4 4 Data 2 Out Data
5 5 Data 3 Out Data
6 6 Data 4 Out Data
7 7 Data 5 Out Data
8 8 Data 6 Out Data
9 9 Data 7 Out Data
10 10 nAck In Status
11 11 Busy In Status Yes
12 12Paper-Out /Paper-End
In Status
-
7/27/2019 49 Hardware Interfacing
13/42
13 13 Select In Status
14 14nAuto-
LinefeedIn/Out Control Yes
15 32nError /nFault
In Status
16 31 nInitialize In/Out Control
17 36nSelect-Printer /
nSelect-In
In/Out Control Yes
18 - 25 19-30 Ground Gnd
Table 1. Pin Assignments of the D-Type 25 pin Parallel Port Connector.
The above table uses "n" in front of the signal name to denote that the signal is activelow. If the printer has occurred an error then this line is low. This line normally is high,
should the printer be functioning correctly. The "Hardware Inverted" means the signal is
inverted by the Parallel card's hardware. Such an example is the Busy line. If +5v (Logic
1) was applied to this pin and the status register read, it would return back a 0 in Bit 7 ofthe Status Register.
The output of the Parallel Port is normally TTL logic levels. The voltage levels are the
easy part. The current you can sink and source varies from port to port. Most ParallelPorts implemented in ASIC, can sink and source around 12mA. However these are just
some of the figures taken from Data sheets, Sink/Source 6mA, Source 12mA/Sink 20mA,
Sink 16mA/Source 4mA, and Sink/Source 12mA. As you can see they vary quite a bit.
The best bet is to use a buffer, so the least current is drawn from the Parallel Port.
2.4 CENTRONICS?
Centronics is an early standard for transferring data from a host to the printer. The
majority of printers use this handshake. This handshake is normally implemented using a
Standard Parallel Port under software control.
2.5 PORT ADDRESSES
The Parallel Port has three commonly used base addresses. These are listed in table 2,
below. 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 laterremoved from Video Cards. They have now reappeared as an option for Parallel Ports
-
7/27/2019 49 Hardware Interfacing
14/42
integrated onto motherboards, upon which their configuration can be changed using
BIOS.
LPT1 is normally assigned base address 378h, while LPT2 is assigned 278h. Howeverthis 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.
Address Notes
3BCh - 3BFh Used for Parallel Ports which were incorporatedon to Video Cards - Doesn't support ECP
addresses
378h - 37Fh Usual Address For LPT 1
278h - 27Fh Usual Address For LPT 2
Table 2 Port Addresses
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, LPT2 & LPT3 to them.BIOS first looks at address 3BCh. If a Parallel Port is found here, it is assigned as LPT1,
and 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 acard 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.
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 and LPT3. Now whataddress 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, LPT2 & LPT3 should not be a worry to people wishing tointerface 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 BIOSassigns addresses to your printer devices, it stores the address at specific locations in
memory, so we can find them.
Start Address Function0000:0408 LPT1's Base Address
0000:040A LPT2's Base Address
0000:040C LPT3's Base Address
0000:040E LPT4's Base Address (Note 1)
Table 3 - LPT Addresses in the BIOS Data Area
-
7/27/2019 49 Hardware Interfacing
15/42
Note 1: Address 0000:040E in the BIOS Data Area may be used as the Extended Bios
Data Area in PS/2 and newer Bioses.
The above table, table 3, shows the address at which we can find the Printer Port's
addresses in the BIOS Data Area. Each address will take up 2 bytes.
The following sample program in C shows how you can read these locations to obtain theaddresses of your printer ports.
2.6 PROGRAM TO OBTAIN ADDRESSES OF PRINTER PORTS
#include
#include
void main(void)
{unsigned int far *ptraddr; /* Pointer to location of Port Addresses */
unsigned int address; /* Address of Port */int a;
ptraddr=(unsigned int far *)0x00000408;
for (a = 0; a < 3; a++)
{address = *ptraddr;
if (address == 0)
printf ("No port found for LPT%d \n", a+1);
else
printf("Address assigned to LPT%d is %Xh\n", a+1,address);
*ptraddr++;
}
}
2.7 PARALLEL PORT PROGRAMMING CONSIDERATIONS
The printer adapter responds to five I/O instructions: two outputs and three inputs. The
output instructions transfer data into two latches whose outputs are presented on the pins
of a 25-pin D-type female connector.
Two of the three input instructions allow the processor to read back the contents of thetwo latches. The third allows the processor to read the real time status of a group of pins
on the connector.
-
7/27/2019 49 Hardware Interfacing
16/42
-
7/27/2019 49 Hardware Interfacing
17/42
Bit 0 Reserved
Table 5 Status Port
The Status Port (base address + 1) is a read only port. Any data written to this port will be
ignored. The Status Port is made up of 5 input lines (Pins 10,11,12,13 & 15), an IRQstatus register and two reserved bits. Please note that Bit 7 (Busy) is an active low input.E.g. if bit 7 happens to show logic 0, this means that there is +5v at pin 11. Likewise with
Bit 2. (nIRQ) If this bit shows a '1' then an interrupt has not occurred.
Offset Name Read/Write Bit No. Properties
Base + 2 Control
Port
Read/Write Bit 7 Unused
Bit 6 Unused
Bit 5 Enable Bi-Directional Port
Bit 4 Enable IRQ Via Ack Line
Bit 3 Select Printer
Bit 2 Initialize Printer (Reset)
Bit 1 Auto Linefeed
Bit 0 Strobe
Table 6 Control Port
The Control Port (base address + 2) was intended as a write only port. When a printer isattached to the Parallel Port, four "controls" are used. These are Strobe, Auto Linefeed,
Initialize and Select Printer, all of which are inverted except Initialize.
2.9 PARALLEL PORT MODES IN BIOS
Today, most Parallel Ports are multimode ports. They are normally software configurable
to one of many modes from BIOS. The typical modes are,
Printer Mode (Sometimes called Default or Normal Modes)
Standard & Bi-directional (SPP) Mode
EPP1.7 and SPP Mode
EPP1.9 and SPP Mode
ECP Mode
ECP and EPP1.7 Mode
ECP and EPP1.9 Mode
-
7/27/2019 49 Hardware Interfacing
18/42
Printer Mode is the most basic mode. It is a Standard Parallel Port in forward mode only.
It has no bi-directional feature, thus Bit 5 of the Control Port will not respond. Standard
& Bi-directional (SPP) Mode is the bi-directional mode. Using this mode, bit 5 of theControl Port will reverse the direction of the port, so you can read back a value on the
data lines.
EPP1.7 and SPP Mode is a combination of EPP 1.7 (Enhanced Parallel Port) and SPP
Modes. In this mode of operation you will have access to the SPP registers (Data, Statusand Control) and access to the EPP Registers. In this mode you should be able to reverse
the direction of the port using bit 5 of the control register. EPP 1.7 is the earlier version of
EPP. This version, version 1.7, may not have the time-out bit.
EPP1.9 and SPP Mode is just like the previous mode, only it uses EPP Version 1.9 this
time. As in the other mode, you will have access to the SPP registers, including Bit 5 of
the control port. However this differs from EPP1.7 and SPP Mode as you should have
access to the EPP Timeout bit.
ECP Mode will give you an Extended Capabilities Port. The mode of this port can then
be set using the ESPs Extended Control Register (ECR). However in this mode from
BIOS the EPP Mode (100) will not be available.
ECP and EPP1.7 Mode and ECP and EPP1.9 Mode will give you an ExtendedCapabilities Port, just like the previous mode. However the EPP Mode in the ESPs ECR
will now be available. Should you be in ECP and EPP1.7 Mode you will get an EPP1.7
Port, or if you are in ECP and EPP1.9 Mode, an EPP1.9 Port will be at your disposal.
The above modes are configurable via BIOS. You can reconfigure them by using your
own software, but this is not recommended. These software registers, typically found at0x2FA, 0x3F0, 0x3F1 etc are only intended to be accessed by BIOS. There is no set
standard for these configuration registers, thus if you were to use these registers, yoursoftware would not be very portable. With today's multitasking operating systems, its
also not a good idea to change them when it suits you.
A better option is to select ECP and EPP1.7 Mode or ECP and EPP1.9 Mode from BIOS
and then use the ESPs Extended Control Register to select your Parallel Port's Mode.The EPP1.7 mode had a few problems in regards to the Data and Address Strobes being
asserted to start a cycle regardless of the wait state, thus this mode if not typically used
now. Best set your Parallel Port to ECP and EPP1.9 Mode.
2.10 HOW TO USE PARALLEL PORT OUTPUT CAPABILITIES
PC parallel port can be very useful I/O channel for connecting your own circuits to PC.
The port is very easy to use when you first understand some basic tricks. This document
tries to show those tricks in easy to understand way.
2.10.1 How to calculate your own values to send to program
-
7/27/2019 49 Hardware Interfacing
19/42
BC547A or
2N2222A
You have to think the value you give to the program as a binary number. Every bit of the
binary number control one output bit. The following table describes the relation of the
bits, parallel port output pins and the value of those bits.
Pin 2 3 4 5 6 7 8 9
Bit D0 D1 D2 D3 D4 D5 D6 D7Value 1 2 4 8 16 32 64 128
For example if you want to set pins 2 and 3 to logic 1 (led on) then you have to output
value 1+2=3. If you want to set on pins 3, 5 and 6 then you need to output value
2+8+16=26. In this way you can calculate the value for any bit combination you want tooutput.
Output pins Data type Code
Pin 2 Data 0 0x01
Pin 3 Data 1 0x02Pin 4 Data 2 0x04
Pin 5 Data 3 0x08
Pin 6 Data 4 0x10
Pin 7 Data 5 0x20
Pin 8 Data 6 0x40
Pin 9 Data 7 0x80
2.11 CONTROLLING SOME REAL LIFE ELECTRONICS
2.11.1 Circuit to operate DC devices
The circuit can be also used for controlling other small loads like powerful LEDS, lampsand small DC motors. Keep in mind that those devices you plan to control directly from
the transistor must take less than 100 mA current.
2.11.2 Circuit to operate AC devices
Device
9v, 12v, 15va
c
bIN4007
Parallel port data
pi
Parallel portground pin
+
-
7/27/2019 49 Hardware Interfacing
20/42
The circuit can handle relays which take currents up to 100 mA. The transistor does the
switching of current and the diode prevents spikes from the relay coil form damaging
your computer (if you leave the diode out, then the transistor and your computer can bedamaged). Since coils (solenoids and relay coils) have a large amount of inductance,
when they are released (when the current is cut off) they generate a very large voltage
spike.
2.12 PC TO PC FILE TRANSFER
2.12.1 Objective
To provide a facility for file transfer between two PCs connected via their parallel printerports.
2.12.2 Description
Although the IBM-PC parallel printer port is intended for output only, there are enough
input lines available for 4-bit I/O, with handshaking, so data bytes can be transferred half
Parallel portdata pi
BC547A or
2N2222A
Parallel portground pin
Inputs
230v (-ve)
Device
230v (+ve)
Structure of Relay
+
6v
c
b
a
IN4007
-
7/27/2019 49 Hardware Interfacing
21/42
at a time. (Most new PCs have a bi-directional parallel printer port, but this is not a
standard feature).
2.12.3 Requirements
This should be implemented as a "master-slave" system with everything being controlledby the local "master" PC. The remote "slave" PC just sits there and does what it is told.
Previous solutions have run under MS-DOS. I think it's about time I had a comprehensive
MS-Windows version, probably with a minimal MS-DOS slave-only version as well for
instances where one of the PCs to be connected is unable to run MS-Windows.
A simple command set must be provided, including
* Change current directory (local & remote)
*Get directory listing (local & remote)
* Fetch remote file
* Send local file
Care would need to be taken that existing files are not overwritten unintentionally and
that there is enough disk space available for a requested transfer.
Possible enhancements include:
* Additional file and directory handling (creation/deletion etc).
* Multiple fetch/send with wildcard expansion
* Data compression
* Data integrity check
2.12.4 Details
With the information provided it is possible to design and build a cable to connect two
IBM-PC-compatible computers via their parallel printer ports and to write software toenable exchange of data between them.
-
7/27/2019 49 Hardware Interfacing
22/42
3. SERIAL PORT
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 ofthe newer systems have done away with the serial port completely in favor of USB
connections, most modems still use the serial port, as do some printers, PDAs and digital
cameras. Few computers have more than two serial ports.
Two serial ports on the back of a PC
The Serial Port is harder to interface than the Parallel Port. In most cases, any device you
connect to the serial port will need the serial transmission converted back to parallel sothat it can be used. This can be done using a UART. On the software side of things, there
are many more registers that you have to attend to than on a Standard Parallel Port. (SPP)
-
7/27/2019 49 Hardware Interfacing
23/42
What are the advantages of using serial data transfer rather than parallel?
1. Serial Cables can be longer than Parallel cables. The serial port transmits a '1' as -3 to
-25 volts and a '0' as +3 to +25 volts where as a parallel port transmits a '0' as 0v and a '1'
as 5v. Therefore the serial port can have a maximum swing of 50V compared to theparallel port, which has a maximum swing of 5 Volts. Therefore cable loss is not going to
be as much of a problem for serial cables as they are for parallel.
2. You don't need as many wires as parallel transmission. If your device needs to be
mounted a far distance away from the computer then 3 core cable (Null Modem
Configuration) is going to be a lot cheaper that running 19 or 25 core cable. However you
must take into account the cost of the interfacing at each end.
3. Infra Red devices have proven quite popular recently. You may have seen many
electronic diaries and palmtop computers which have infra red capabilities build in.
However could you imagine transmitting 8 bits of data at the one time across the roomand being able to (from the devices point of view) decipher which bits are which?
Therefore serial transmission is used where one bit is sent at a time. IrDA-1 (The firstinfra red specifications) was capable of 115.2k baud and was interfaced into a UART.
The pulse length however was cut down to 3/16th of a RS232 bit length to conserve
power considering these devices are mainly used on diaries, laptops and palmtops.
4. Microcontroller's have also proven to be quite popular recently. Many of these have in
built SCI (Serial Communications Interfaces) which can be used to talk to the outside
world. Serial Communication reduces the pin count of these MPU's. Only two pins arecommonly used, Transmit Data (TXD) and Receive Data (RXD) compared with at least 8
pins if you use an 8 bit Parallel method (You may also require a Strobe).
3.1 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. Thepin assignments reflect that. Let's take a closer look at what happens at each pinwhen a modem is connected.
-
7/27/2019 49 Hardware Interfacing
24/42
Close-up of 9-pin and 25-pin serial connectors
3.1.1 RS-232 SERIAL (COM) PC PORT CONNECTOR DB-9
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.
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.
Transmitted and receive data are referenced from the data device and not the modem.
3.1.2 RS-232 SERIAL (COM) PC PORT CONNECTOR DB-251. 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.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
-
7/27/2019 49 Hardware Interfacing
25/42
11. Not Used: Transmit Current Loop Data (-)
12. Not Used
13. Not Used14. Not Used
15. Not Used
16. Not Used17. Not Used
18. Not Used: Receive Current Loop Data (+)
19. Not Used20. Data Terminal Ready - Computer tells the modem that it is ready to talk.
21. Not Used
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 (-)
NOTE!! Current loop technology was supported in the PC and XT interfaces.
Current loop was discontinued when the AT interface was introduced.
Transmitted and receive data are referenced from the data device and not themodem.
3.1.3 D TYPE 9 PIN TO 9 PIN SERIAL CABLE
3.1.4 D TYPE 25 PIN TO 9 PIN SERIAL CABLE
-
7/27/2019 49 Hardware Interfacing
26/42
-
7/27/2019 49 Hardware Interfacing
27/42
Abbreviation Full Name Function
TDTransmit Data
Serial Data Output (TXD)
RD Receive Data Serial Data Input (RXD)
CTSClear to Send This line indicates that the Modem is ready to
exchange data.
DCD
Data CarrierDetect
When the modem detects a "Carrier" from themodem at the other end of the phone line, this
Line becomes active.
DSRData Set
ReadyThis tells the UART that the modem is ready toestablish a link.
DTRData Terminal
ReadyThis is the opposite to DSR. This tells the Modem
that the UART is ready to link.
RTSRequest To
SendThis line informs the Modem that the UART is
ready to exchange data.
RIRing IndicatorGoes active when modem detects a ringing signal
from the PSTN.
3.3 PORT ADDRESSES & IRQ'S
Name Address IRQ
COM 1 3F8 4
COM 2 2F8 3
COM 3 3E8 4
COM 4 2E8 3
3.4 COM PORT ADDRESSES IN THE BIOS DATA AREA
Start Address Function
0000:0400 COM1's Base Address
0000:0402 COM2's Base Address0000:0404 COM3's Base Address
0000:0406 COM4's Base Address
4. USB PORT
-
7/27/2019 49 Hardware Interfacing
28/42
4.1 WHAT IS USB?
A universal serial bus port, introduced around 1997, is the gateway to your computer. It's
used to connect all kinds of external devices, such as external hard drives, printers, mice,scanners and more. There are normally two half-inch long USB ports on the back of
computers built since 1998. Sometimes there are USB ports built into a hatch on the frontof a computer. If you use a USB hub, (example: 4 port hub), you can connect as many as127 devices to a USB port. It can transfer data to a speed of 12 megabits per second, but
those 127 devices have to share that speed. Since USB-compliant devices can draw
power from a USB port only a few power drawing devices can connect at the same time
without the computer system complaining.
In 2003, USB 2.0 connectors were introduced on computers. These transfer data at 480
Mbps. Older USB devices work with USB 2.0 ports, but at 12 Mbps. USB 2.0 devices
also work with older USB ports, again at the lower speed. USB 2.0 is useful for adding
external hard drives like Maxtor drive.
Anyone who has been around computers for more than two or three years knowthe 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.
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.
The goal of USB is to end all of these headaches. The Universal Serial Bus gives you asingle, standardized, easy-to-use way to connect up to 127 devices to a computer.
Just about every peripheral made now comes in a USB version. A sample list of USB
devices that you can buy today includes:
Printers
Scanners
Mice
Joysticks
Flight yokes
-
7/27/2019 49 Hardware Interfacing
29/42
Digital cameras
Web cams
Scientific data acquisition devices
Modems
Speakers
Telephones Video phones
Storage devices such as Zip drives
Network connections
The pin out description and the close-up shot of USB port on CPU Cabinet is given
below. Notice the USB logo at top of it.
USB Socket as seen on Computer Cabinet
Pin out Description on Motherboard
Pin No. Name Description
1 VCC +5voltage (max. 500mAmp)
2 D- Data - (Input to computer)
3 D+ Data + (Output from computer)
4 GND Ground for voltage
The port on motherboard gives the 5volt Output (500mAmp) to power the low voltage
peripherals which can be used with computer without extra power supply like USB
modems or Floppy Drives. For my Sony vaio laptop, I have an external Floppy Driveand CDROM drive which work only on USB ports and not the extra voltage power.
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.
-
7/27/2019 49 Hardware Interfacing
30/42
The rectangular socket is a typical USB socket on the back of a PC.
A typical USB connector, called an "A" connection
If it is a new device, the operating system auto-detects it and asks for the driver disk. Ifthe device has already been installed, the computer activates it and starts talking to it.
USB devices can be connected and disconnected at any time.
-
7/27/2019 49 Hardware Interfacing
31/42
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.
A typical "B" connection
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 isimpossible to ever get confused -- if you connect any USB cable's "B" connectorinto a device, you know that it will work. Similarly, you can plug any "A" connectorinto any "A" socket and know that it will work.
4.2 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. Forexample, on the computer that I am typing on right now, I have a USB printer, a USB
scanner, a USB Web cam and a USB network connection. My computer has only oneUSB connector on it, so the obvious question is, "How do you hook up all the devices?"
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.
-
7/27/2019 49 Hardware Interfacing
32/42
A typical USB four-port hub accepts 4 "A" connections.
-
7/27/2019 49 Hardware Interfacing
33/42
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 empowered. As you will see on the next page, the USB
standard allows for devices to draw their power from their USB connection. Obviously, ahigh-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 tosimplify 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 empowered 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.
4.3 HOW USB PORTS WORK
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.
With USB 2, the bus has a maximum data rate of480 megabits per second.
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.
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 todevices 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.
-
7/27/2019 49 Hardware Interfacing
34/42
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.
When the host powers up, it queries all of the devices connected to the bus and assignseach 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 datatransfer it wishes to perform:
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 errorcorrection.
The host can also send commands or query parameters with control packets.
You can link one USB product to another in an ongoing chain. You dont even need to shut down and restartyour PC to attach or remove a peripheral. Just plug it in! The PC automatically detects the peripheral andstarts up the installation software.
4.4 USB 2.0
The standard for USB version 2.0 was released in April 2000 and serves as anupgrade for USB 1.1.
USB 2.0 (High-speed USB) provides additional bandwidth for multimedia and storage
applications and has a data transmission speed 40 times faster than USB 1.1. To allow asmooth transition for both consumers and manufacturers, USB 2.0 has full forward and
backward compatibility with original USB devices and works with cables and connectors
made for original USB, too.
-
7/27/2019 49 Hardware Interfacing
35/42
Supporting three speed modes (1.5, 12 and 480 megabits per second), USB 2.0 supports
low-bandwidth devices such as keyboards and mice, as well as high-bandwidth ones like
high-resolution Web cams, scanners, printers and high-capacity storage systems. Thedeployment of USB 2.0 has allowed PC industry leaders to forge ahead with the
development of next-generation PC peripherals to complement existing high-performance
PCs. The transmission speed of USB 2.0 also facilitates the development of next-generation PCs and applications. In addition to improving functionality and encouraging
innovation, USB 2.0 increases the productivity of user applications and allows the user to
run multiple PC applications at once or several high-performance peripheralssimultaneously.
4.5 USB CONVERTER
There are too many converters available to operate different devices as below:
4.5.1 USB to Serial Converter
4.5.2 USB to Parallel Converter
4.5.3 USB to PS/2 and ADB converter
4.5.4 USB 2.0 to IDE/ATAPI Converter
The Model UC-232A enables the addition of Com
[Serial] Ports to Windows and Macintosh PCs
having USB capability. Use with newer PCs or Laptopsthat do not have serial ports.
The Model BF-1284 converter enables Parallel IEEE
1284 Devices to be connected to computers featuringthe Universal Serial Bus. Available with 25-pin or 36-pin connector.
The MT-606 Series Converters enable existing PC/AT,PS/2 and Macintosh ADB keyboards, pointing devices,
and barcode scanners to be used on computers with
Universal Serial Bus.
-
7/27/2019 49 Hardware Interfacing
36/42
4.5.5 USB to SCSI-2 Converter
4.5.6 USB to IRDA Converter
4.5.7 USB to Game port Converter
4.6 CONNECT 4 SERIAL DEVICES TO YOUR COMPUTER
4.6.1 Features:
The Key span USB 4-Port Serial Adapter allows 4 serial devices to be connected to a
single USB port. It provides a simple way to add serial ports to a PC without thehassle of installing a serial card, turning off the PC, or configuring IRQs.
The Model UDA200 Converter can be used with HardDrives and CDROMs for portable storage. For
Windows PCs.
The Model BF-660 Converter works with SCSI HardDrives and CDROMS. Works with both Windows
and Macintosh PCs.
The Model BF-120 Converter enables IRDA wireless
data communications through your PCs USB port. The
unit meets all of the requirements of IRDA 1.1.
The Model RM-203 Converter enables the use of olderanalog joysticks and game controllers on newer computers
that only have USB.
-
7/27/2019 49 Hardware Interfacing
37/42
Plugs into a USB port on a PC or Macintosh
Provides four RS-232 male DB9 ports for direct connection to serial devices
Supports data rates up to 230 Kbps per port
Draws its power from the USB connection -- a power adapter is not required
Five year warranty
4.7 USB CABLES DATA AND EXTENSION
4.7.1 USB Link Cable
4.7.2 USB 2.0 Link Cable
4.7.3 USB Extension Cable
4.7.4 USB 2.0 Extension Cable
The Model BF-100C Direct-Link cable is the fastsolution to peer-to-peer file transfer between two
Windows or Apple computers via their USB Ports. Allsoftware and drivers are included with the cable.
The Model BF-7311 Multi-Link cable is the fast solution to
peer-to-peer file transfer between two Windows computers.
Operating at USB 2.0 speeds gives 40 times faster transfertimes than USB 1.1 cables. All software and drivers are
included with the cable.
The Model BF-200C Extension Cable is an active device
that can extend the cable length of any USB device,
without signal loss. Works with both Windows andMacintosh PCs.
-
7/27/2019 49 Hardware Interfacing
38/42
4.7.5 USB Network Cable
4.8 USB HUBS
4.8.1 USB 2.0 Ultra Slim 4-Port Hub
4.8.2 USB 2.0 4-Port Hub
4.8.3 USB 2-Port Compact Hub
4.9 USB COMPUTER PERIPHERALS
4.9.1 Multimedia Keyboard with USB Hub
The Model BF-3000 Extension Cable is an active device
that can extend the cable length of any USB device,without signal loss. Works with both Windows and
Macintosh PCs.
The Model ULK-003 USB-Linq/NET Cable provides an
easy way of connecting a PC or Laptop to an existingnetwork. The connection is made through a USB
connection to a computer already on the network.
Model UH-254. Great for notebooks! Has a super
compact design that can be stored in an unused
PCMCIA slot. The connecting cable tucks away in itsown compartment.
Model UH-204. This USB 2.0 hub features independent overcurrent protection and LED indicators for each port. Can be
operated in bus-powered or self-powered mode. Power
supply included. Backward compatible with USB 1.1devices.
Model UH-102 is a compact 2-port USB hub designed foruse with notebook or desktop computers. It is compatible
with both Windows and Macintosh computers.
-
7/27/2019 49 Hardware Interfacing
39/42
4.9.2 USB Wireless Mouse
4.10 USB Data Storage and Memory Cards
4.10.1 40, 60 & 80 GB (2.5 & 3.5 inch) USB 2.0 Hard Drives
4.10.2 USB Flash Drives
4.10.3 6-in-1 USB 2.0 Memory Card Reader
4.10.4 5-in-1 Memory Card Reader
The Model USBK01 Keyboard can be
used to add two additional USB ports.
The Model UMRF01 Wireless Mouse can be used to
add RF wireless mouse to computer running
Windows.
The HDUSB Series are 40, 60 & 80GB USB 2.0 harddrives built around Maxtor 7200RPM drives. They are
compatible with Windows 98SE, ME, XP and 2000. Turn
any IDE Hard Drive into a portable, high speed, storagedevice. Power Supply and cable included.
The BF-2300 Series USB Flash Drives are available in
32MB, 64MB, 128MB and 256MB sizes.
The FRA3-00 Series Memory Card Reader/Writers are capableof handling Compact Flash, Micro drive, Smart Media,
Multimedia, Memory Stick and Secure Digital Memory Cards.
The unit has a USB 2.0 high speed interface. This pocket-sizedunit has a fold-away USB cable.
-
7/27/2019 49 Hardware Interfacing
40/42
5. CONCLUSION
The FPT-DXX-US Series Memory Card
Reader/Writers are capable of handling CompactFlash, Micro drive, Smart Media, Multimedia and
Secure Digital Memory Cards. The unit also has
16MB or 32MB of built-in Flash Memory. Thispocket-sized unit has a fold-away USB cable.
-
7/27/2019 49 Hardware Interfacing
41/42
Hardware interfacing is very useful to operate various devices which are related to
computer or not. There are three ways to operate different devices.
1. Printer Port
2. Serial Port3. USB Port
Printer port is commonly used to interface devices like printer, scanner, CD burner etc. Itis also used to operate any AC or DC external devices, to operate different circuits
interface between two PCs.
Serial port is also used to interface devices like mouse, keyboard, etc. It is also used to
operate circuits and interface between two PCs.
USB port is most preferable today. It is very useful to operate devices which are operated
by printer & serial port and also operate those devices which are not operated by themwith more speed then printer & serial port. It is also used to interface between two PCs.
6. BIBLIOGRAPHY
-
7/27/2019 49 Hardware Interfacing
42/42
Reference Books:-
Websites:-
www.yahoo.com
www.google.com
http://computer.howstuffworks.com/
http://www.usb.orghttp://www.keyspan.com
http://www.usb-port.com
http://www.serial-port.com
http://www.yahoo.com/http://www.google.com/http://computer.howstuffworks.com/http://www.usb.org/http://www.usb.org/http://www.usb-port.com/http://www.serial-port.com/http://www.yahoo.com/http://www.google.com/http://computer.howstuffworks.com/http://www.usb.org/http://www.usb.org/http://www.usb-port.com/http://www.serial-port.com/