• Parallel interface: lpt port. What is an “LPT” port and what is it for?

    The computer processes signals in parallel streams, so it is easier for it to “talk” to parallel rather than serial external ports. In 1984, the IBM PC first included a parallel port. It was conceived as a means of connecting dot matrix printers, hence the name LPT - Line PrinTer or Line Printer Terminal. Later, the high-speed USB interface began to be used for printers, and the LPT port began to be gradually replaced from computer specifications. Wits compare the LPT to a suitcase without a handle - it’s a shame to throw it away and impossible to carry. However, the “veteran” is still capable of a lot, if, of course, it is present in a particular computer.

    The LPT port connector has 25 pins. The “de facto” norm is considered to be a DB-25F socket in the computer and a DB-25M plug in the return cable (Table 4.2). The numbering of contacts of plugs and sockets is mirrored (Fig. 4.7, a, b).

    Table 4.2. Signal layout in the 25-pin LPT port connector

    Decoding

    Direction

    Entry/Exit

    Entry/Exit

    Confirmation

    Readiness

    No paper

    Autotransfer

    Entry/Exit

    Initialization

    Entry/Exit

    Input selection

    Entry/Exit

    Rice. 4.7. Front view of the 25-pin LPT port connectors: a) DB-25F socket in the computer; b) DB-25M plug in the connecting cable.

    Initially, the LPT port lines were unidirectional SPP (Standard Parallel Port). Some of them worked only for input, some - only for output, which, in terms of the set of signals and exchange protocol, corresponded to the Centronics printer interface. In 1994, a new parallel interface standard, IEEE 1284, was approved, providing bidirectional lines and three operating modes: SPP, EPP (Enhanced Parallel Port), ECP (Extended Capabilities Port).

    The electrical signal levels of the LPT port coincide with conventional “five-volt” logic chips. Previously, computers used TTJl buffer chips of the 74LSxx series, later - CMOS chips and LSIs, approximately equivalent to the 74ACxx series. In the latter case, we can roughly assume that the LOW level is 0.1..0.2 V, and the HIGH level is 4.5...4.9 V.

    The standard regulates a load of 14 mA for each output while maintaining a voltage of no less than +2.4 V HIGH and no more than +0.4 V LOW. However, on different motherboards, the output buffers of the LPT port may have different load capacities, including those below the standard (“weak” port).

    Requirements for connecting cables connected to the LPT port:

    Signal wires must be paired with a common GND wire;

    Each pair must have an impedance of 56...68 Ohms in the frequency range 4...16 M Hz;

    If flat ribbon cable is used, the signal wires must physically alternate with the common GND wire (local shields);

    The level of crosstalk between signals is no more than 10%;

    The cable must have a shield covering at least 85% of the outer surface. At the ends of the cable, the screen must be ringed and connected to the ground contact of the connector;

    In the cable connector, you can solder series resistors C2-23 (OMJIT-O.125) with a resistance of 100...300 Ohms onto pins 1...17 (Fig. 4.8). This will protect the computer from accidental short circuits in the load and reduce high-frequency “ringing” at signal edges.

    Rice. 4.8. Electrical diagram of an LPT cable with “anti-ringing” resistors.

    Schemes for connecting MK to an LPT port can be divided into three groups:

    Receiving signals from a computer (Fig. 4.9, a...h);

    Transmitting signals to a computer (Fig. 4.10, a...e);

    Reception/transmission of signals simultaneously (Fig. 4.11, a…e).

    Some simplifications have been made in the diagrams. The input signal is mainly “DO”, and the output signal is “ASK”, although there may be others listed in Table. 4.2. On each specific computer, the performance of homemade circuits must be checked experimentally, which is due to the presence of “strong” and “weak” LPT ports in terms of load capacity.

    Rice. 4.9. Schemes for inputting signals from the LPT port to the MK (beginning):

    a) resistor R1 limits the input current. Elements R2, C1 may be absent, but they reduce the “ringing” at the signal fronts with a long cable;

    b) buffer transistor VT1 inverts the signal. The VD1 diode is optional, but it protects the transistor from erroneously applying a large negative voltage. If you do not install resistor R2, the circuit will remain operational, however, when the cable is unplugged from the LPT port, false triggering of transistor VT1 due to external interference and interference is possible;

    c) diode VD1 cuts off interference and increases the response threshold of transistor VT1. Resistor R1 reliably closes transistor VT1 at LOW level from the LPT port;

    d) buffer logic element DD1 has an open collector output. The signal edges are formed by elements R1, C1. You can replace the DD1 inverter with a K155LP9 repeater by making the appropriate changes in the MK and computer program;

    e) Schmitt trigger DD1 (replacement - K555TL2) increases noise immunity. The lower the resistance of resistors R1, R2, the greater the steepness of the signal edges. When the cable from the LPT port is disconnected, resistor R1 prevents the input of the DD1 chip from “hanging in the air”;

    f) sequential connection of two logic elements DD11, /)/)/.2 increases (restores) the steepness of the signal edges. Resistor R1 eliminates emissions, “ringing”;

    Rice. 4.9. Schemes for inputting signals from the LPT port to the MK (end):

    g) data coming from the LPT port is preliminarily placed in the intermediate register DD1. Recording is performed at a HIGH level at the “C” input of the DD1 microcircuit, storage is performed at a LOW level. This solution eliminates interference, since random data may periodically be output to the LPT port, depending on the drivers installed in the computer. They are eliminated programmatically, for example, by repeatedly reading the input signal from the MK lines;

    h) buffering of the LPT port with powerful transistor switches located in the DA1 chip from Texas Instruments. Resistors R1...R8 can have 10...15 times lower resistance, which allows you to connect A4 chips/other device components in parallel with the outputs.

    Rice. 4.10. Schemes for outputting signals from MK to LPT port (beginning):

    a) direct connection of the MK output without buffer elements. Resistors R1, R2 reduce the reflection of signals in the line. In addition, resistor R2 protects the MK output from an accidental short circuit with the GND circuit in the connecting cable wires;

    b) Schmitt trigger DD1 serves as a protective buffer for MK in case of an emergency at the output (short circuit or high voltage);

    c) the DD1 chip has an open-collector output, which protects it from short circuits in the wires and connectors of the connecting cable;

    d) supplying two antiphase signals to the computer. Purpose - software necessity or organization of a backup (control) data transmission channel;

    e) optocoupler on elements HL1, BL1, which are used in mechanical computer mice. The KG/transistor amplifies and inverts the signal. For normal operation of the device, the computer must set the “D8” line to a HIGH level.

    Rice. 4.11. Combined input/output signal circuits between MK and LPT port (start):

    a) if the computer sets the “DO” line to a HIGH level, then MK in output mode can generate an “ASK” signal through resistor R1. If MK is switched to input mode, then the computer can transmit data to it via the “DO” line through the VD1 diode, while the internal “pull-up” resistor MK forms a HIGH level;

    b) the signal from the LPT port is input into the MK through an inverter on transistor VT1; in this case, the computer must set the “D2” line to a HIGH level. Information in MK is entered from the “DO” line through resistor R1. The high resistance of resistor R1 physically decouples the input and output channels;

    Rice. 4.11. Combined input/output signal circuits between MK and LPT port (end):

    b) the signal from the LPT port is input into the MK through an inverter on transistor VT1, while the computer must set the LOW level on the “DO” line. Information is entered into the MK through elements R1, R3, VT2;

    d) the signal from the LPT port is input into the MK through a repeater on transistor VT1, and the computer must set the “DO” line to a HIGH level. Information is entered into MK through a repeater on the DD1 chip\

    g) signals “D0” ... “D3” are entered into the MK at a LOW level on the “INIT” line, while the computer must configure lines “D4” ... “D7” as inputs. In the computer BIOS settings, you need to set the bidirectional EPP or ECP mode for the LPT port. Information is transmitted to the computer from the MK along lines “D4” ... “D7” at a HIGH level on the “INIT” line. Resistor R1 switches the outputs of the DD1 chip to the Z-state when the cable from the LPT port is disconnected;

    e) the signal from the MK to the LPT port is input through the repeater DD1.2, and the computer must set the HIGH level on the “D2” line and the LOW level on the “D5” line. Information is entered into the MK through the repeater DD1.1 at a LOW level on the “D2” line. Strobing of signals at inputs “E1”, “E2” of the DD1 microcircuit increases the reliability of data transmission.

    One of the oldest computer ports is the LPT port or parallel port. And although the LPT port can now not be seen on every motherboard, nevertheless, readers might be interested in knowing what it is.

    First of all, let's look at the port name. Perhaps not everyone knows what the abbreviation LPT stands for. In fact, LPT is an abbreviation for Line Print Terminal. Thus, it becomes clear that the LPT port was intended primarily for connecting printers. That is why the LPT port has another name - printer port. Although theoretically other devices can be connected to LPT.

    The LPT port has a long history. It was developed by Centronics (which is why this port is often called the Centronics port), which produced dot matrix printers before the PC era, in the early 1970s. And in the early 1980s, the LPT port began to be used by IBM in its computers and for some time became the standard port for connecting high-speed (at that time) devices.

    Appearance of the parallel port on the back of the computer

    The LPT interface has existed in several editions. In the original version, the LPT port was unidirectional, that is, it could transmit data in only one direction - to a peripheral device. Of course, this situation did not suit users, since there were printers that required data transfer in both directions. Therefore, the LPT interface was subsequently improved several times until its international standard IEEE 1284 was developed. In accordance with this standard, the parallel port interface supported several operating modes and was also compatible with older standards. In addition, the interface in its final version supported relatively high data transfer rates - up to 5 Mb/s.

    How the parallel port works

    The LPT port is called parallel because the cable connected to it transmits data in parallel, that is, simultaneously along several conductors. This property distinguishes a parallel port from another computer port - a serial COM port.

    There are 8 conductors that transmit the data itself in the Centronics cable. In addition, the cable contains several lines through which control signals are transmitted.

    Although the parallel port is mostly used to connect printers, there were, however, other uses for it. Firstly, using the LPT port you can directly connect two computers using a special Interlink cable. Before the widespread use of Ethernet network cards, such a connection, although it did not provide the user with high data transfer speeds, was often, nevertheless, the only way to connect two computers. There are also electronic keys designed to connect to the LPT port.

    Cable for data transfer between computers - Interlink

    As with many other devices on the motherboard, parallel port operating modes can often be configured through BIOS Setup. As a rule, BIOS options such as Parallel Port, Parallel Port IRQ, Parallel Port DMA, etc. are used for this.

    Motherboard parallel port connector and Centronics cable

    The LPT port connector is usually located directly on the motherboard, although until the mid-1990s. it was usually present on a so-called multicard inserted into an expansion slot, on which other ports of the computer were also located. The port output is a 25-pin female connector called a DB25 connector.

    ISA multicard with LPT (DB25 - “mother”) and a gaming port on board.

    To connect to the printer, a special cable is used - a Centronics cable. One end (plug) of the Centronics cable is connected to the port, the other (also plug) is connected to a special connector on the printer. The last connector has 36 pins. Therefore, the special feature of the Centronics cable is that it has different connectors on both sides.

    Appearance of the Centronics cable.

    Although the motherboard cable connector is often called the Centronics connector, strictly speaking, the Centronics connector is only a 36-pin connector for connecting to the printer, and not to the motherboard. The cable connector for connecting to the port is called an Amphenolstacker connector, from the name of the American connector manufacturer Amphenol that developed it.

    Features of the parallel port

    Due to the fact that the LPT port supports parallel data transfer, in the first PCs this port was considered one of the fastest computer ports. Transmitting data over several lines makes the LPT interface much closer in architecture to computer buses. However, this circumstance also imposes a limitation on the cable length, which, due to interference occurring in the cable, cannot exceed 5 m.

    The maximum voltage used in the port signal lines is +5 V. For simple data transmission, only ten signal lines are required - these are 8 data lines, a strobe signal line, that is, a signal that the port is ready to transmit data, and a busy line . The remaining lines are used for compatibility with the Centronics standard.

    LPT port of the “female” type with contact numbering.

    DB25 Parallel Port Connector Pinout:

    • 1 – Data strobe
    • 2-9 – Data, bits 0-7
    • 10 – Acknowledge (Confirmation from the printer)
    • 11 – Busy
    • 12 – Paper Out
    • 13 – Select (Printer active)
    • 14 – Auto Feed
    • 15 – Error
    • 16 – Init (Printer initialization)
    • 17 – Select Input
    • 18-25 – Earth

    Conclusion

    The LPT port is a personal computer interface that is now considered obsolete and does not have significant support from computer hardware and software manufacturers. However, the parallel port is still successfully used in many older models of computers and printers.

    Despite the fact that today the USB interface-port has become firmly in fashion, the LPT port remains quite in demand for amateur radio purposes. After all, in fact, it is not so important how and through which port external devices will be controlled from the computer, the result is important. Why did I decide to study the LPT port? The answer is simple, this is a fairly accessible and easy-to-learn port in terms of programming; for beginners, this is probably not a bad practical guide to mastering LPT, and in the future other ports - interfaces. In this article, I will try to familiarize in detail novice radio amateur programmers with the principles of LPT port programming. Practical programming will be shown using the Pascal and Delphi programming languages. You are required to have basic knowledge of Pascal and Delphi, and of course radio electronics, within the 10 lessons presented on the site.

    What is an LPT port?

    LPT port is the place on the computer where the printer is connected. But you can put a lot more interesting things in there. Including the schemes you came up with. For example, through the LPT port, I turned on the light in the room, implemented control of the antenna rotating device, and carried out many other experiments (measuring some parameters of radio circuits using the port, etc.).

    This is what the computer connectors and connectors look like.

    Direction

    Signal

    For simple control circuits we need conclusions:

    2 - 9 are outputs Data0-7. 18 - 25 is earth (minus). Usually (not always) they are connected to the computer case. This is the basic set of pins needed to make your own circuits. I also want to draw your attention to the output - this is "Data Strobe". As I understand it, a positive signal at this output tells the device that it needs to read the next command. If we do not power this output programmatically, the printer will simply not pay attention to the other outputs. To enter information into the port, pins 10-13, 15 are used. More details later. The port outputs can only accept 2 states - log0 and log1. When you turn on the computer, the output states change quickly, then go to log0. Depending on the type of motherboard, one or two outputs may go to log1. Further, when loading Windows OS, the states of the inputs may change again. After loading is complete, the system does not touch the outputs until printing or “searching for equipment” begins. Examples of circuits for debugging programs when working with an LPT port and more. In this section, I will try to give several examples of circuits controlled using an LPT port. I think that these The circuits are quite enough to study the principles of the port's operation. When I started programming the LPT port, I soldered myself a small circuit. It seems to me that this is the simplest and most obvious example for studying, I advise you to solder the same circuit for yourself without putting it off. It will be useful to us throughout the lessons:

    All resistors in the circuit are 270 - 470 ohms, depending on the selected LEDs. Resistors here limit the current consumption. According to the standard, the voltage between the signal pin and ground should be no more than 2.4V - 2.6 mA. Those. very little, but in fact modern motherboards are designed for heavy loads and very often have short circuit protection. In any case, the port must be handled very carefully, because... Without it, the computer motherboard may refuse to work at all. Here is the simplest relay connection diagram:

    I think there is no need to explain anything here. Data is one of the outputs of the LPT port, for example, pin 2 (Data-0). If log1 appears on it, the transistor will open, relay K1 will operate and connect some more powerful load.. In this circuit, the LPT port is directly connected to the transistor and if it breaks down, the data output may contain a voltage that is dangerous for the port. To protect the port, galvanic isolation must be used. Circuit using an optocoupler.

    In this scheme, the port is separated from the high-voltage part and is almost not in danger. In this circuit I installed a 4N25 opto-isolator - the cheapest and smallest. The coil in the diagram is a 12 volt relay. During the experiments, I connected the RES22 relay to this circuit, and a table lamp to it. For testing, I wrote a program that controlled the lamp by the clock...
    By the way, here is an example of controlling a triac:

    I simply plugged this circuit in place of the switch for the main lighting in my room. So, we have looked at some simple circuits that can be safely used in our experiments with an LPT port, and later taken as a basis when developing controlled devices. And so, from this article you learned what an LPT port is and how it can be used for amateur radio purposes. We also gave examples of the simplest radio circuits that we will use for further experiments. Let's move on to the theory and practice of LPT port programming.

    |

    LPT port is the place on the computer where the printer is connected. But you can put a lot more interesting things in there. Including the schemes you come up with. For example, through the LPT port, the lights in the room were turned on, the lock on the door was opened and the radio was turned off.

    This is what the connector looks like on a computer.

    It has 25 pins:

    N Direction Signal
    1 Exit Data Strobe
    2 Exit Data 0
    3 Exit Data 1
    4 Exit Data 2
    5 Exit Data 3
    6 Exit Data 4
    7 Exit Data 5
    8 Exit Data 6
    9 Exit Data 7
    10 Entrance Acknowledgment
    11 Entrance Busy
    12 Entrance Paper Out
    13 Entrance Select
    14 Exit Auto feed
    15 Entrance Error
    16 Exit Init
    17 Exit Select Input
    18-25 Ground

    For simple control circuits we need conclusions:
    2 - 9 - these are outputs Data0-7.
    18 - 25 - this is earth (minus). Usually (not always) they are connected to the computer case.
    This is the basic set of pins needed to make your own circuits.

    I would also like to draw your attention to the conclusion 1 - this is "Data Strobe". As I understand it, a positive signal at this output tells the device that it needs to read the next command. If we do not power this output programmatically, the printer will simply not pay attention to the other outputs.

    Pins are used to enter information into the port 10-13, 15 . More details later.

    Port outputs can only accept 2 states - log0 And log1. When you turn on the computer, the output states change quickly, then go to log0. Depending on the type of motherboard, one or two outputs may go to log1. Further, when loading the Windows OS, the vldov states may change again. After loading is completed, the system does not touch the outputs until printing or “search for equipment” begins.

    Source: zps-electronics.com


    This diagram is also often viewed:

    A parallel interface port was introduced into the PC to connect a printer - an LPT port (Line PrinTer - line printer).

    The parallel interface adapter is set of registers, located in the I/O space. Port registers are addressed relative to the port base address, the standard values ​​of which are 386h, 378h, and 278h. The port has external 8-bit data bus 5-bit tire signals state and 4-bit control signal bus.

    The BIOS supports up to four LPT ports (LPT1-LPT4) with its INT 17h interrupt service, which provides communication with printers via the Centronics interface. With this service, the BIOS performs character output, interface and printer initialization, as well as printer status polling.

    Centronics interface

    The term Centronics refers to both the set of signals and communication protocol, as well as the 36-pin connector installed on printers. The purpose of the signals is given in table. 1.

    Table1.

    Centronics Interface Signals

    Purpose

    Data strobe. Data is captured by low signal level

    Data lines. Data 0 (pin 2) - least significant bit

    Acknowledge - a byte confirmation pulse (a request to receive the next one). Can be used to generate an interrupt request

    Busy. Data reception is only possible when the signal level is low

    A high level signals the end of paper

    Signals that the printer is turned on

    Automatic line translation.

    Error: Paper End, OFF-Line or Internal Printer Error

    Initialization

    Printer selection (low level). When the level is high, the printer does not perceive other interface signals

    Common interface wire

    Direction

    (input/output) in relation to a printer.

    The Centronics interface is supported by most printers with a parallel interface; its domestic analogue is the interface IRPR-M.

    Traditional lpt port

    The traditional SPP (Standard Parallel Port) port is a unidirectional port on the basis of which the Centronics exchange protocol is implemented in software. The port provides the ability to generate a hardware interrupt request based on a pulse at the ACK# input. Port signals are output to connectorDB-25S(socket) installed directly on the adapter board (or system board) or connected to it with a ribbon cable. The name and purpose of the port connector signals (Table 2) correspond to the Centronics interface.

    Table 2.

    Standard LPT port connector

    Contact DB-25S

    Loop wire

    Purpose

    18, 20, 22, 24, 26

    * I/O sets the direction of transmission (input/output) of the port signal; 0/I denotes the output lines whose state is read by reading from the corresponding output ports.

    **The symbol “\” marks inverted signals (1 in the register corresponds to a low line level).

    ***The Ack# input is connected by a resistor (10kOhm) to the +5V supply.

    The standard port has three 8-bit registers, located at adjacent addresses in the I/O space, starting from the base address of the port (BASE).

    Data Register (DR) - data register, address= BASE.Data written to this port is are displayed to the output lines of the interface. Data read from this register, depending on the circuitry of the adapter, corresponds either to previously recorded data or to signals on the same lines.

    Status Register (SR) -status register representing 5-bit input port printer status signals (bits SR.4-SR.7), address = BASE+1. BitSR.7 is inverted - a low signal level corresponds to a single bit value in the register, and vice versa.

    Purpose of status register bits(numbers of connector contacts are given in parentheses):

    SR.7-Busy - inverse display of Busy line state (11);

    SR.6 -ACK (Acknowledge) - displays the state of the Ack# line (10).

    SR.5 -PE (Paper End) - displays the status of the Paper End line (12).

    SR.4-Select - displays the state of the Select line (13). A single value corresponds to the signal to turn on the printer.

    SR.3-Error - displays the state of the Error line (15).

    SR.2 - PIRQ - interrupt flag for the Ack# signal (only for the PS/2 port). The bit is cleared if the Ack# signal caused a hardware interrupt. The single value is set by hardware reset and after reading the status register.

    SR - reserved.

    Control Register (CR) - control register, address=BA5E+2. Like the data register, this 4-bit output port can be written and read (bits 0-3), but its output buffer is usually of type open collector. This allows you to more correctly use the lines of this register as input when programming them to a high level. Bits O, 1, 3 are inverted - a single value in the register corresponds to a low signal level, and vice versa.

    Purpose of control register bits:

    CR - reserved.

    CR.5 - Direction - transmission direction control bit (for PS/2 ports only). Writing one turns the data port into input mode.

    CR.4 -ACKINTEN (Ack Interrupt Enable) - a single value allows interruption when the signal falls on the Ackff line - the next byte request signal.

    CR.3 - Select In - a single bit value corresponds to a low level at the Selecting output (17) - a signal that allows the printer to operate via the Centronics interface.

    CR.2 - Init - zero bit value corresponds to a low level at the output Imt# (16) - printer hardware reset signal.

    CR.1 - Auto LF - a single bit value corresponds to a low level at the output Auto LF# (14) - a signal for automatic line feed (LF - Line Feed) upon receipt of a carriage return byte (CR - Carriage Return).

    CR.O -Strobe - a single bit value corresponds to a low level at the output Strobeff (1) - the output data strobe signal.

    Hardware Interrupt Request(usually IRQ7 or IRQ5) is generated by the negative signal drop at pin 10 of the interface connector (ACK#) when CR.4 = 1. The interrupt is generated when the printer acknowledges receipt of the previous byte.

    Byte Output Procedure via the Centronics interface via a standard port includes the following steps (the required number of processor bus operations is given in parentheses):

    Output byte to data register (1 cycle IOWR#).

    Input from the status register and checking the readiness of the device (bit SR.7 - BUSY signal).

    Upon receipt of readiness, the output sets the data strobe in the control register, and the next output removes the strobe (2 cycles lOWRff).

    The standard port is highly asymmetrical - while there are 12 lines (and bits) that normally work as output, only 5 status lines work as input. If symmetrical bidirectional communication is required, it works on all standard ports nibble mode - Nibble Mode. In this mode, also called Hewlett Packard Bitronics, 4 bits of data are transmitted simultaneously, the fifth line is used for handshaking.