
Member • Oct 16, 2006
PC Tutorial: Parallel Port Interfacing Techniques - Part 2
PC Parallel Port Interfacing Techniques - Part 2
Introduction
In this tutorial we will flash a LED (Light Emitting Diode) connected to your printer port socket. Reading the #-Link-Snipped-# is recommended to get a general idea what you are upto.
Connections
To connect a LED to your port first you have to know what it looks like. Here are the two most common connectors that you can have.
![[IMG]](proxy.php?image=http%3A%2F%2Fdepts.washington.edu%2Fsacg%2Fservices%2Fworkshops%2Ffundamentals%2Ftroubleshootingxp%2Fimg%2Flpt_female.gif&hash=586b29d0ef83f578e8701c52fa03bd0a)
![[IMG]](proxy.php?image=http%3A%2F%2Fimg80.imageshack.us%2Fimg80%2F9153%2FLPT_25pin.jpg&hash=8e72cfd6ff2764266226dacb4703d557)
![[IMG]](proxy.php?image=http%3A%2F%2Fwww.pacificcable.com%2Fphotos%2FC36MS.jpg&hash=9b1c2114526ac6d53a8f61c4f712ec7e)
Pin Layout:
![[IMG]](proxy.php?image=http%3A%2F%2Fimg80.imageshack.us%2Fimg80%2F6339%2FLPT_36pin.jpg&hash=238e0afd1553939913508297564a76dd)
The LED
Shown below is a very common LED found anywhere from toys to computers. To connect, insert the positive pin into Pin number 2 of your port. And the negative to any ground of your connector. Pin 19 is an easy reach.
![[IMG]](proxy.php?image=http%3A%2F%2Fwww.diracdelta.co.uk%2Fscience%2Fsource%2Fl%2Fi%2Flight%2520emitting%2520diode%2Fimage-001.jpg&hash=7461d7d77366d68da0d290d6d8ca7cec)
In the above image the longer pin is positive and the shorter one is negative (ground). If you have a LED looking like the left one then you have to find out yourself which one is +/- by connecting it to a battery. I would recommend a 220ohm or 470ohm resistor in series with the LED. Mine worked without the resistor but I cannot promise anyone!
Ok after you finish this setup, it is now time to test the light! See if you have really found out the correct address by following the #-Link-Snipped-# then download #-Link-Snipped-#( #-Link-Snipped-#)** to have real-time control over your Port to test the light.
![[IMG]](proxy.php?image=http%3A%2F%2Fimg95.imageshack.us%2Fimg95%2F2590%2FLPT_ledoff.jpg&hash=5a73c649bd37a649035386b3e340e492)
![[IMG]](proxy.php?image=http%3A%2F%2Fimg95.imageshack.us%2Fimg95%2F1254%2FLPT_ledon.jpg&hash=5fa3f3ca6e67d11725328cadf1a74cac)
Open the executable; you should see a blue screen with port addresses, pins and their description. Choose the address where you have connected the port wire, and click on PIN 2 (Data 0) (there should be a cross on it now). Look at the LED, it must glow. If it does not glow then try different Port addresses, LPT1, LPT2 etc.
Programming the Parallel Port in C, C++, VB or Java with âWindows the great XPâ is not easy since it does not allow you to access the Ports directly. All hardware is virtualised. I somehow have a feeling programming in VB is easier. Very basic LED flashing is also easy through Assembly Language. Iâll look into this problem and post a tutorial soon.
Dont hesitate, ask me if you have trouble with anything!!! Writing a tutorial from scratch is not easy so please donât mind random grammar mistakes 😀
Some Useful links:
Parallel port output : A very detailed look into the Port basics and programming.
#-Link-Snipped-# : Excellent for explanation on Win NT/XP programming.
#-Link-Snipped-# : The Debug program to test your parallel port with LED