The PortIO95 Parallel Port Interface

Overview

If you are reading this you probably want to somehow get information from the world into your computer or you want to get your computer to initiate or control some sort of events in the world outside (possibly both).

Reducing the problem to its simplest, one realizes that there has to be some sort of connection between the computer and the outside world. This connection acts as an interface which moves information to and from the computer. There are a number of ways of doing this and all of them have their various strengths and weaknesses. The parallel port is one such method. The PC parallel port is common, robust and offers (at least) 8 bits each of both input and output. On the down side, the parallel port also has the reputation of being tricky to program and hard to access.

The PortIO95 VxD attempts to address some of the drawbacks associated with parallel port programming on the Windows95 platform. It provides an application programming interface that is simple and which removes a lot of the learning curve.

All the PortIO95 VxD (by itself) will allow you to do is to set certain specific pins on a parallel port high or low, or read the state (again high or low) of other pins. You will notice that (other than a minimal amount in the sample source code comments) there is nothing in this document about designing hardware to attach to the port. That area is pretty specific to what you want to do. Basically PortIO95 does the pins - you do the rest! Look in the Internet Parallel Port Resources section in the FAQ for more sources of information.

And so - on to the API. The API is very simple, it uses the Windows 95 built-in DeviceIoControl() function call to talk to the PortIO95 VxD. This means it is not compiler specific. Any 32 bit compiler should be capable of interacting with the PortIO95 VxD. Look in your compilers Help menu under DeviceIoControl() for more information. The second parameter to the DeviceIoControl() call tells the PortIO95 VxD what to do on your behalf (i.e. read and write to the parallel port). The other parameters to the call are mostly used to provide the bits and bytes to read and write. The whole thing has been reduced to a very simple form - the functions you call depend on what you want to do. Here are the functions divided up in terms of what might want to do.

The "all I want to do is read a bit or write a bit" type functions

Programmers calling these functions typically just want to set individual things on or off (or want to find out if things are on or off). Typically the whole process is viewed from a "what is the state of pin x" perspective. Well OK, if that's what you want then PortIO95 will give you 8 bits of output, 5 bits of input and another 4 bits that can be set up as either input or output. You reference them through these calls:

The "all I want to do is read/write byte or nibble" type functions

Programmers calling these functions typically view the input/output to the computer in terms of groups of bits (i.e. bytes and nibbles). PortIO95 offers the ability to manipulate information in this manner. PortIO95 can give you a byte of output and a byte of input or a byte and a half of output and four bits of input. To use these functions, you do not have to be super knowledgeable in terms of the parallel port as long as you accept that certain pins have to be grouped together for hardware reasons (however illogical it may seem) and represent certain specific bits in the incoming and outgoing data. If you are prepared to accept this, then welcome to:

The "I really know what I'm doing" type functions

Programmers calling these functions know (and care) about things like the data register, the status register, hardware inverted bits and the nasty little capacitor to ground off of the control register bit 0 that limits the bandwidth there. For these people PortIO95 provides a large number of functions. Many are just synonyms for the ones listed above but are named from the register perspective. They are a bit too numerous to list (see the Control Code Reference) but here's a sampler:


[Previous] [PortIO95 Home] [Next]