View Full Version: LET'S START with parallel port interfacing

booksbybibin >>Computer interfacing >>LET'S START with parallel port interfacing


yogi- 07-03-2006
LET'S START with parallel port interfacing
This tutorial is taken from the book MY EXPERIENCE IN PARALLEL PORT INTERFACING. you can download it free from the files section(file:-parallelport(3 files) of yahoo group-booksbybibin http://groups.yahoo.com/group/booksbybibin/ comments about this book on www.booksbybibin.blogspot.com LET'S START Before starting let me explain the components i am going to use. First about my power supply. I am using the adapter of 12V,500mA with voltage ranging from 1.5V-12V. I have explained it on my first book MY EXPERIENCE ON AUTONOMOUS ROBOTICS.I want to show you how i am doing things so that you will be able to do all the projects given in this book very fastly and follow the right way. SMPS is prefered over adapter. The knob of my adapter is shown below. This is an LED connected in series with a 100 ohm resistor. This white led gives red light See this figure carefully. See how i connected the individual ports. See I have used different wires. A thick black wire from cable to breadboard. I used a green wire also. The wires in the breadboard are small size as I shown it previously. Here is the multimeter which i am using. It costs around Rs300. I have talked about this multimeter in my previous book MY EXPERIENCE IN AUTONOMOUS ROBOTICS. Now we can start. First install userport.zip and do bios settings. Now let's check the voltage from different ports. Make the data port all high. In the above diagram you can see that i checked the voltage at the data port. In that I connected LED and multimeter to same point. Let's remove Led and check see the voltage difference. Here i used 100 ohm series with LED. This diagram shows how i check for the control port. The voltage of control port is high compared to data port. First Program Writing to data port #include"bparlib.c" void main() { Write_DataPort(0x99); } Program: 1.c This program sends 0x99 to data port i.e D0=1,D3=1,D4=1,D7=1 and remaining are LOGIC LOW. Now check the status using an LED. Figure below shows the status of D7. Check the status at every pin of data port. Reading Data Port Program: 2.c #include"bparlib.c" void main() { printf("%x",Read_DataPort()); } Here I used %x to print the hexadecimal value instead of decimal value. Now let's connect some input to data port and check. In the figure below I am connecting LOW to D0. Now run this program. You can see the output is 0x98. Only the value at D0 has changed, the remaining values from D1-D7 remains unchanged. Writing to Control Port Program: 3.c #include"bparlib.c" void main() { Write_ControlPort(0x00); } This program will send 0x00 to control port. i.e c0,c1,c3 led has glown because they are inverted pins and C2=0. Reading Control Port program:4.c #include"bparlib.c" void main() { printf("%x",Read_ControlPort()); } i connected c2=high, remember that previous values will be stored in the port. The output of pgm4 is 4. ie. C2=1 and remaining all others are LOW. Reading Status Port program:5.c #include"bparlib.c" void main() { printf("%x",Read_StatusPort()); } first execute this program without connecting any inputs. I got the value 0x78. Now connected Pin4 to HIGH then it read 0x78 again because the Pin4 is already high in this program. NOTE: 1. Use lpt.exe to see the status of every ports everytime when you execute the program. 2. You can use this as an ideal status detector. 3. Try all different combinations by sending different values to port as well as inputting different values. 4. Remember that when you input the voltage should not be greater than 5V. Make sure this first, then only you do this. You can use the output of other port as input to some other port. Do thorough with reading and writing different ports first then only go for the next programs. 5. Take some time to do this because this is the basic step and you should be thorough with that for the other programs. TROUBLESHOOTING 1. The cable may not be good some time. This occurred to me in the beginning. So You had to see this problem first. Now let's see how to do it 2. Use multimeter continuity tester to test continuity between the wires of the breadboard and the copper strip of the cable. Try to vary values, ie. Apply both LOW and HIGH to see whether the wire is properly inserted into the cable and the continuity is good. This is the main step. 3. See for any problems with breadboard. 4. Careful about ground. You have to short circuit external ground and ground of parallel port. 5. See whether there is any short circuit between the pins of the cable or wires. Solve this first. This may occur if you go for soldering. 6. There might be some loose contact between cable and wire. Fix it properly. In order to avoid this use wires of good thickness. 7. Always check the voltage of external power supply. It should not be greater than 5V. Otherwise sometimes, some problems can occur to the parallel port. 8. See whether your parallel port is working using lpt.exe by changing the 'ticks' If 'ticks' are not changing then you won't be able to use that port.


Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.