Driving a relay through a printer port

Discussion in 'The Projects Forum' started by fester225, Nov 11, 2008.

  1. fester225

    Thread Starter New Member

    Nov 11, 2008
    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?
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    You set the pin the optorelay is tied to to a one or zero. Essentially, you just write the value to the output register. Here is a link to using the port - http://www.beyondlogic.org/ecp/ecp.htm.
  3. davebee

    Well-Known Member

    Oct 22, 2008
    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);
    mov ax, Value
    mov dx, $378
    out dx, ax

    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.