parapin -- a Parallel Port Pin Programming Library for Linux

What is parapin?

Parapin makes it easy to write C code under Linux that controls individual pins on a PC parallel port. This kind of control is very useful for electronics projects that use the PC's parallel port as a generic digital I/O interface. Parapin goes to great lengths to insulate the programmer from the somewhat complex parallel port programming interface provided by the PC hardware, making it easy to use the parallel port for digital I/O. By the same token, this abstraction also makes Parapin less useful in applications that need to actually use the parallel port as a parallel port (e.g., for talking to a printer).

Parapin has two ``personalities'': it can either be used as a user-space C library, or linked as part of a Linux kernel module. There is also a device driver that provides access to the kernel module from user-space, allowing the administrator to use filesystem permissions to control access to the port. Parapin was written with efficiency in mind, so that Parapin can be used in time-sensitive applications. Using Parapin should be very nearly as fast as writing directly to the parallel port registers manually.

Parapin provides a simple interface that lets programs use pins of the PC parallel port as digital inputs or outputs. Using this interface, it is easy to assert high or low TTL logic values on output pins or poll the state of input pins. Some pins are bidirectional--that is, they can be switched between input and output modes on the fly.

Parapin was originally written by Jeremy Elson while at the University of Southern California's Information Sciences Institute. The original work was supported by DARPA under grant No. DABT63-99-1-0011 as part of the SCADDS project, and was also made possible in part due to support from Cisco Systems. It is freely available under the GNU Library Public License (LGPL).

Current maintenance of Parapin is coordinated by Al Hooton, who also wrote the device driver interface. This work is supported by a very understanding spouse and quite a lot of black pekoe tea.

Dire Warning

Attaching custom electronics to your PC using the parallel port as a digital I/O interface can damage both the PC and the electronics if you make a mistake. If you're using high voltage electronics, a mistake can also cause serious personal injury. Be careful.

If possible, use a parallel port that is on an expansion card, instead of one integrated onto the motherboard, to minimize the expense of replacing a parallel port controller that you destroy.


Downloads and Documentation

You can download parapin releases from the project files area.

If you would like the very latest parapin work that is in-progress (not yet released), you can download from the CVS repository for the project.

Parapin's documentation is available in the release files and in CVS in several formats (html, postscript, TeX, plain text). You may also see the most recent parapin documentation in html format here.

Mailing Lists

There are two mailing lists you may join to keep abreast of changes with the parapin project. The parapin-users list for general discussion about using parapin in applications, talking about possible feature enhancement, etc. The parapin-internals list is to only be used for discussion by developers that are working inside parapin itself.

Bug Reports, Feature Requests, Support Requests

Please use the bugs, support requests, and feature requests trackers to log this information with the project.

Known Issues

Currently, Parapin only supports a single parallel port at a time. It is not possible to have a single instance of the library manage multiple instances of a parallel port. This may be a problem for software that is simultaneously trying to control multiple parallel ports. Someday, somebody may work on this, but it will make the interface messier (a port handle will have to be passed to every function along with pin specifiers).

The C-library version of Parapin should probably do better probing of the parallel port, but my desire to do this was limited because it replicates what is already done by the Linux kernel.


The parapin project is proud to be hosted on SourceForge, and thanks the entire SourceForge team for their services and dedication to open-source software.