Sunteți pe pagina 1din 14

PARALLEL PORT INTERFACING

BY: LAXMAN BHAIA

Parallel port is same as the printer port at the back side of your computer. It looks like as shown below:

Interfacing through parallel port is very simple but very interesting also because of some mouth watering applications. But there are limitations in using the parallel port. And it is the limited data rates up to 1Mbps. As the name suggests, it is called parallel port because data transfer through it take place parallelly rather than serially. You will find parallel port at the back side of your CPU which looks like as shown above. Technically it is named as DB25 female connector. It consists in all 25 pins out of which there are 17 pins for input and 12 pins for output and 8 pins are grounded. There are three registers internally that control the printer or parallel port. These are: 1. Control register (4-bits) 2. Status register (5-bits) 3. Data register (8-bits) We can input through all three registers and output through only data and control registers. Each register have its own address and can be accessed using these addresses. First, I will explain the pin configuration of printer port. It is shown below:

D7

D6

D5

D4

D3

D2

D1

D0

13

12 25

11 24

10 23 22

9 21

8 20

7 19

6 18

5 17

4 16

3 15

2 14

S7

S6

S5

S4

S3

C3

C2

C1

C0

Internal input/output Data register Status register Control register NOT of control pin NOT of status

Control pins Data pins Status pins Grounded pins

DATA PORT:

ADDRESS
Base + 0 (e.g. 0x378)

PIN NUMBER
PIN 2 PIN 3 PIN 4 PIN 5 PIN 6 PIN 7 PIN 8 PIN 9

PIN NAME
Data 0 Data 1 Data 2 Data 3 Data 4 Data 5 Data 6 Data 7

BIT NAME
0 1 2 3 4 5 6 7

Base address : 0x378 or 0x278 (In hexadecimals)


Generally it is 0x378. I will tell you the method of finding out this address.

Data output pins are driven by 74LS374 octal latch, which capable of sourcing 2.6mA current and sink 24mA current. There is 2.2nF capacitor between each pin and the ground to reduce transients. Note : It is essential that any device does not try to pull the pins directly to ground. As this will cause 74LS374 to source more current than it could handle.

The input pins for the data registers are driven by 74LS244 tri-stated buffer. It is uninverted. The internal diagram of the parallel port is shown as follows:

S Y S T E M B U S

D0 D1 D2 D3 D4 D5 D6 D7 OUTPUT FILP FLOP

Q0 Q1 Q2

D0 (2) D1 (3) D2 (4) D3 (5) D4 (6) D5 (7) D6 (8) D7 (9)

74LS374

Q3 Q4 Q5 Q6

Q7

Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7

E
OUTPUT FILP FLOP

D0 D1 D2

74LS244

D3 D4 D5 D6 D7

INTERNAL DIAGRAM OF PARALLEL PORT

Now find out the address of the parallel port:


Step 1: Go to My Computer icon on your desktop and right click over it using your mouse. Scroll down, go to properties and left click over it as shown below.

Step 2: A window of system properties like shown below will appear. Now left click on the hardware option.

Step 3: A window like shown below will appear which shows three options, device manager, drivers and hardware profile. Now we have to left click on Device Manager.

Step 4: now device manager window will open which shows all the devices that makes your computer. You will see an icon like this is present in front of which Ports (COM&LPT) is written. On clicking the respective options you can see all its details. So, you have to just click on the plus sign.

Step 5: As click on the plus computer as shown below:

sign, you will find some options according to your

Now double click on Printer Port (LPT1).

Step 6: You will find Printer Port (LPT1) window as shown below. Click on the Resources option.

Step 7: Here is your parallel ports address. Note: 0378 is the address in hexadecimal and it the address of the data port of the parallel port. Next three addresses i.e.; 0379, 037A and 037B are the addresses of the control port (037A) and status port (0379).

Once you find it click OK.

So, far the things are going so simple. Now lets move on to programming part. We are

using Turbo C++ compiler to control our parallel port. Using this we can build programs to send data to parallel port and take input data from parallel port using commands outportb and inportb. Before moving ahead takes a small break and yes bring the multimeter as you come back from the break. If you dont have a multimeter then make a test device like the one shown below. this test device is very simple and made of very little number of components which are easily available everywhere i.e. some LEDs and a parallel port connector and some resistances.

13

12 25

11 24

10 23 22

9 21

8 20

7 19

6 18

5 17

4 16

3 15

2 14

1K

1K

1K

1K 1K 1K

1K

1K

Now you can attach this device to the parallel port. What you see is that all the LEDs are glowing.

You can see that the two LEDs in the middle are glowing at low intensity. This is because the LEDs that I used to make this circuit were not of very good quality. So the intensity may vary even if all the conditions like applied voltage and series resistance etc. These LEDs shows that the voltage at all the pins is high. This voltage must be near to 5V. We should use multimeter to measure the voltages at the port pins. If you use multimeter, notice the reading of voltage of each pin. When you apply the red probe of multimeter to data pins and black probe to grounds of parallel port while the multimeter is on dc voltage measurement configuration, you will see a value at multimeter display.

You know what this value is, yes 5V and on all ports. Why because by default when it is disabled by windows it shows high on all ports. If you try to read values of this port from TC, then the value you get is 255, which is equivalent to high on each pin.

S-ar putea să vă placă și