Link to home
Start Free TrialLog in
Avatar of mguedes
mguedes

asked on

Parallel port with VC++

I want to test a pin of the parallel port to use it like a trigger. anyone help´s me?

mguedes
Avatar of shaig
shaig
Flag of Afghanistan image

Yes. i've done just that.
Are you using NT or 95??
for NT:
The standard parallel device driver does NOT support such actions, only printer commands. i'm sorry to be the one to bring the bad news, but for doing that you should write a specific device driver. the ddk has some misrable examples, but there are some products out there that can make the job an easy one. look into WinDK and WinRT products for more details.
for 95:
There is realy no problem. you can access hardware like in dos, (this case outport to the parallel port address) only remmember that this code wont be compatible with NT.
Avatar of mguedes
mguedes

ASKER

thanx shaig for your answer, but i have one more question. What´s the roll of the 32bits WINAPI´s CreateFile, ReadFile, SetCommMask, WaitCommEvent, etc..(serial? parallel?)


 
You CAN use the CreateFile/ReadFile etc to read chars from the serial and parallel ports.  But you CAN'T use them to do "generic" input from the ports.  By generic, I mean that you want to have your own device on the port and read input from it.  If that is the case, then the device must "act" like a printer or terminal/modem.

For example, on the printer port, the device must handshake the control lines lika a parallel printer or the IO routine will not "talk". On the serial port, the serial control lines must all be set right and the character must be clocked in serially with the right "framing".  Otherwise you get an error on the port.

Maybe if you were more specific about the EXACT nature of what you have on the parallel port would be helpful.
 

Avatar of mguedes

ASKER

I´m understand your answer...my idea was to simply use one switch(1L to 0L) to interact like a mouse click, but now i sea that not possible...i have to control more parallel port pin´s to make my switch to work. Do you have some good reference for parallel port pin´s configurations? i apreciate that and thinx for your answer
ASKER CERTIFIED SOLUTION
Avatar of trestan
trestan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mguedes

ASKER

it´s wonderfull, thanx trestan