Ltp connector. Features and principle of operation of the lpt printer port

One of the oldest computer ports is the LPT port or parallel port. And although the LPT port can now be seen far from any motherboard, however, readers may be interested to know what it is.

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

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

External view 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, subsequently, the LPT interface was improved several times until its international standard IEEE 1284 was developed. In accordance with this standard, the parallel port interface supported several modes of operation 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 in the cable connected to it, data is transmitted in parallel, that is, simultaneously along several conductors. In this property, a parallel port differs from another port on a computer - serial port com.

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

Although the parallel port is mostly used for connecting printers, there were other uses for it. Firstly, using the LPT port, you can directly connect two computers - using a special Interlink cable. Before widespread network cards An Ethernet-like connection, although not providing the user with a high data transfer rate, was often, however, the only way to link two computers. There are also dongles designed to connect to the LPT port.

Cable for data transfer between computers - Interlink

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

Motherboard parallel 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 the so-called multi-card inserted into the 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 game port on board.

To connect to the printer, a special cable is used - the Centronics cable. One end (male) of the Centronics cable is connected to the port, the other (also male) to a special printer connector. The last connector has 36 pins. Therefore, a 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 referred to as a Centronics connector, strictly speaking, a Centronics connector is only a 36-pin connector for connecting to a printer, not to a motherboard. The cable connector to connect to the port is called the Amphenolstacker connector, after 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. The transmission of data over several lines brings the LPT interface closer in architecture to computer buses. However, this circumstance also imposes a limitation on the length of the cable, which, due to interference occurring in the cable, cannot exceed 5 m.

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

Female LPT port with pin numbering.

DB25 Parallel Port Connector Pinouts:

  • 1 - Data strobe
  • 2-9 - Data, bits 0-7
  • 10 - Acknowledge (Confirmation from the printer)
  • 11 - Busy (Busy)
  • 12 - Paper Out (Out of paper)
  • 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 lacks significant support from computer hardware manufacturers and software. However, the parallel port is still successfully used in many older computers and printers.

We highly recommend getting to know him. You will find many new friends there. Moreover, it is the fastest and effective way contact project administrators. The Antivirus Updates section continues to work - always up-to-date free updates for Dr Web and NOD. Didn't have time to read something? The full content of the ticker can be found at this link.

Working with LPT port in Win NT/2000/XP

LPT port (L ine P rin T er) is a parallel interface port, which was originally created for connecting a printer. The BIOS provides the LPT port support required for Centronics output. The port address space occupies the range &H378-&H37F

The LPT port has 12 output and 5 input lines. Such a fairly large number of lines makes possible connection to the port of simple equipment, perhaps not even having its own microcontroller. Therefore, this port, despite the disappearance of printers with an LPT interface, is actively used to connect simple memory chip programmers, JTAG interfaces for flashing (replacing software) satellite receivers, DVD players and other electronic equipment. The LPT port is also popular with modders, because it allows you to connect LCD displays to your computer without making complex interface boards.

Windows 2000/XP does not allow applications to access I/O ports directly. To do this, you need to use a driver that works in KERNEL-mode (in the kernel mode of the operating system).

Restricting access to I/O ports for regular application programs (running in user mode) makes the operating system more stable. Although, on the other hand, no one prevents the programmer from writing a driver that accesses ports.

Interestingly, for Intel processor x86, you can write a driver that takes one of two fundamentally different approaches. The first option is that the driver itself accesses the ports, and the application program only tells the driver what to do. This option is generally standard and preferred.

To solve the problem, there are four popular driver options that allow an application program to access I/O ports: DLPortIO, driver User Port, driver GiveIO.sis, driver Port95nt.

All four options are almost equivalent.

DLPortIO Driver

DLportIO - port access driver from the package DriverLINX by Scientific Software Tools, Inc. (http://www.sstnet.com) in an abbreviated form (without description and unnecessary documentation). For the normal operation of LCD maintenance programs, it is recommended to this version of the driver.

The driver itself consists of two components:
. DLPortIO.dll - Win32 DLL that provides hardware I/O and
. DLPortIO.sys - driver for WinNT operating in OS kernel mode (not required for Win95/98)

In the driver installation package, in addition to these two components, there is also an Install.exe file that moves the above two to the folder Windows drivers and registering them in the system.

There is nothing more to write about this driver. No setup required. Download, install, use. Do not forget to look at the end of the article and read about the LPT port performance.

Installation is elementary - run the Install.exe file, install. At the end of the installation, look into the C:\Windows\System32\drivers folder and check for the presence of two driver files (DLPortIO.sys and DLPortIO.dll). If we see that these files have not been copied, we take them from installation package and copy manually. Don't worry, nothing bad will happen to your computer. We reboot the computer and work with the LPT port.

If suddenly, as a result of manipulations with the equipment, you receive a message from the driver like this: "dlportio.sys device driver not loaded. Port I / O will have no effect", do not panic. This problem is fixed like this:
. We start regedit.
. We go in the registry to the branch HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.
. In the dlportio folder, change the value of the parameter Start on 1 .
. We restart the computer.

User Port Driver

Driver User Port opens access to ports in Win NT/2000/XP for programs. This version of the LPT port driver is most often used by "techies" who work with programmers and JTAGs, since the driver has at least some configuring settings. It can also be used to run LCD service programs.

There are three files in the driver archive:
. UserPort.sys - driver for WinNT, operating in OS kernel mode,
. UserPort.exe - program for setting up the driver and
. UserPort.pdf - description file.

Setting UserPort:
. 1. Unzip the archive into a separate folder.
. 2. Copy the UserPort.sys file to C:\Windows\System32\drivers

User Port setting:
. Run UserPort.exe.
. A panel with 2 windows will appear in front of us.

The left window refers to the work of the program in the DOS window, the right one to full screen. By default, they contain LPT port numbers - all of them can be removed using the "Remove" button. In both windows, you need to enter the desired port numbers that you plan to use.

For use from the driver with most programmers, JTAGs, and display service programs, add the following options to the left column:
378 , 379 and 37A for LPT1
278 , 279 and 27A for LPT2(If the LPT port address is reassigned in the BIOS).

Let me explain what the numbers mean. 0x378 is the port address.
. The address 0x378 called basic and is used for writing and reading data to and from the port, over the data bus D0-D7.
. The address 0x379 (base+1) created for bit reading status from the device connected to the LPT port.
. The address 0x37A (base+2) serves for bit records control of the device connected to the LPT port.

Add like this:
0x378-0x378
0x37A-0x37A



You need to add port addresses to the list through the input window and using the "Add" button. The address 0x379 most often it is not needed and it can be omitted, since it is intended for bit reading states from a device connected to the LPT port, and most devices (programmers, JTAG "and even more so LCD indicators) do not generate status signals. If you wish, you can, on the contrary, enter the entire range of addresses allocated by the system for the LPT port 0x378-0x37F.

We go to Control Panel, System, select the Hardware tab, Device Manager, go to Ports (COM and LPT) and look at the properties of the LPT port on which you want to establish a connection. In Properties, open the Resources tab and look at the value of the parameter Input/output range (I/O). (Usually in Windows XP it is 378-37F)

After generating the list of addresses, you need to press the "Start" button, the driver will be launched and a message will appear:



Then click the "Update" button, the driver will be registered in the system, then "Exit". Of course, the "Stop" button does not need to be pressed while we are using the driver.

If the system reboots when you click the "Update" button, you should try to start registering the driver on the system with administrator rights or try to temporarily disable the firewall or antivirus, which can block interference in system processes. If something doesn't work, read UserPort.pdf

To check if access to ports has appeared, you can run the program "lpt test.exe".

After starting the program, a window will appear with the following content:



The absence of the message "LPT port is being tested (Address XXXh)" and the lines following it indicates that the driver is not working.

This program simply sends to the Dx data register and the Ux control register of the LPT port various numbers and then reads them. The Sx status register of the LPT port is read only. The number and address of the tested LPT port is displayed on the screen. If the port is healthy, then no messages should be issued for the Dx and Ux registers.



LPT-TEST v1.03 1995-2003 Copyright (C) S. B. Alemanov. Moscow "BINAR".
During testing, no peripheral devices should be connected to the ports.
Dx - reg. data (out), Ux - reg. control (out), Sx - reg. status (inp).

Port LPT1 is being tested (Address 378h)
2nd contact (D0) - no "1"
3rd pin (D1) - no "1"
4th pin (D2) - no "1"
5th pin (D3) - no "1"
6th pin (D4) - no "1"
7th pin (D5) - no "1"
8th pin (D6) - no "1"
9th pin (D7) - no "1"
1st contact (U0) - no "1"
14th pin (U1) - no "1"
17th pin (U3) - no "1"
1st contact (U0) - no "0"
14th contact (U1) - no "0"
17th contact (U3) - no "0"
15th contact (S3) - no "0"


If the Dx or Ux registers are faulty, then the message "no 0" or "no 1" is displayed and the pin number on the LPT connector is indicated (the signals on this pin can be viewed with an oscilloscope). The Sx status register input can be either "0" or "1", but usually, when nothing is connected to the LPT port, all status register inputs have a "1". The appearance of the "0" status register at the input may be a sign that the input has been broken, if earlier there was always a "1" there.
On some machines, if the data register or the control register is faulty, then access to the LPT port does not appear at all. Apparently, when the computer is turned on, the BIOS tests the LPT port and, if it is faulty, then disables it.

If problems arise, it is possible that some drivers are interfering with the work, periodically sending pulses to the LPT port (this can be seen with an oscilloscope). For example, you can disconnect from the LPT port in the printer settings:
disable LPT1: Printer port
enable FILE: Print to file

After all problems are fixed and the test is passed, access to the ports should appear and you can run a program using the LPT port. Otherwise, the device connected to the port on such a machine will not work.

GiveIO.sys driver

Back in 1996, the American programmer Dale Roberts conducted a series of experiments, which resulted in a driver GiveIO.sys. Until now, this driver remains one of the popular tools that allow an application program to access I / O ports.

The author of the driver himself strongly recommends that this driver be used for debugging purposes only. final version application program instead of independently accessing I / O ports, it should entrust this matter to a driver written specifically for this purpose. The driver should behave "correctly" by checking to see if the device is already in use by some other application.

However, if you are absolutely sure that no one else uses the required I / O ports (for example, you do not have a printer connected to the LPT), you can safely use the GiveIO.sys driver.

Driver installation:

1. Download the archive, unpack and copy the GiveIO.sys file to the C:\Windows\System32\Drivers directory (it is assumed that your Windows is installed to the C:\Windows directory).
. 2. Run the install.reg file. The following message will appear on the screen:


. 3. We answer in the affirmative. A message will appear stating that the information has been successfully entered into the registry. If you wish, you can verify this. We launch the registry editor regedit.exe and in the branch HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\giveio check for the following entries:


. 4. We reboot the computer and check the operation of programs that use the driver.

driver GiveIO.sys people actively use, and, over time, appeared and other installation options.

For example, a driver GiveIO.sys if there is a file with "hardware information" GiveIO.inf can be installed via the "Install Hardware" applet.




We will show the GiveIO.sys driver to the operating system so that it believes in the existence of the "GiveIO" hardware.

Download a set of files for this driver installation option GiveIO.sys(giveio_sys_v2.rar - 78kb). The archive contains the files GiveIO.sys and GiveIO.inf, as well as detailed instructions for installation with illustrations.

In addition to the options for "manual" driver installation, several installer options have been written that perform the installation in automatic mode.

Download a set of files for automatic installation drivers GiveIO.sys(giveio_sys_install.rar - 28kb). The archive contains the GiveIO.sys and instdrv.exe files, as well as the remove-giveio.cmd file, with which the driver GiveIO.sys can be removed from the system.

Port95nt driver

The term " driver Port95nt" will not be quite correct here. In fact, this is the same driver DLPortIO from the package DriverLINX from Scientific Software Tools, Inc., only in its full version, with a couple of port management utilities, with a description and many examples for programmers. For an ordinary user, there is no benefit from additional components, and the components of the DLPortIO.sys and DLPortIO.dll driver are exactly the same as in the reduced version.

Mentioned Port95nt as a driver for two reasons. The first is for completeness of the list of references to LPT port drivers found on the Internet.

The second reason is that in some cases there may be problems installing a reduced version of DLPortIO under WinXP. Usually, but infrequently, this happens in stripped-down "author" builds of WinXP. In this case, you can take full version installer (1.5MB). Although, in my opinion, it will be faster to manually put DLPortIO.sys and DLPortIO.dll into the right folder than to bother with the selection of an installer that can do it for you.

Additional measures

In addition to installing one of the above drivers, for the normal operation of the LPT port under WinXP, you need to edit the registry using a REG file xp_stop_polling.reg(xp_stop_polling.rar - 0.48kb)

Under WinXP, devices using the LPT port sometimes work unstable. The reason for such failures may be the work of the Plug-and-Play (PnP) subsystem in Windows, periodically polling the LPT in order to detect connected devices. Such a poll is performed when the system boots, but it can also occur during operation. Unfortunately, the DLportIO.sys driver and other driver options do not block access to LPT from other programs when working with the client port of this driver, and the PnP subsystem is sure that the port is not busy, accesses it and disrupts operation external devices. To fix the problem and use the .reg file xp_stop_polling.reg. This file is registered in the registry windows key, which prohibits such a poll (poll) while the system is running.

In addition to installing the driver and restricting simultaneous access to the port for programs, in order to ensure hardware compatibility and normal operation of equipment with an LPT port, it is necessary to set the BIOS to correct address and port operation mode("Normal", SPP or EPP, but not ECP).

The following parameters are subject to configuration via BIOS Setup:

Base address, which can be 378h, 278h, and 3BCh. During initialization, the BIOS checks for the presence of ports at addresses in this order and, accordingly, assigns the logical names LPT1, LPT2, LPT3 to the detected ports. The 3BCh address has a port adapter located on the MDA or HGC board (the forerunners of modern graphics cards). Most ports are configured to address 378h by default and can be switched to 278h.

The interrupt request line used, IRQ7 is usually used for LPT1, IRQ5 for LPT2. Many "desktop" applications do not use printer interrupts, and this scarce PC resource can be spared. However, when using ECP (Fast Centronics) speed modes, interrupt operation can significantly increase performance and reduce processor load.

At the same time, ECP mode cannot be used with devices that require tight timings (programmers and JTAG interfaces).

In conclusion, a little about terminology:

. SPP(Standard Parallel Port - standard parallel port). Often, for ease of understanding, in the BIOS, "e" is denoted by the term " Normal".
. EPP(Enhanced Parallel Port - extended parallel port) - high-speed bidirectional interface option. The purpose of some signals has been changed, the possibility of addressing several logical devices and 8-bit data input has been introduced, a 16-byte hardware FIFO buffer has been introduced. The maximum exchange rate is up to 2 Mb/s.
. ECP(Enhanced Capability Port) is an intelligent version of EPP. The possibility of dividing transmitted information into commands and data, support for DMA and compression of transmitted data using the RLE method (Run-Length Encoding - encoding of repeated series) has been introduced.

LPT EEE 1284 (English Line Print Terminal) is an international standard for a parallel interface for connecting peripheral devices of a personal computer. The name LPT is derived from the name standard device printer LPT1 (Line Printer Terminal or Line PrinTer) in operating systems of the MS-DOS family.

Standard IEEE 1284defines a bidirectional port variant that allows simultaneous transmission and reception of data bits.This standard is based on the Centronics interface and its extended versions (ECP, EPP). IEEE 1284 standard with was the result of a long struggle to ensure compatibility. Standard includes a formal description of all operating modes of the LPT port. Prior to the adoption of this standard, there was no formal document that, if followed, could count on correct work devices in all possible configurations.

Basically, the LPT port is used to connect a printer, scanner, and other external devices to a computer. Also LPT port often used to connect external storage devices.It can be used to organize communication between two computers, connect any telesignaling and / or telecontrol devices.

The IEEE-1284 standard is not being developed at this time. The final standardization of the parallel port coincided with the start of implementation USB interface, which also allows you to connect an MFP and provides more high speed printing and reliable operation of the printer. Another alternative to the parallel interface is the Ethernet network interface.

History

Initially, the LPT port was physically absent on the motherboard and was implemented by an additional expansion card inserted into one of the ISA expansion slots on the motherboard. The parallel port was usually used - for a printer or scanner, for which the transfer of a large amount of data was not time-critical. Later, parallel port support was integrated into the chipsets that implement the motherboard logic.

Centronics Parallel Port - A port used since 1981 in personal computers from IBM for connecting printing devices, developed by Centronics Data Computer Corporation. Initially, this port was designed for simplex (unidirectional) data transfer only, as it was assumed that the Centronics port should only be used with a printer. Subsequently, different companies developed duplex interface extensions (Byte Mode, EPP, ECP). Then the international standard IEEE 1284 was adopted, describing how basic interface Centronics and all its extensions.

General information

The IBM standard defines 3 parallel I/O ports, which are provided in the PC BIOS and in all versions of DOS. In the address space of the computer, the base addresses of these ports are reserved: 3BCh, 378h, 278h.

On IBM-compatible computers, parallel ports are assigned special logical names supported by the system: LPT1, LPT2, LPT3. These logical names do not have to be the same as specified addresses I/O ports. At boot, the system analyzes the presence of parallel ports at each of the three base addresses. Ports are always searched in the following order: 03BCh, 0378h, 0278h. The first found parallel port is assigned the logical name LPT1, the second - LPT2, the third - LPT3. As a result of implementing this naming scheme, the system will always have an LPT1 port, regardless of the I/O port address assigned to it, provided that the computer physically has this parallel port.

bios

The port addresses assigned to each LPTx slot can be determined by reading the BIOS data area at address 0000:0408.

Onboard Parallel Port - This option sets the I/O address and interrupt number for the parallel LPT port. This option depends on BIOS versions, specifies either the address and interrupt used by the parallel (LPT) port, or only the address (the interrupt is set by a separate option located nearby).

Option values:

378H / IRQ7 - address 378H and interrupt IRQ7;

278H / IRQ5 - address 278H and interrupt IRQ5;

3BCH/IRQ7 – 3BCH address and IRQ7 interrupt;

Auto - automatic detection of the I / O address and interrupt number;

Disabled - disables the LPT port.

Parallel Port Mode- This option sets the operation mode of the parallel LPT port.

Phoenix Settings Page Example - Award Bios

Option values:

Normal or SPP - the simplest unidirectional or standard (Standard Parallel Port);

Bi-Dir, Bi-Directional or BPP - bi-directional (Bi-Directional);

EPP - improved parallel port (Enhanced Parallel Port);

ECP - Enhanced Capabilities Port;

ECP+EPP - support for two modes - Enhanced Capabilities Port and Enhanced Parallel Port.

The best choice is to select "Enhanced Capabilities Port - ECP", which will provide top speed communication between a computer and a peripheral device.

If the equipment connected to this parallel port of the PC is unstable, you can gradually reduce the mode used up to the standard one. In some cases, setting bidirectional (Bi-Directional) or combined (Enhanced Parallel Port and Enhanced Capabilities Port) modes helps.

ECP DMA Select- In case the parallel port is operating as a high-speed port with enhanced ECP capabilities (Enhanced Capabilities Port) or ECP+EPP ( Enhanced Capabilities Port and Enhanced Parallel Port) , it needs to allocate a direct memory access (DMA) channel. The default value is channel number 3.

System Properties - Hardware - Device Manager - Ports (Com & LPT) - LPT Port - Resources

Note: AT Windows versions who do not use Windows kernel NT (like DOS and some other operating systems), programs can access the parallel port using the outportb() and inportb() routines. In operating rooms Windows systems NT and Unix (NetBSD, FreeBSD, Solaris, 386BSD) the security mechanism built into the 80386 processor is enabled and access to the parallel port is denied unless specified correct driver. This restriction improves security and facilitates conflict resolution when accessing the device.

Port operation mode

The standard allows using the interface in several modes:

  • SPP(Standard Parallel Port) - unidirectional port, fully compatible with Centronics interface.
  • Nibble Mode- allows you to organize bidirectional data exchange in SPP mode by using control lines (4 bits) to transfer data from a peripheral device to a controller. Historically, this has been the only way to use Centronics for two-way communication.
  • Byte Mode- rarely used mode of two-way data exchange. Used in some older controllers before the adoption of the IEEE 1284 standard.
  • EPP(Enhanced Parallel Port) - developed by by Intel, Xircom and Zenith Data Systems - bi-directional port, up to 2 MB/s data rate (1991)
  • ESR(Extended Capabilities Port) - developed by Hewlett-Packard and Microsoft - in addition, features such as the presence of hardware data compression, the presence of a buffer and the ability to work in DMA mode have appeared.

Pinout LPT DB25F

Pinout LPT Centronics (CN36)

LPT port emulation (IEEE 1284) under OC Windows

#1: Using a PCI compatible expansion card for a personal computer.

Example PCIe expansion card with LPT port EPP

PCI(Eng. Peripheral Component Interconnect) - an input / output bus for connecting peripheral devices to the computer motherboard.

System Properties - Hardware - Device Manager - Ports (Com & LPT) - PCI LPT Port - Resources

Note: Most often, when installing a PCI Card LPT, the I / O addresses will be different from the standard / basic ones, as a result of which almost all programmers and LPT keys will not work or will work incorrectly.

The actual I/O address depends on the operating system and will be chosen randomly. The I/O address will not be changed unless the PCI card is moved to another PCI slot.

IEEE1284 1-port and 2-port PCI boards are commercially available.

AT technical description to PCI expansion cards with LPT interface, the possibility of using the standard address space for I / O (input / output) is indicated, however, the possibility of setting I / O resources is determined by the type of operating system used.

In operating systems MS Windows 95/98/ME, DOS, it is possible to set parameters corresponding to standard ISA LPT ports. C b In more modern operating systems (eg Windows 2000/XP/Vista), allocation of I/O resources occurs without user or administrator involvement.In some cases, this may lead to the impossibility of the controller to work in some modes, and largely depends on the hardware configuration and the type of operating system used.

The LPT interface port (other names are parallel or printer port) is used in personal computers to connect various peripheral devices. In practice, with its help, printers were most often serviced. The focal area of ​​application of the interface is directly reflected in its English name: the abbreviation LPT is derived from Line Print Terminal.

After the advent of the USB interface, it quickly began to lose its popularity and is now rarely used for its intended purpose.

Execution of the LPT port

The LPT port is made in parallel based on the Centronics interface and is physically made as a 25-pin double row DB25 connector. The cable part is made according to the plug scheme, respectively, the socket forms the instrumental part of the interface.

Photo LPT connector on the motherboard

There are 13 contacts in the bottom row, while the remaining 12 are in the top row.

The correct polarity of the connection in the assembled state of the connector is ensured by the use of a mechanical interlock provided by a rigid trapezoidal metal skirt mounted on the socket. This constructive component additionally assumes the functions of an external circular screen.

Due to the large mass of the cable, the plug of the connecting cord in the assembled state of the connector is additionally fixed to the socket with two captive screws. This allows you to achieve the desired level of operational reliability.

Pinout wiring diagram

Pinout lpt port, despite the large number of contacts of the interface connector, it turns out to be quite simple and is shown in the table.

A sufficiently large number of service and service signals is due to the need to control the operation of the printer and support its interaction with a computer. This ensures only unidirectional data transfer.

Due to comparative short distance between individual contacts connector after soldering the wires, they are additionally insulated with short lengths of cambric, put on tight, or with a heat shrink tube.

As a cable, twisted pairs or twisted pairs protected by individual screens can be used. Use of a flat stub cable is acceptable. The total length of the cord must not exceed 3 m.

Will cause such interest among programmers and electronics engineers, because. I received a lot of letters with questions and continue to receive them to this day, although it has been almost three years since the article was written. In addition, in the first article a number of inaccuracies. All this prompted me to write a more detailed article on this topic, in which I will try to answer most of the questions of dear readers and correct those inaccuracies that were made in the first article. Let the readers of the first article not take offense at me, but we will again consider in detail each contact and bit of our LPT port. In the first part of the article, the theory will be considered, in the second and subsequent (if any) we will consider electronic devices, which can be "picked up" to this port.

In the text you will meet with the generally accepted abbreviation for writing numbers. For example, 1010 2 - two in the subscript indicates that the number5 represented in binary,124 10 - ten in the subscript, indicates that the number124 decimal. It's like that...just in case

As practice has shown, all programs that are correctly written and supplemented with the appropriate libraries (vbio32.dll, inpout32.dll, dlportio.dll, etc.) work on most computers with operating systems Windows families. I tested all my programs (Visual Basic5.0, 6.0) on Win95, 98, Me, 2000, XP HE, XP Prof and even DOS6.22 (QBasic) - everything works fine. In DOS, no libraries are needed at all, everything works there anyway. Immediately make a reservation that vbio32.dll and inpout32.dll WILL NOT WORK UNDERWin2000, but they will work quite calmly under Win95, 98, Me.

By the way, you can take any of these libraries. I wanted to try dlportio.dll and in this moment I am working with this library. And finally, before writing programs, you must correctly declare the library you are using.

For inpout32.dll

Private Declare Function Inp Lib "inpout32.dll" Alias ​​"Inp32" (ByVal PortAddress As Integer) As Integer

Private Declare Sub Out Lib "inpout32.dll" Alias ​​"Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)

For dlportio.dll

Private Declare Function DlPortReadPortUchar Lib "dlportio.dll" (ByVal Port As Long) As Byte

Private Declare Sub DlPortWritePortUchar Lib "dlportio.dll" (ByVal Port As Long, ByVal Value As Byte)

What is the difference Private from Public I will not write.

The parallel port for communicating with a printer (or other device) has a base address of &H378 (LPT1), &H278 (LPT2), &H3BC (LPT3). In this article, we will consider only LPT1. The address space for this port is in the range &H378-&H37F.

· The address & H378 called basic and serves to write (read, but more on that later) data to the port, on the D0-D7 line.

· The address & H379 (basic+1) designed to read status bits from a device connected to the LPT port (printer, scanner, etc.)

· The address & H37A (basic+2) is used to write the control bits of the device connected to the LPT port (printer, scanner, etc.).

In the tables below, the contacts and signals of each of the addresses are “decoded”

Contacts 18-25 - "ground" (common, GND, GROUND, etc.)

Consider programming each of the addresses.

· The base address &H378 (LPT1) allows data to be written to the port on line D0-D7 in the range 0 to 255.

We write the number 69 to the port

· Address &H379 is used to read the status bits.

Read the port status at &H379

When reading the &H379 address, remember that the first three bits are not used and always have a log value. "1", and the 7th bit is inverted. As a result, if all pins 15, 13, 12, 10, 11 are grounded, then when reading information, you will get 1 + 2 + 4 on the first three bits (which are not used) and on the 7th bit (pin 11- inverse, which means that when there is a ground fault, there will be a log "1") +128 total 135. We should not forget about this. In the second part of the article, we will dwell on this in more detail.

Address & H37 A is used to write control bits.

We write the signal -STROBE (control bit 0)

Why 10? Let's look at the table.

The STROBE, AUTO, SELECT IN signals are inverse, which means that in order to get a logical “1” at the output of connector pins 1, 14, 17, you must apply a logical “0” to these bits, i.e. Give one thing, get the opposite. The INIT signal is direct (not inverse), so the logical "1" on pin 16 will appear when we apply a logical "1" to this bit, i.e. what is given is what is received.

Let's try to get on contacts 1,17 - a low level of the signal "0", and on contacts 14 and 16 a high level of the signal "1", i.e. at the output of contacts 1,14,16,17 there will be 0 1 1 0 (610).

On the zero bit (-STROBE) we supply “1” (on pin 1 will be “0”), on the first bit (-AUTO) we supply “0” (on pin 14 there will be “1”), on the second bit (INIT) we supply “ 1" (pin 1 will be "1") and, finally, the third bit (-SELECT IN) is supplied with "1" (pin 17 will be "0"), i.e. we wrote down the number 10112 at the address & H37A, which is 1310. So, in order to get 6 at the output, you need to submit 13.

For convenience, I give a table with all possible combinations of numbers from 0 to 15

Applied signal

Received signal

Decimal number

(- STROBE) 2 0

(-AUTO) 2 1

(INIT) 2 2

(-SELECT IN) 2 3

contact 1

pin 14

pin 16

pin 17

Decimal number

And finally, the last part of this article. If your computer supports the EPP standard, then the fourth bit at the address & H37A you will be able to enable an interrupt (for LPT1 it is IRQ7) from the printer, just don't ask me what it is, I don't know anything about interrupts anyway. But the fifth bit 110101 2 , for example, by supplying the number 43 10 , you set the D0-D7 bus to the mode RECEPTION data. In this case, all digits (contacts 2-9) take the value of logical "1". To apply a logical "0" to the desired contact, it is necessary to close it through a resistance of 240 - 360 Ohms to the "ground". Thus, through the LPT port of the computer, we receive standard form device with 12 outputs and 5 inputs, and when the port is set to EPP mode, we get 4 outputs and 13 inputs.

ModeSPP (12 outputs and 5 inputs)

ModeEPP (4 inputs and 13 outputs)

Signal

Direction

Signal

Direction

Output

Entrance

Output

Entrance

Output

Entrance

Output

Entrance

Output

Entrance

Output

Entrance

Output

Entrance

Output

Entrance

Entrance

Entrance

Entrance

Entrance

PAPER END

Entrance

PAPER END

Entrance

Entrance

Entrance

- BUSY

Entrance

- BUSY

Entrance

- STROBE

Output

Output

Output

- AUTO

Output

Output

Output

-SELECT IN

Output

-SELECT IN

Output

End of the first part.

In the second part of the article, we will connect various electronic things to the port.

Share