Ask Dan: Parallel ports for PIC programmers

Date: 3 April 2007
Last modified 03-Dec-2011.

 

I'm wanting a parallel port for my laptop. The gotcha is I want to use it to program microcontrollers/FPGA not just send simple print jobs.

Are there any USB parallel ports for this kind of flexibility? Or am I still needing my trusty old 486 laptop?

Some anonymous person

Cutting to the chase, what you want to get a modern parallel-port-less laptop to work with a parallel microcontroller programmer is not a USB-to-parallel adapter, but a PCMCIA ("PC Card", or even ExpressCard if you can both find and use one) parallel port card.

Or, alternatively, you could switch to an old-fashioned serial-port, or new-fangled straight-USB, microcontroller programmer.

And now, the long and tedious explanation.

One reason why USB-adapted ports for old-interface devices fail is that the software for the device has to work through the operating system to access the port, not try to hit the port directly. This explicitly rules out software - usually old DOS or Win95 applications - that can't understand parallel ports other than the good old fashioned hardware type. Yea, it is Written that LPT1 must reside upon IRQ 7, with starting I/O address 0X3BC, et cetera.

(Actually, some of this sort of software will break on versions of Windows after Win98 no matter what kind of parallel port you have. The NT-series Windows flavours have tighter security controls on direct port twiddling.)

The same problems arise with old software and USB serial adapters, which have remained largely unchanged since I reviewed one in 1999. Even if you can set your new USB-serial port to pretend to be COM1 rather than COM5 or something, that still doesn't mean it'll work with old crusty software that tries to hit an IRQ on which no COM port has consistently lived since the Keating administration.

There's a bigger reason why a USB-to-parallel gadget probably won't work for you, though, and that is that the market for USB-to-parallel adapters is almost entirely composed of people who just want to get their old printer working again. It's cheaper to make a USB-to-parallel device that'll do only what it has to do to make printers work, so that's what most manufacturers do, rather than supporting the whole parallel port feature set.

If you've got a simple parallel microcontroller programmer that uses the Acknowledge/Busy lines (pins 10 and 11 on the D-sub parallel port) to send data, for instance, then it'll be twiddling them very very quickly. The USB adapter, which expects those lines to be used to signal nothing more complex than when a printer's ready to go and when it isn't (not a condition that typically changes thousands of times per second...), may well then drop lots of bits and ruin your day.

Parallel ports are meant to send data on eight wires at once, once for each bit - hence the name. But microcontrollers are generally programmed with a one-bit-at-a-time interface - there's no physical way to actually connect them directly to a byte-at-a-time output. And it's programmatically easy to bit bash your data through on the ack/busy wires. So that's what programmers often do.

(Old parallel port Zip drives and, if you're really perverse, memory card readers are likely to use the standard eight data wires for transfer. But they redline the interface so comprehensively that you shouldn't count on them working right via a USB-to-par adapter, either.)

Laptop docking stations with parallel ports - as in, the expensive docking stations from the laptop manufacturer, not yum cha one-size-fits-all ones - are more likely to have a fully functional port, even if they connect via USB. And, if the software isn't old and crusty, a serial programmer should work fine with a USB-to-serial adapter.

If a straight USB programmer exists for the hardware you're working with, I'd recommend you just use that.

Note also that good old fashioned I/O cards can solve these kinds of problems for users of full sized PCs.

As I write this, Aus PC Mark still stock a two-parallel-port PCI card for $AU41.80 including Australian delivery; Aussie shoppers can click here to order it. More relevantly for users of recent PCs, they've even got a PCIe x1 1-parallel-and-2-serial card, for $AU82.50 delivered. Australian buyers can click here to order that one.