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

  • Thread starter TuviaDaCat
  • Start date
  • Tags
    Controller
In summary, there is an interface which will allow you to control the state of ports and output data. There is a book which is helpful in learning about port programming and the C++ language. There are also drivers available which will allow you to control the port directly.
  • #1
TuviaDaCat
85
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
  • #2
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.
 
  • #3
thanks, but I am using windows, and more worrying, I am using windows 64 bit...
 
  • #4
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.
 
  • #5
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:

What is an lpt?

LPT stands for "Line Printer Terminal" and it is a type of parallel port used to connect a computer to external devices such as printers, scanners, and other peripherals.

Can I use lpt as a controller for other devices?

Yes, lpt ports can be used as a controller for a variety of devices such as robotics, CNC machines, and other industrial equipment. However, it is important to make sure that the device you are connecting is compatible with the lpt port on your computer.

How do I use lpt as a controller?

To use lpt as a controller, you will need to have a program or software that can communicate with the device you want to control. This program will send signals to the lpt port, which will then be received by the device. You may also need to configure the lpt port settings in your computer's BIOS to ensure proper communication.

Are there any limitations to using lpt as a controller?

There are some limitations to using lpt as a controller, such as the number of devices that can be connected to a single lpt port. Additionally, lpt ports have a limited data transfer rate, so they may not be suitable for controlling high-speed devices.

Are there any alternatives to using lpt as a controller?

Yes, there are alternative methods for controlling devices such as using USB ports or wireless connections. These methods may offer faster data transfer rates and more flexibility in terms of the types of devices that can be connected.

Similar threads

Replies
17
Views
631
  • Electrical Engineering
Replies
1
Views
2K
  • DIY Projects
Replies
12
Views
2K
Replies
31
Views
2K
Replies
3
Views
1K
Replies
14
Views
3K
Replies
37
Views
3K
  • Electrical Engineering
Replies
12
Views
2K
Replies
16
Views
1K
  • DIY Projects
2
Replies
35
Views
4K
Back
Top