Can I Use LPT Ports as I/O with a Program or C++ Directory?

  • Thread starter Thread starter TuviaDaCat
  • Start date Start date
  • Tags Tags
    Controller
AI Thread Summary
Using LPT ports for I/O is feasible with the right programming tools. A project called Linux Parallel Port+ is currently being developed to allow control of individual output pins and read input pin statuses, although it is primarily for Linux. For Windows users, porting the project is possible, but it requires good programming skills, or one can use the Windows API to create their own solution. Recommended resources include "Parallel Port Complete" by Jan Axelson and a book by Katupitiya and Bentley, which focus on port programming with practical examples. Direct access to ports in newer Windows versions is restricted, necessitating the use of kernel mode device drivers.
TuviaDaCat
Messages
85
Reaction score
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?

thanks
 
Engineering news on Phys.org
I am currently working on such an interface. Its called Linux Parallel Port+.
https://sourceforge.net/projects/linuxparaport/

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.
 
thanks, but I am using windows, and more worrying, I am using windows 64 bit...
 
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:
http://www.epanorama.net/circuits/parallel_output.html
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.
 
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:
http://www.codeproject.com/useritems/Inpout32_read.asp

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.)
 
Last edited by a moderator:
Very basic question. Consider a 3-terminal device with terminals say A,B,C. Kirchhoff Current Law (KCL) and Kirchhoff Voltage Law (KVL) establish two relationships between the 3 currents entering the terminals and the 3 terminal's voltage pairs respectively. So we have 2 equations in 6 unknowns. To proceed further we need two more (independent) equations in order to solve the circuit the 3-terminal device is connected to (basically one treats such a device as an unbalanced two-port...
suppose you have two capacitors with a 0.1 Farad value and 12 VDC rating. label these as A and B. label the terminals of each as 1 and 2. you also have a voltmeter with a 40 volt linear range for DC. you also have a 9 volt DC power supply fed by mains. you charge each capacitor to 9 volts with terminal 1 being - (negative) and terminal 2 being + (positive). you connect the voltmeter to terminal A2 and to terminal B1. does it read any voltage? can - of one capacitor discharge + of the...
Thread 'Weird near-field phenomenon I get in my EM simulation'
I recently made a basic simulation of wire antennas and I am not sure if the near field in my simulation is modeled correctly. One of the things that worry me is the fact that sometimes I see in my simulation "movements" in the near field that seems to be faster than the speed of wave propagation I defined (the speed of light in the simulation). Specifically I see "nodes" of low amplitude in the E field that are quickly "emitted" from the antenna and then slow down as they approach the far...
Back
Top