IBM Parallel Printer Port
بقیه در ادامه مطلب
IBM Parallel Printer Port
The IBM parallel printer port is a gold mine of interface bits, both input and output. Most IBM compatible parallel printer cards can be set to respond as either LPT1: or LPT2:. These devices appear within the microprocessor’s I/O address space as three separate eight bit ports, which will subsequently be referred to as DATA PORT, STATUS and CONTROL. The actual machine addresses of these ports are as follows:
LPT1: |
LPT2: |
|
DATA PORT |
378H |
278H |
STATUS |
379H |
279H |
CONTROL |
37AH |
27AH |
In order to use these ports for general purpose I/O, we need to know which bits of these three ports are connected to the outside world. Details may vary slightly from computer to computer, so obtaining a circuit diagram of your printer card is highly desirable. Another useful source of information is the manual that comes with your printer. This will contain an appendix describing the parallel interface signals. Table 1 is the parallel port signals of a typical LPTx port. As you can see, the eight DATA PORT bits are mostly intended as outputs (this is true of most XT ports, however, later AT ports onwards have true bi-directional data lines). Five of the STATUS bits are available as inputs. Four of the CONTROL bits can be used as inputs or outputs. Note that some of the bits are inverted between the internal data bus and the outside world. For example, if you input bit D7 of STATUS, it will appear as a "1" when its input signal line is grounded (logic "0". The open-collector CONTROL bits can be used as inputs by first setting the corresponding output bits to "1". This enables the inputs to be taken low as required.
BIT | SIGNAL NAME | INPUT | OUTPUT | |
DATA |
D7 D6 D5 D4 D3 D2 D1 D0 |
D7 D6 D5 D4 D3 D2 D1 D0 |
These bits may be input but all you will get is the value currently residing in the output latch, unless the interface is genuinely bi-directional. (Check circuit diagram) |
Latched TTL push-pull outputs with 2.2nF slow-down capacitors |
STATUS |
-D7 D6 D5 D4 D3 D2 D1 D0 |
BUSY -ACK PE SLCT -ERROR -IRQ not available not available |
TTL inputs no pull-up resistor not available |
not available not available not available not available not available not available not available not available |
PORT C 37AH |
D7 D6 D5 D4 -D3 D2 -D1 -D0 |
not available not available DIRECTION IRQ ENABLE -SLCT IN -INIT -AUTO FEED -STROBE |
not available not available not available not available May be used as inputs if corresponding output bits are set to "1" |
not available not available not available not available Open collector output with 4.7K pull-up resistor and 2.2nF slow-down capacitor |
Table 1: These are all the I/O bits available from a typical IBM parallel printer port. A "-" in front of a name means that the signal is inverted.