Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Use lpt as a controller

  1. Nov 8, 2007 #1
    i want to use my lpt ports as I/O. for example to run a relay, or react to an outside contact.
    i need a program which can check the state of ports, or output to ports, and make conditions according to the inputs...

    is there some kind of program for this? or maybe a c++ directory?

  2. jcsd
  3. Nov 8, 2007 #2


    User Avatar
    Gold Member

    I am currently working on such an interface. Its called Linux Parallel Port+.

    The current version is very limited and can currently output a byte of data and read form the port. Over the weekend I will upload a new version. This version will give the ability to have control of individual output pins and read the status of the input pins individually (hopefully I'll have PWM working).

    You can read CVS for the most current version of the source code and the documents (theres probably typos, grammar, and a few technical mistakes). The documents have some help on the port architecture and how one should control relays and so on. It isn't that detailed; I will try my best to change that soon.

    There are still other goodies that I'm working on such as PWM and networking for remote monitoring.
    BTW, its written in C. The code is written for Linux and certain version of UNIX.
  4. Nov 9, 2007 #3
    thanks, but im using windows, and more worrying, im using windows 64 bit...
  5. Nov 9, 2007 #4


    User Avatar
    Gold Member

    Well if you're programming skills are good, you could port it to windows. It should be easier to port now considering that the network functions are not implemented.

    Alternatively, you can learn the windows API for this and code on your own:
    Parallel Port Complete by Jan Axelson is a very good port. I highly recommend this book if you're getting started with port programming (they have source code for windows).

    Also Katupitiya and Bentley (2006) is a very good book focusing on using C++ for port programming while making good use of the OOP nature of C++. There are many practical circuits in the book with fairly good explanations. The good thing is that the book comes with a circuit board so you can build all the circuits in the book. Both linux and windows source codes are available.
  6. Nov 9, 2007 #5


    User Avatar
    Science Advisor
    Homework Helper

    Under anything newer than win95 you can't talk to the port directly yourself. Only kernel mode device drivers are allowed to break your system!
    There are a couple of direct to parrallel drivers around, see:

    You can also write your own with the device driver devkit, it includes an exammple miniport driver ( or at least it did under NT4 last time I did it.)
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Use lpt as a controller