Electronic and Computer Resources - Parallel Port Interfacing and Programming using Turbo C

 

BACK          HOME          NEXT

 

The Parallel Printer Port

The PC parallel printer port is an interface between the computer and the printer. It is called parallel because the data is sent in parallel or by group of bits at a time unlike serial flow wherein data is sent one bit at a time.

While the parallel port is designed specifically for the printer, it can also be used as an interface to other electronic/electrical devices.

 

Port Pins and Address

The PC's Parallel Printer Port has three addressable ports namely, DATA ( 8  output pins), STATUS(5 input pins) and CONTROL(4 output pins) ports. The figure below shows the pin numbers of the entire parallel port and the available pins of the three ports, their addresses and their data direction,

 

    Contents

    Parallel Printer Port  

    Port Functions

    Sending a Byte

    Reading a Byte

    Interfacing LED

    Interfacing Push Button

    Interfacing 7-Segment

    Interfacing Coil

    Interfacing Relay

    Interfacing  S. Motor

    Interfacing AC Load

    Interfacing Sensor

 

 

 

 PORT

 AVAILABLE PINS

 ADDRESS

 DIRECTION

 DATA

 D0  D1  D2  D3  D4  D5  D6  D7

 278H, 378H, 3BCH

 OUTPUT

 STATUS

   -     -     -    S3  S4  S5  S6  S7

 279H, 379H, 3BDH

 INPUT

 CONTROL

 C0  C1  C2  C3   -     -     -     -

 27AH, 37AH, 3BEH

 OUTPUT

  

 

 

 

S7 pin of the status port is active low. Since this is an input pin, the bit that will enter here will be inverted when the computer reads this. C0 C1 and C3 are also active low pins. This means that when the computer outputs high bits in pin 0, 14 and 17 of the parallel port, the bits that will be receive by the outside device will all be low. 

 

Port Functions in Turbo C

 The Turbo C programming language has functions for controlling the parallel port. These are:

 
   FUNCTION  USE  HEADER FILE
 inportb()  read a byte from a hardware port  dos.h
 outportb()  send a byte from a hardware port  dos.h
 inp()  read a byte from a hardware port  conio.h
 outp()  send a byte from a hardware port  conio.h

 

Syntax:

          outportb( address, byte )

          inportb( address )

          outp( address, byte )

          inp( address )

 Examples are shown on the next page.

 BACK          HOME          NEXT

Electronic and Computer Resources - Parallel Port Interfacing and Programming using Turbo C

 

 

 

 

Google

 

 

 

1.  The Parallel Printer Port     2.  Port Functions in Turbo C    3.  Sending a Byte to the Port    4.  Reading a Byte     5.  Interfacing with LED

6.   Interfacing with Push Button     7.  Interfacing with 7-Segment    8.  Interfacing with Coil    9.  Interfacing with Relay    

10.  Interfacing with Stepper Motor    11.  Interfacing with AC Load    12.  Interfacing with Sensor

For questions, corrections and suggestions, 

email to: [email protected]

Hosted by www.Geocities.ws

1