The LPT port ============ THE ADRESS: ----------- The LPT PORT has got a hardware adress, where the computer can find the thing. A standard IBM compatible PC supports a maximum of 3 LPT ports. Usual adresses are: +--------------+---------+------------------------------------+ | HEXADECIMAL | BINAIR | DISCRIPTION | +--------------+---------+------------------------------------+ | 378 | 888 | printer port #1, on every computer | | 278 | 632 | printer port #2 | | 3BC | 956 | printer port on HERCULES card | +--------------+---------+------------------------------------+ BIDIRECTIONAL I/O: ------------------ PS/2s and many later parallel-port adapters support high-speed bidirectional I/O. You might have to change the "LPT MODE" in your PC's BIOS SETUP MENU. Probably you have choice between 'EPP' mode, 'EXTENDED' mode and 'BIDIRECTIONAL' mode. The last one is the one your looking for. In the 'BIDIRECTIONAL' mode, you can use the byte on portadres (378 HEX, 888 BIN) for input after setting bit 5 of portadress + 2 to "1" (37A HEX, 890 BIN). Normally the bit 5 of portadress + 2 is "0", and then you can use the byte on portadres for output. TALKING TO THE LPT PORT: ------------------------ So you can input and output bytes on the printerport. But how to make the thing to do that? Well, you have to talk to the printerport using a programming language. I use GWBASIC and QBASIC to do so. Of course it's also possible in C, PASCAL, ASSEMBLY LANGUAGE, COBOLT, FORTRAIN. I don't know about the WINDOWS stuff (VISUAL BASIC, DELPHI, VISUAL C) becaurse WINDOWS has the irritating property of forming a barrier between the computer user and the computer's hardware. +-------------------------------------------------------+ | IN GWBASIC/QBASIC: | +-----------------------------+-------------------------+ | SET PORT FOR OUTPUT: | OUT 888, 32 | | SET PORT FOR INPUT: | OUT 888, 0 | | | | | OUTPUT DATA TROUGH PORT: | OUT 888, [value] | | INPUT DATA TROUGH PORT: | [varriable] = INP(888) | +-----------------------------+-------------------------+ where value is 0..255. DETAILLED DESCRIPTION OF REGISTERS ---------------------------------- Port | Description ========+================================================================== 378 HEX | Data Latch 888 BIN | Write: send byte to printer | Read: (PC/XT/old: Fetch last byte sent | Bidirectional: Read byte from connected device (when bit 5 of | port p+2 (37aH) has been set to 1). --------+------------------------------------------------------------------ 379 HEX | Read-only: Printer Status 889 BIN | +7-6-5-4-3-2-1-0+ | | | | | | |0|0|0| | +---------------+ bit | | | | | +-------> 3: -ERROR (pin 15) 0=printer signals an error | | | | +---------> 4: +SLCT (pin 13) 1=printer is selected | | | +-----------> 5: +PE (pin 12) 1=out of paper | | +-------------> 6: -ACK (pin 10) 0=ready for next character | +---------------> 7: -BUSY (pin 11) 0=busy or off-line or error --------+------------------------------------------------------------------ 37A HEX | Read/Write: Printer Controls 890 BIN | +7-6-5-4-3-2-1-0+ | |0|0| | | | | | | | +---------------+ bit | | | | | | +-> 0: +Strobe (pin 1) 1 when sending byte | | | | | +---> 1: +AUTO LineFeed (pin 14) 1 causes LF after | | | | | CR | | | | +-----> 2: -INIT (pin 16) 0 resets the | | | | printer | | | +-------> 3: +SLCT IN (pin 17) 1 selects the | | | printer | | +---------> 4: +IRQ Enable (hdwr INT when -ACK goes false) | | LPT1ÍIRQ 7 (INT 0fH) | | LPT2ÍIRQ 5 (INT 0dH) | +-----------> 5: direction (PS/2 and later ATs) | 0=write data to printer or device | 1=read data from device --------+------------------------------------------------------------------ THE LPTPORT PIN-OUT ------------------- 13 12 11 10 9 8 7 6 5 4 3 2 1 ----------------------------------------------------- \ o o o o o o o o o o o o o / \ / \ o o o o o o o o o o o o / ----------------------------------------------- 25 24 23 22 21 20 19 18 17 16 15 14 The image above shows the LPT port connector on the back of your computer. This type of connector is called '25 pin D connector female'. On the cable you want to connect to the port, you have to put a '25 pin D connector male'. Note that the pin numbers on the male connector are ordened as mirror image of the female connector, pin #1 sits where pin #13 sits on the female connector. Don't get confused, on most connectors numbers are indicated, maybe only the numbers 1, 13, 14 and 25, but that's quite helpfull already. Pin In/Out Signal Name | Pin In/Out Signal Name --- ------ ------------ | --- ------ ------------- 1 I/O -STROBE | 14 O -AUTO FEED XT 2 I/O Data Bit 0 | 15 I -ERROR 3 I/O Data Bit 1 | 16 O -INIT 4 I/O Data Bit 2 | 17 O -SLCT IN 5 I/O Data Bit 3 | 18 na Ground 6 I/O Data Bit 4 | 19 na Ground 7 I/O Data Bit 5 | 20 na Ground 8 I/O Data Bit 6 | 21 na Ground 9 I/O Data Bit 7 | 22 na Ground 10 I -ACK | 23 na Ground 11 I BUSY | 24 na Ground 12 I PE | 25 na Ground 13 I SLCT | Notes: þ The signals on pins 10, 11, 12, 13, and 15 are represented at port n+1 (where n is the printer base port; e.g., at port 379H on LPT1). See Printer Ports. þ Original PC/XT/AT Pins 1-9 can carry information in only one direction -- from the PC to the printer. þ Bidirectional PS/2 On PS/2s and most printer adaptors built after 1987, the circuits are designed to handle bidirectional I/O.