PDA

View Full Version : parallel port : LED never stops glowing ??



Kiran_parasa
07-18-2005, 10:21 AM
Hi,

I am facing problem in parallel port interface.

I have gone through parallel port articles posted in this forum but still I am not getting the desired results.

My idea was to control Remote control car using computer keyboard ( via parallel ports).

To check if the program is working fine I used LED and connected to port 3 ( to psoitive lead of LED) and 18. As described in the article a 2k resistor is also added ( in series).

With the above setup LED starts glowing. But what ever command I send from C program LED never stops glowing.

Code portion :

#include <stdio.h>
#include <conio.h>
#include <dos.h>

main(){

outportb(0x378, 0x00);

}

I/O address mentioned in the device manager also shows range as 0x378

Now what could be the problem ?

Regards,
Kiran

mishradk
07-18-2005, 11:47 AM
Hi,
using outportb(0x378, 0x00); you are glowing the LED.
Now use outportb(0x378, 0xFF);
That will make it off.... :D
regards
Mishradk

Kiran_parasa
07-18-2005, 02:32 PM
Hi,

I tried all options yaar.

outportb(0x378, 0x00);
outportb(0x378, 0xff);
outportb(0x379, 0x00);
outportb(0x379, 0xff);

I don't know why the outport commands are not effecting the voltage at parallel ports. Do I need to download some parallel port driver as said in the parallel port topics ?

Regards,
Kiran

mishradk
07-18-2005, 02:42 PM
Hi,
Which OS you are using?
Some one was telling there is some problem with XP. it works fine with me .. in my Win 2000.

but just to try.. why dont you make a dos boot disk, and copy the exe of your program to your boot disk, boot the PC and see whether it works fine or not?

else you will have to download the some 3rd party drive.. i have not tried that....

let me know whether you were able to do that or not...

regards
Mishradk

Kiran_parasa
07-18-2005, 02:59 PM
Hi,

finally I am able to send the commands through parallel port and control the LED.

The problem was that XP has special access permission for parallel port and requires special driver (described in parallel port troubleshooting article) . So I downloaded the driver and installed it.

Now it is working fine.

Thanks to everybody,

Regards,
Kiran

yogi
07-18-2005, 03:31 PM
U have to install Userport.zip to interfacin in C/C++/Java in all operating system above Windows ME.
By default the value of parallel port (ie. at 0x378) is 0xff

Have u done BIOS setting.

Ur program is fine. But u have not done the following things.

u join yahoo group-parallelport and from the files of that group u can find Userport.zip and the way to install it is given in a document named pforu updated.

Download a book named Parallel Port For U from same group to do Bios setting and as a tutorial.

Download lpt.exe from there to see the status of parallel port


Any probs u post in that group.

Kiran_parasa
07-18-2005, 05:01 PM
Hi yogi,

Thanks for the info. I went through the yahoo groups and found out some sites describing parallel port programming. Sites were very informative.

The parallel port article in this site is also very helpful.

Now my next task is to control a set of motors using a small C program.

Thanks & Regards,
Kiran

yogi
07-18-2005, 08:22 PM
when u control motors remember not to connect motor directly to parallel port,

use L293D,L298 or some power transistors


Bibin John
www.bibinjohn.tk

07-19-2005, 11:57 AM
An optocoupler and a relay can also be used.


regards

Naren
01-26-2006, 12:45 PM
hi
u can even use
inpout32.dll (for visual basic)and even other hfiles for c
visit www.logix4u.net for info