Using the Parallel Port

The parallel port, which we’ll use as the test case for our I/O code, is really basic; in fact, I can hardly imagine a simpler interface adapter.

Although most readers probably have parallel port specifications available, I’ll summarize them here for your convenience while you’re reading the code for the module I’m going to introduce.

Basics of the Parallel Port

The parallel port, in its minimal configuration (I’m not going to deal with ECP and EPP modes) is made up of a few 8-bit ports. Data written to the output ports appears as signal levels on the output pins of the 25-pin connector, and what you read from the input ports is the current logic level at input pins.

The signal levels used in parallel communications are standard TTL levels: 0 and 5 volts, with the logic threshold at about 1.2 volts; you can count on the ports at least meeting the standard TTL LS current ratings, although most modern parallel ports do better in both current and voltage ratings.

Warning

The parallel connector is not isolated from the computer’s internal circuitry, which is useful if you want to connect logic gates directly to the port. But you have to be careful to do the wiring correctly; the parallel port is easily burned when you play with your own custom circuitry. You can choose to use plug-in parallel ports if you fear you’ll damage your motherboard.

The bit specifications are outlined in Figure 8.1. You can access 12 output bits and 5 input bits, some of which are logically ...

Get Linux Device Drivers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.