rs232 serial and parallel interfaces. comsats institute of information technology, wah cantt.2 what...
TRANSCRIPT
RS232 Serial and RS232 Serial and Parallel Parallel InterfacesInterfaces
COMSATS Institute of Information Technology, Wah Cantt. 2
What Is a Interface?What Is a Interface?
The point of interaction or The point of interaction or communication between a communication between a computer and any other computer and any other entity, such as a printer or entity, such as a printer or human operatorhuman operator..
COMSATS Institute of Information Technology, Wah Cantt. 3
Types of InterfacesTypes of Interfaces
RS232 nine pin serial portRS232 nine pin serial port Parallel portParallel port USB portUSB port SCSI portSCSI port IEEE 1394IEEE 1394 PCI cards, etc.PCI cards, etc.
COMSATS Institute of Information Technology, Wah Cantt. 4
RS232 9pin Serial PortRS232 9pin Serial Port Has existed for Has existed for
approximately 20 approximately 20 yearsyears
RS232 stands for RS232 stands for Recommended Recommended Standard 232 CStandard 232 C
Used mostly for Used mostly for devices that transmit devices that transmit or receive small or receive small amounts of dataamounts of data
COMSATS Institute of Information Technology, Wah Cantt. 5
What Does Serial Mean?What Does Serial Mean?
The name 'serial' comes from the The name 'serial' comes from the way that a serial port 'serializes' way that a serial port 'serializes' data. That is, it takes a byte of data data. That is, it takes a byte of data and transmits the 8 bits in the byte and transmits the 8 bits in the byte one bit at a time.one bit at a time.
COMSATS Institute of Information Technology, Wah Cantt. 6
How Does It Work?How Does It Work?011011101101110000 00 00 00 00 00
00
00
00
11 11 11 11 11 11
11
11
11
COMSATS Institute of Information Technology, Wah Cantt. 7
Facts About the RS232 Facts About the RS232 PortPort
Data throughput rate of 115KbpsData throughput rate of 115Kbps Most computers have one or two RS232 Most computers have one or two RS232
ports built in to the motherboardports built in to the motherboard More ports can be added by adding an More ports can be added by adding an
adapter card to the computer; These adapter card to the computer; These cards again add one or two extra portscards again add one or two extra ports
All RS232 devices need to have a All RS232 devices need to have a device driver installed on the computer device driver installed on the computer to operate correctlyto operate correctly
COMSATS Institute of Information Technology, Wah Cantt. 8
RS232 SummaryRS232 Summary
In general the RS232 interface is In general the RS232 interface is a fairly slow and complex way to a fairly slow and complex way to connect devices to a computer. connect devices to a computer. The lack of protocol and The lack of protocol and configuration standards for the configuration standards for the interface means that users must interface means that users must manually configure the port for manually configure the port for each new device added.each new device added.
COMSATS Institute of Information Technology, Wah Cantt. 9
The Parallel PortThe Parallel Port
Developed by IBM Developed by IBM to connect PC to a to connect PC to a printerprinter
Probably most Probably most common form of common form of port usedport used
COMSATS Institute of Information Technology, Wah Cantt. 10
Types Parallel PortsTypes Parallel Ports Uni- DirectionalUni- Directional Bi-DirectionalBi-Directional
COMSATS Institute of Information Technology, Wah Cantt. 11
What Does Parallel Mean?What Does Parallel Mean?
Of or relating to the Of or relating to the simultaneous transmission of simultaneous transmission of all the bits of a byte over all the bits of a byte over separate wires:separate wires: a parallel part; a parallel part; a parallel printer.a parallel printer.
COMSATS Institute of Information Technology, Wah Cantt. 12
How Does It Work?How Does It Work?
0110111011011100
0011110011111100
0011110011111100
0011110011111100
0011110011111100 01101110110111
0001101110110111000110111011011100
COMSATS Institute of Information Technology, Wah Cantt. 13
Facts About a Parallel PortFacts About a Parallel Port
The specification allows up to 2MbpsThe specification allows up to 2Mbps The specification allows up to a 10 meter The specification allows up to a 10 meter
cablecable Most PC’s come with one or two parallel Most PC’s come with one or two parallel
ports, as with a serial port, more can be ports, as with a serial port, more can be added if required (1 or 2 only)added if required (1 or 2 only)
All devices require a device driver which is All devices require a device driver which is usually provided by device manufacturerusually provided by device manufacturer
COMSATS Institute of Information Technology, Wah Cantt. 14
Parallel Port PinsParallel Port Pins
1 2 3 4 5 6 7 8 9 10 11 12 13
14 15 16 17 18 19 20 21 22 23 24 25
DB-25 Male Connector
COMSATS Institute of Information Technology, Wah Cantt. 15
Parallel Port Pin Parallel Port Pin ConfigurationConfiguration
10 11 12 13
15
5 Status Pins5 Status Pins
2 3 4 5 6 7 8 9
8 Data Pins8 Data Pins
1
14 16 17
4 Control Pins4 Control Pins
18 19 20 21 22 23 24 25
8 Ground Pins8 Ground Pins
DB-25 Male Connector
COMSATS Institute of Information Technology, Wah Cantt. 16
Pin Assignment & Pin Assignment & DescriptionsDescriptions
1.1. StrobeStrobe PC PC OutputOutput
2.2. Data 0Data 0 PC PC OutputOutput
3.3. Data 1Data 1 PC PC OutputOutput
4.4. Data 2Data 2 PC PC OutputOutput
5.5. Data 3Data 3 PC PC OutputOutput
6.6. Data 4Data 4 PC PC OutputOutput
7.7. Data 5Data 5 PC PC OutputOutput
8.8. Data 6Data 6 PC PC OutputOutput
9.9. Data 7Data 7 PC PC OutputOutput
10.10. ACK (Acknowledgment)ACK (Acknowledgment) PC PC InputInput
11.11. BusyBusy PC PC InputInput
12.12. Paper EmptyPaper Empty PC PC InputInput
13.13. SelectSelect PC PC InputInput
14.14. Auto FeedAuto Feed PC PC OutputOutput
15.15. ErrorError PC PC InputInput
16.16. Initialize PrinterInitialize Printer PC PC OutputOutput
17.17. Select InputSelect Input PC PC OutputOutput
COMSATS Institute of Information Technology, Wah Cantt. 17
Simple LEDs Driving Simple LEDs Driving CircuitCircuit
10 11 12 13
15
2 3 4 5 6 7 8 91
14 16 17 18 19 20 21 22 23 24 25
Grounding Pins
100 Ohm Resistance
or Deponds on LEDs3 Volts LEDs
Cathode
Anode
COMSATS Institute of Information Technology, Wah Cantt. 18
LEDs Driving Circuit - LEDs Driving Circuit - ExampleExample
1 1 0 0 0 1 0 1
Grounding Pins
100 Ohm Resistance
or Deponds on LEDs3 Volts LEDs
Cathode
Anode
COMSATS Institute of Information Technology, Wah Cantt. 19
Simple Example ProgramSimple Example Program
#include <dos.h> // Include header file
#define DATA 0x378 // Base address of Data Pins#define STATUS DATA+1 // Status address of Status Pins#define CONTROL DATA+2 // Control address of Control Pins
void main(void){ outportb(DATA, 0x00); // Turn all the LEDs off delay(1000);
outportb(DATA, 0x01); // Turn the 1st LED on delay(1000);}