Maker Pro
Maker Pro

DB25 Parallel Port Programming

Hiigarangh7

Nov 30, 2012
6
Joined
Nov 30, 2012
Messages
6
As the title says, I'm trying to use a DB25 Parallel Port for various electronic projects. The programming language I intend on using is C (C++ if need be.). The cable is a USB to Serial DB25 Adapter purchased from CablesToGo.

Simply put, I just want to be able to send an I/O signal, could even be a byte through the the cable to, for example light up an LED after using a command from C to send as True or False. I'd also like to be able to read input as well, for example: A button is pressed that closes a path to one of the inputs, allowing the c program to pick it up as On, or True.

I've search all over on the internet. But, I've come out with more useless than useful information as most of it usual speaks about Linux, Basic, or Visual C, all of which I do not use. So far I could only piece together that I'll need #include <dos> line of a sort which I haven't looked into DOS much.
 

TedA

Sep 26, 2011
156
Joined
Sep 26, 2011
Messages
156
Hiigarangh7,

Since this is getting a bit overdue for some sort of answer, I'll give it a try.

Perhaps there are no answers because we really need to know more about what you are working-with. Also, the cable you mention buying does not seem to be what you will need.

What sort of computer do you intend to be using? ( Presumably one with a parallel printer port on a DB25 connector. )

What operating system does this computer run? Do you have any flexibility here?

The IBM PC and its successors use a DB 25S, female, connector for the parallel printer port. This port is easily accessible from your software when running PC DOS, and even Windows, up to 95 or 98. More recent versions of Windows make it harder. The Basic language that shipped with the older OS could access the parallel port, and will serve well enough to check the port's operation. Might even do for your whole project.

It is confusing, but IBM chose to use the same connector family for both the parallel printer port, and the serial RS-232 port on the original PC. An extension cable will connect one to the other. Not a good idea to try!

Your adapter cable will not be of much use with a parallel port on your computer, as none of the signals match-up. If the RS-232 end of the cable presents itself as DTE, the connector will physically plug into your port, but this will be useful only if you strip-out the DB25P connector to use. Expensive way to get a connector. Best to get a bare connector for this, and save the fancy adapter cable for use when you need a serial interface and have only USB ports on the computer.

If you have access to a computer that has USB connectors, you might consider using that instead. Hardware you develop for use with a USB connector will work with more modern computers that lack parallel ports.

You can get an inexpensive USB to parallel adapter that gives you several TTL level I/O pins, while appearing to the software as a serial port. This is important, because on computers recent enough to have USB ports, it is easier to access a serial port than a parallel port from most software. Google FTDI. Their business is to design and market such adapters, and the ICs that make them work. There is a lot of information on their website.

The simple USB to parallel TTL adapters do not provide as many useful I/O pins as the old parallel port, and are much slower, but that’s "progress".

I hope that this is helpful to you.

Ted
 

Hiigarangh7

Nov 30, 2012
6
Joined
Nov 30, 2012
Messages
6
Thank you! It did help quite a bit with my understanding of this. It to use the DB25 adapter with the current resources I have.

Besides microcontrollers and the DB25 parallel, is there any other method to communicate with one's custom electronics through the USB port? So that a created program that executes can send (And recieve if possible.) basic I/O signals so that can light an LED for an exmaple?
 

TedA

Sep 26, 2011
156
Joined
Sep 26, 2011
Messages
156
Hiigarangh7,

You are very welcome. The forum members are eager to help you.

We could be of more help if you shared with us more details about what you are working with. We can make all sorts of guesses, but the resulting answers may not be useful to you.

So far, you have mentioned a DB25 parallel port, a USB to serial port adapter cable, and a USB port. These do not all fit together, exactly.

If you have a USB port to work with, the modules suggested by Bob appear to be a good bet. Check your programming language for serial port support. If it is there, these modules might be your answer.

Bob's link is to a vendor selling small PCBs bearing a Microchip PIC and a USB connector. The PIC is programmed to provide simple I/O functions via a virtual serial port working through a USB port on a computer. The module vendor provides drivers and sample software for Windows computers and Linux computers. Not bad for $25.00, US.

Ted
 

dpenelob

Mar 27, 2013
15
Joined
Mar 27, 2013
Messages
15
Hi Hiigarangh7,

another option may be to use a PCI plug in board which supplies you with a somehow
standard parallel port that can be accessed by any program you write at locations 0x378
or 0x278 depending on the board config.

Best regards,
dpenelob
 
Top