Retro Computing – parallel port control

In the olden days when Micro-controllers were expensive and single board computers were unheard of the only GPIO we could play with was a parallel port on a PC. Even then it would be crazy to do since a typical low end computer was about a grand. So for fun and giggles I decided to play with a old computer and toss on DOS and see what I could conjure up.

You can do a lot if you put your mind to it. A typical parallel port can push out 5 volts and around 50ma. Just enough to light up LEDs and turn on transistors. Toss on a 2n2222 transistor, external power supply and some diodes and you can power relays, digital logic and if you know how to program you can triple the fun.

As for myself I plan to use it to automate stuff around my work desk. A old system such as a 386 would work just fine, expressibly if you know Assembly and BATCH programming.

Here is a quick run down on what I am doing. A old PC with a Celeron CPU, 32MB of ram, 2GB partition for a FAT16 filesystem with some hacked version of DOS 7.10 From there I have MASM 6.15 installed. Created some sample code to enable certain pins of the parallel port.

For a example I want to light up a LED with pin 2 (D0) of the parallel port. Here is what the code would look like.

MOV DX,0378H

The red portions are the address of the port and the pin identifier. Typical systems with one parallel port use the address 378. The identifiers are a pain if you don’t know what you’re doing. You have many choices but limited to nine pins.

1, 2, 4, 6, 8, 16, 32, 64, 128 are the pin identifiers. You can add multiple identifiers together to enable multiple pins. such as this example

MOV DX,0378H

This code example enabled pins 2 (D0) and 3 (D1).

Now what if you wanted all of the pins on or off? Simple, the identifier to turn off all the pins would be 0.
For all of the pins to be on it would be 255.
To turn off a single pin just recall the same pin to bring it back to low/off.

With these simple scripts you can compile you can call them in BATCH files or even use a menu front end such as Direct Access or QuickMenu if you want a nifty GUI like interface.

Later on I’ll go more in depth with this.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s