Parallel printer cable Pin Configuration
Most printers are connected to a computer using a cable with a 25 pins DB male connector at one side and a 36 pins centronics connector on the other. The normal way to make such a cable is shown here.
|Parallel Printer Cable|
|Line||DB 25 male|
|Data bit 0||2||2|
|Data bit 1||3||3|
|Data bit 2||4||4|
|Data bit 3||5||5|
|Data bit 4||6||6|
|Data bit 5||7||7|
|Data bit 6||8||8|
|Data bit 7||9||9|
|Paper out||12||12||Low=Paper OK|
|Autofeed||14||14||Low means add LF to CR|
For an "always on" printer connect pin 25 (Gnd) to pins 11 (Busy) & 12 (Paper Out) and possibly 10 (Acknowledge)
Connect Pins 1 (Strobe) and 16 (Reset) via diodes to a central point which then connects to pins 13 (Select), 15 (Error) and possibly 10 (Acknowledge)
Below is a table of the "Pin Outs" of the D-Type 25 Pin connector and the Centronics 34 Pin connector. The D-Type 25 pin connector is the most common connector found on the Parallel Port of the computer, while the Centronics Connector is commonly found on printers.
(25 PIN D-SUB FEMALE at the PC)
|12||12||Paper-Out / Paper-End||In||Status|
|15||32||nError / nFault||In||Status|
|17||36||nSelect-Printer / nSelect-In||In/Out||Control||Yes|
|18 - 25||19-30||Ground||Gnd|
Note: Direction is Computer relative Device.
The above table uses "n" in front of the signal name to denote that the signal is active low. e.g. nError. If the printer has occurred an error then this line is low. This line normally is high, should the printer be functioning correctly. The "Hardware Inverted" means the signal is inverted by the Parallel card's hardware. Such an example is the Busy line. If +5v (Logic 1) was applied to this pin and the status register read, it would return back a 0 in Bit 7 of the Status Register.
The output of the Parallel Port is normally TTL logic levels. The voltage levels are the easy part. The current you can sink and source varies from port to port. Most Parallel Ports implemented in ASIC, can sink and source around 12mA. However these are just some of the figures taken from Data sheets, Sink/Source 6mA, Source 12mA/Sink 20mA, Sink 16mA/Source 4mA,Sink/Source 12mA. As you can see they vary quite a bit. The best bet is to use a buffer, so the least current is drawn from the Parallel Port.
StrobeThe strobe line is the heart of the parallel port, it tells the printer when to sample the information of the data lines, it is usually high and goes low when a byte of data is transmitted. The timing is critical for the data to be read correctly, all bits on the data lines must be present before the strobe line goes low, to insure data integrity when the printer samples the data lines. The time needed for each byte is about half a microsecond then the the strobe line goes low for about one microsecond and then the data is usually still present for another half microsecond after the strobe goes high. So the total time needed to transmit a full byte is around two microseconds.
DataThese 8 lines carry the information to be printed and also special printer codes to set the printer in different modes like italics, each line carries a bit of information to be sent, the information here travels only from the computer to the printer or other parallel device. These lines function with standard TTL voltages, 5 volts for a logical 1 and 0 volts for a logical 0.
AcknowledgeThis line is used for positive flow control, it lets the computer know that the character was successfully received and that it's been dealt with. It's normally high and goes low when it has received the character and is ready for the next one, this signal stays low for about 8 microseconds.
BusyAs seen above (strobe line), each byte takes about 2 microseconds to be sent to the printer, this means the printer is receiving about 500,000 bytes per second (1 sec divided by 2 microseconds), no printer can print this fast, so they came up with a busy line. Each time the printer receives a byte this line will send this line high to tell the computer to stop sending, when the printer is done manipulating the byte (printing, putting it in the buffer or setting it's internal functions) it then goes back low, to let the computer know that it can send the next byte.
Paper EndAlso referred to as Paper Empty, this line will go high when you run out of paper, just like the paper out light on your printer, this way the computer will know and can tell you of the problem. When this happens the busy line will also go high so the computer stops sending data. Without this line when you would run out of paper the busy line would go high and the computer would seem to be hanged.
SelectThis line tells the computer when it is selected (or online), just like the light on your printer. When the select line is high the printer is online and is ready to receive data, when it's low the computer will not send data.
Auto FeedNot all printers treat the carriage return the same way, some will just bring the print head to the beginning of the the line being printed and some will also advance the paper one line down (or roll the paper one line up). Most printers have a DIP switch or some other way to tell your preference of how to interpret the carriage return. The auto feed signal lets your computer do the job for you, when it puts this signal low, the printer will feed one line when it gets a carriage return, by holding the signal high the software must send a line feed along with the carriage return to obtain the same effect.
ErrorThis is a general error line, there is no way of knowing the exact error from this line. When no errors are detected, this line is high, when an error is detected it goes low. Some of the errors that can arise through this line are: cover open, print head jammed, a broken belt by detecting that the head does not come back to it's home position or any other error that your printer can detect.
Initialise PrinterThis line is used to reinitialise the printer, the computer will accomplish this by putting the line, which is normally high, to it's low state. This is very useful when starting a print job, since special formatting codes might have been sent to the printer on the last job, by reinitialising the printer you are sure of not messing up the whole thing, like printing the whole document in italics or something.
Select InputMany computers give the option of letting the computer the option of putting the printer online or not, by putting this signal high the printer is kept in it's offline state and putting it low the printer is online and will accept data from the computer. Many printers have a DIP switch to let decide if the computer can control the online state, when the switch is active it will keep this line always low, thus keeping the computer from putting the printer offline.
GroundThis is a regular signal ground and is used as a reference for the low signal or logical 0.
Centronics is an early standard for transferring data from a host to the printer. The majority of printers use this handshake. This handshake is normally implemented using a Standard Parallel Port under software control.Below is a simplified diagram of the `Centronics' Protocol.
Data is first applied on the Parallel Port pins 2 to 7. The host then checks to see if the printer is busy. i.e. the busy line should be low.The program then asserts the strobe, waits a minimum of 1uS, and then de-asserts the strobe. Data is normally read by the printer/peripheral on the rising edge of the strobe. The printer will indicate that it is busy processing data via the Busy line. Once the printer has accepted data, it will acknowledge the byte by a negative pulse about 5uS on the nAck line.
Quite often the host will ignore the nAck line to save time. Latter in the Extended Capabilities Port, you will see a Fast Centronics Mode,which lets the hardware do all the handshaking for you. All the programmer must do is write the byte of data to the I/O port. The hardware will check to see if the printer is busy, generate the strobe. Note that this mode commonly doesn't check the nAck either.
The Parallel Port has three commonly used base addresses. These are listed in table 2, below. The 3BCh base address was originally introduced for Parallel Ports on early Video Cards. This address then disappeared for a while, when Parallel Ports were later removed from Video Cards. They have now reappeared as an option for Parallel Ports integrated onto motherboards, upon which their configuration can be changed using BIOS.
LPT1 is normally assigned base address 378h, while LPT2 is assigned 278h.However this may not always be the case as explained later. 378h & 278h have always been commonly used for Parallel Ports. The lower case h denotes that it is in hexadecimal. These addresses may change from machine to machine.
|3BCh - 3BFh||Used for Parallel Ports which were incorporated on to Video Cards - Doesn't support ECP addresses|
|378h - 37Fh||Usual Address For LPT 1|
|278h - 27Fh||Usual Address For LPT 2|
When the computer is first turned on, BIOS (Basic Input/Output System)will determine the number of ports you have and assign device labels LPT1, LPT2 & LPT3 to them. BIOS first looks at address 3BCh. If a Parallel Port is found here, it is assigned as LPT1, then it searches at location 378h. If a Parallel card is found there, it is assigned the next free device label. This would be LPT1 if a card wasn't found at 3BCh or LPT2 if a card was found at 3BCh. The last port of call, is278h and follows the same procedure than the other two ports. Therefore it is possible to have a LPT2 which is at 378h and not at the expected address 278h.
What can make this even confusing, is that some manufacturers of Parallel port Cards, have jumpers which allow you to set your Port to LPT1, LPT2,LPT3. Now what address is LPT1? - On the majority of cards LPT1 is 378h,and LPT2, 278h, but some will use 3BCh as LPT1, 378h as LPT1 and 278h asLPT2. Life wasn't meant to be easy.
The assigned devices LPT1, LPT2 & LPT3 should not be a worry to people wishing to interface devices to their PCs. Most of the time the base address is used to interface the port rather than LPT1 etc. However should you want to find the address of LPT1 or any of the Line PrinTer Devices,you can use a lookup table provided by BIOS. When BIOS assigns addresses to your printer devices, it stores the address at specific locations in memory, so we can find them.