Driving a relay through a printer port

Thread Starter

fester225

Joined Nov 11, 2008
6
I need to drive an opto-relay through a printer port. There will be NO difficulty actually driving the relay. The driving part of the interface is posted in several places, but nobody is addressing the handshaking problem.

How do I provide the handshaking signals required by the printer port, or better yet, how do I turn the relay on and off without the handshaking?
 

davebee

Joined Oct 22, 2008
540
The port itself doesn't require any handshaking. A program writes a value to an address and the corresponding pins go to 5 volts or zero volts.

Here is an example of how Delphi can do it -

procedure LPout(Value: Word);
begin
asm
mov ax, Value
mov dx, $378
out dx, ax
end
end;

But there are a lot of maybes depending on your exact software and hardware. Not every parallel port is at port $378. Not all operating systems will allow this command to control the port. Not all languages will let you interface with the computer hardware.
 
Top