windowsdelphiusbdelphi-2009parallel-port

Can I access the Parallel Port normally when using USB to Parallel Port adapter?


Preliminary story

There is this program which uses the Parallel Port to synchronize with other hardware. It will set the Parallel Port output to a specified (byte) value. This works without problems when using the built-in Parallel Port of a PC. The target platforms are Windows XP to 7, all worked fine so far. Source code is in Delphi, accessible and can be modified.

How it works

In Delphi I can use the io.dll to set the value of the Parallel Port, but there are also other solutions available, like inpout32.dll or port.dll. I call something like PortOut, specify a port number and the byte value and the port is set.

What I now want to do - and where I need help

Now the change: this needs to work on a machine which has no Parallel Port built-in (not even on the mainboard). There are several options available:

I am currently heading for and concentrating on the easiest and cheapest possibility: a USB to Parallel Port adapter.

Main question

There seem to be differences between Parallel Port adapters which are made to connect just a printer and other adapters which seem to be more powerful. Is there really a difference? Or can I just use one of these 5$ printer-adapters, plug in my own hardware and access the port from Delphi code? Or do I need a special adapter? Has anyone experience with this? There is a related question here, but the different adapter types (if existent) are not mentioned there. This page suggests that there are indeed differences:

Contrary to all other USB parallel ports which can connect to printers only, this makes connection to most hardware.

I hope there exists a solution via USB because for this you don't have to open the PC, which means the adapter can be added on demand.

Sub-question

Do you have experience with PCI (Express) solution? I have to use one if the USB approach is not successful.


Solution

  • Since I've been wrestling with this very thing recently here's what I've discovered; If you mean by using IO port addressing (indicated by your reference to inpout32.dll), no. Unless your USB-parallel port driver supports full port emulation or virtualization, which most do not, this is generally not possible. If you need to directly access the port to do normal "bit-twiddling", you should get a separate Parallel port PCI-card. Most of them present themselves as normal IO at the standard address(es). I am presuming you're not planning on using the parallel port to actually communicate with a printer, right?

    What is interesting is that USB-Serial adapters are much easier to use since they appear as simple virtual devices where you can merely "open" them using a simple stream; TFileStream.Create("COM1", fmOpenRead) or Windows.CreateFile("COM2", ...);

    Here is some devices that purport to do full emulation of a parallel port through USB:

    https://www-user.tu-chemnitz.de/~ygu/bastelecke/PC/USB2LPT/index.en.htm