开发者

Controlling a parallel port via USB adaptor on modern hardware and OS

开发者 https://www.devze.com 2023-01-05 15:20 出处:网络
I have a USB to parallel port device that i want to interface with through c++ on a modern windows OS (xp and newer).

I have a USB to parallel port device that i want to interface with through c++ on a modern windows OS (xp and newer).

I've done a little research but the information is a bit patchy when it comes to programming to one of these USB to parallel port devices (most of the information is dated and assumes that you have a parallel port built right into the motherboard, something my brand new computer doesn't have开发者_JS百科). One reference even says that it is not possible to interface with a USB to parallel port from a C++ program without some sort of software changes.

All i want to do is to is be able to read or write 8 bits to the parallel port through a USB to parallel port device on a modern computer running a modern windows OS (with ports being dedicated to reading or writing only).

Is there any quick and easy way of doing this? Some sample code would be greatly appreciated.

Also, how many of these USB to parallel ports can I interface with my computer? Am i limited to 3 due to some sort of legacy addressing or can i have as many as my USB and CPU are able to support?

Working off VC++ 2008, running Windows 7 x64 with a Core i7 860.

Edit: a bit more information...

I've tried using inpout23 along with some prewritten test program. It compiled just fine and ran just fine claiming to have both read and written to a parallel port. I had my USB to parallel port connected to the computer and that port connected to a cable in which i had identified, stripped and soldered each of the 25 wires onto a sort of plug for quickly plugging into a breadboard for testing. None of the output pins had changed to what the program had said was written to them (instead they were all set to high and never changed).


I've done this in the past and I have good news and bad news.

The good news is that it always worked (sometimes with tweaking), which is a tribute to the electronic manufacturers of designing extremely robust protocols. Apparently the USB to parallel converters all provided the hardware port emulation.

The bad news is that performance was awful on the 'bitbanging' interface models. If you do not mind slow updates this is not an issue at all. I used it for programming uControllers and soon the price of serial or USB programmers was overcome by my impatience.

Just use the windows API to read/write the LPT or COM ports and it works (slowly).


I've worked with a USB-to-serial port adapter before and I guess USB-to-parallel should be the same. You should have got a driver along with the adapter - this does most of the work for you, hiding the USB interface and presenting it to the OS as a traditional parallel port. For example, when I plug my adapter into the USB port, it just shows up as COM4 in Device Manager. I'm guessing yours will show up as LPT1 or something. From there on, it's a matter of using the standard Windows API to access these ports. (see Communications Resources on MSDN)


Misteriously I succeed with the USB to LPT-DB25 Wire bought in ebay.com.

We should connect a LED between the /LF Line Feed and GND pins.

After discard the USB registers in order to find that one associated to the USB Cable, we should build an API (Application Programming Interface) to interact with the outputs/Registers.

I'm going to try to attach a picture to have a look how I managed it:

Controlling a parallel port via USB adaptor on modern hardware and OS

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号