A collection of files and links to material about the PC's parallel port,
including ECP, EPP, bidirectional, and IEEE-1284 modes (and other I/O ports as well).
brought to you by Jan Axelson
Basics | ECP & EPP | Chips | Cables | Programming | Books
Inpout32 Dll Serial Port Examples
Parallel Port Complete
Switch On/Off using serial port or other. - posted in Ask for Help: Is there any way to make a switch on/off, using serial or paralel port (or even usb) through autohotkey, for example: If I want to turn on a light using a script pressing a specific key and turn off the same light, using other key. This is an old post now, but did you ever get an asnwer for this? I have a similar problem, the lab PC (windows XP, 32) won't connect my PsychoPy experiment to the parallel port (AttributeError: 'module' object has no attribute ' ParallelPort ') although E-Prime experiments are working just fine. However, I don't want to update or install new parallelport drivers, in case it interferes with the E-Prime compatibility. There is a dll available on the net called inpout32.dll which can be used to communicate with the serial or parallel port. I would be interested to know how you go about with your project and what. Simple parallel/serial port programming (Visual Basic 6.0) The goal of the project is to read a voltage change on pin 13 of the parallel port. Pin 13 was chosen because it is a status line (status=read only). Now I'm using Inpout32.dll to access the parallel port through VB (XP/9x compatible), and another program called VBPortTest.exe. Hi guys, I think I'm having a similar problem to MrRoger above, but I don't understand his previous post about 'opening the serial port'. I'm using inpout32.dll on a Windows 7 x64 system, in Visual Studio 2013.
For all you ever wanted to know about the parallel port, order a copy of Parallel Port Complete. Read Chapter 1 on-line.
If you've already read Parallel Port Complete, you're welcome to say a few words about it at amazon.com.
The Basics
- Jan's Parallel Port FAQ has answers to frequently asked questions about using, interfacing, and programming the parallel port in all of its modes.
- The parallel port FAQ . Basics about the parallel port and how to use it, by Zhahai Stewart. (50K)
- The Computer Peripherals Guide at about.com is a good place to start if you're looking for help in using standard peripherals such as printers and drives. Hosted by Rick Russell.
- Control and data acquisition information and projects, from Peter H. Anderson and his students. Code examples in C.
- Para14.zip. Parallel-port diagnostic and information utility from Parallel Technologies. (88K)
- Various LPT documents. Steve Walz has collected a useful set of parallel-port-related FAQs and information.
- Beyond Logic has tutorials (including EPP and ECP), projects, and a debug tool with source code. From Craig Peacock.
- Interfacing to the IBM-PC Parallel Printer Port. General information, plus several projects.
- Tomi Engdahl's PC Hardware pages. Many links.
- PC Webopedia. Definitions and many links.
- External Parallel Port devices and Linux. Many links and info about the Linux-parport mailing list. From Grant Guenther.
- Zanthic has inexpensive proto boards for parallel-port interfacing with EPP handshaking. Some also have a CAN interface.
- If you have a (usually old) device that sends data to a line printer, and you want to instead read the data into a PC, you have a couple of options. One is to buy or make a parallel-to-serial converter and read the data at a serial port, using a terminal emulator or software you write. LPTCAP is another approach, consisting of circuits and software for reading the data into a PC's parallel port. FromKris Heidenstrom
- I've written a variety of magazine articles on parallel-port-related topics.
- PortMon monitors and displays all serial and parallel port activity on a system. From Mark Russinovich.
- A detailed description of the port pinout, with links to explanations of the different modes, plus a bunch of other links. From TechRef.
- Byte Runner Technologies has parallel-port expansion cards, both ISA and PCI-based.
- A tutorial on motion control from the parallel port. From cncKITS.
- Some web pages in Spanish: El Puerto Paralelo from Juan Carlos Galarza Roca. El puerto paralelo de la PC from Virgilio Gómez Negrete. El puerto paralelo from Javier Olcina and David Romero.
About Using Printers
- Microsoft's Knowledge Base has a lot of printer-related articles. These are just a few: HOWTO: Send Raw Data to a Printer Using the Win32 API from Visual Basic. Article ID: Q154078.
HOWTO: Use PASSTHROUGH Escape to Send Data Directly to Printer. Article ID: Q96795.
HOWTO: Get the Status of a Printer and a Print Job. Article ID: Q160129. - Do-it-yourself printer repair.
Connecting Two PCs
Connecting two PCs via their parallel ports requires a special cable. For software, you can use Windows 95/98's Direct Cable Connection, a third-party product, or write your own program to do the transfers. To find out about Direct Cable Connection, click F1 on the desktop and search for Direct Cable Connection.
- The Connect Pages have information on how to connect two PCs running various combinations of operating systems, using serial and parallel ports. From Kime.Net.
- Symantec is one of many sources for the pinout for a LapLink cable used in PC-to-PC transfers.
- Sewell Development's Fast Lynx works with everything from DOS through Windows 2000.
- Laplink and pcAnywhere support PC-to-PC transfers.
- Also see the information under Cables below.
Enhanced and Extended Ports
Including the bidirectional (PS/2) port, extended capabilities port (ECP), and enhanced parallel port (EPP), and the IEEE-1284 standard that descibes them all.
General Information
- A table showing the pinouts of all three of the commonly used parallel-port connectors, including the 25-pin D-sub, the 36-contact Centronics connector, and the new IEEE-1284C connector. (6K PDF (Acrobat) file)
- Warp Nine Engineering has descriptions of the EPP, ECP, and other IEEE-1284 modes. Warp Nine's products include ECP/EPP parallel-port cards, EPP and ECP drivers, and a peripheral interface controller that provides the logic between a general-purpose microcontroller and a PC's parallel port, to enable a peripheral to support EPP and ECP modes. Also check here for the latest information on IEEE standards relating to the parallel port. And there's a link to Microsoft's document describing ECP mode. (325k, PDF file).
- Various files relating to the IEEE-1284 standard, from Lexmark's FTP site
- Information on ordering standards from IEEE. The title of the parallel port standard is 1284-1994 IEEE Standard Signaling Method for a Bidirectional Parallel Peripheral Interface for Personal Computers.
- Standard Microsystems Corp. has preliminary versions of the daisy-chain specification and EPP BIOS, plus drivers and source code for SMC chips.
- QualityLogic (formerly Genoa Technology) has a protocol analyzer and test suite for IEEE-1284 links as well as a variety of products for printer testing.
- Trans Digital has a high-speed universal parallel-port product.
Chips
The data sheets for parallel-port controller chips include timing diagrams, register assignments, and other useful details about accessing and using the new modes. PC-side chips are for use in PCs; peripheral-side chips are for use in peripherals.
- AMD's Am29202 processor, for use in EPP/ECP (peripheral-side).
- Cirrus Logic's parallel I/O chips.
- Holtek's HT6535 SPP/EPP/ECP Controller. (PC-side)
- Intel's 82091 advanced integrated peripheral (PC side).
- National Semiconductor has a variety of Super I/O chips that include an IEEE 1284-compatible parallel port with EPP and ECP modes. (PC-side)
- Fairchild's 74VHC161284 Transceiver contains eight bidirectional data buffers and eleven control/status buffers to implement an IEEE-1284 Level 2 interface. Outputs on the cable side can be configured to be either open drain or push-pull.
- Standard Microsystems Corp., (SMSC), another manufacturer of EPP/ECP parallel-port chips. (PC- and peripheral-side).
- Exar/Startech's ST78C34 and ST78C36 are EPP/ECP chips. Look under Products/Communications/General Purpose. (PC-side).
- Texas Instruments' TL16PIR552 includes a PC-side ECP+EPP, plus a dual UART and IrDa interface.
- Warp Nine's W91284PIC supports all modes, plus daisy-chaining and negotiating. (peripheral-side)
- Winbond has PC-side chips.
Cables
- Denis Kondakov has figured out how to do Direct Cable Connection ECP transfers between PCs using a simple, home-brewed cable configuration. It requires a patch to paralink.vxd (zip file, 36k).
- Parallel Technologies' Universal Cable contains active circuits for high-speed parallel-port communications using Windows 95/98's Direct Cable Connection.
- Trans Digital's Universal Parallel Port is a high-speed, long-distance link between parallel-port peripherals and a PC-ard (PCMCIA) slot.
- If you want to connect your parallel printer to a USB port, CableMAX has a USB printer adapter that supports bidirectional printer communications. (Most other adapters don't.)
Various Projects
Projects that use the parallel port or an I/O chip like the 8255 Parallel Peripheral Interface chip.
- Connecting an 8255 Parallel Peripheral Interface to the parallel port. From Adam Boggs.
- Connecting an 8255 Parallel Peripheral Interface to the ISA bus. From Boondog Automation.
- How to connect an IDE disk to a microcontroller using an 8255. by Peter Faasse. I've included this one because of many requests for info about IDE interfacing.
- GKDesign's Universal IR Controller for a PC includes source code and a circuit for reading and sending infrared remote-control signals via the parallel port.
Programming
There are several ways to access the parallel port and other I/O ports in PCs, including direct I/O, custom device drivers, and Windows' built-in drivers..
Vga Port
Under Windows 3.x/95/98/Me, applications can read and write directly to port addresses. Use your compiler's built-in functions (inp and out or similar) or in-line assembly code. (See the source code in inpout32.zip below for an example.) This method is simple, but it's slow, it can't protect the port from access by other applications, and it doesn't work at all under Windows NT/2000/Xp. If you use Visual Basic or another language that doesn't have functions for port I/O or allow in-line assembly, you can use a DLL or a custom control that adds port I/O functions to an application.
A system-level device driver enables faster port access and can manage access by multiple applications. Driver types include VxD (virtual device driver) for Windows 9x/Me, WDM for Windows 98/NT/2000/Me/Xp, and kernel-mode driver for Windows NT/2000. Hardware interrupts must use a system-level driver under Windows 9x/NT/2000/Me/Xp. If you don't want to write your own driver, there are custom controls and other tools that enable applications to access ports and respond to interrupts via a driver.
Windows XP is based on Windows NT/2000, so for port access under Windows XP, try the NT/2000 tools. For existing software that accesses ports, you can try right-clicking the program icon or directory listing and selecting Properties > Compatibility > Windows 98. No guarantees that this will help.
A third way to access ports is to use the drivers included with Windows. However, Windows 3.x/9x/NT have no functions for generic port access, only functions tied to specific uses. For example, there are API calls for accessing printers and for accessing serial ports controlled by UARTs. In Visual Basic, the Printer object and MSComm control are other options for parallel and serial-port access. Built-in functions and controls like these are usually the best solution when their abilities match what you're trying to accomplish.
Windows 2000/Xp add improved drivers for accessing parallel-port devices with support for SPP, PS/2 (Byte), EPP, and ECP modes and daisy-chaining. Parclass is a system class driver for parallel-port devices, and Parport is a system function driver for the parallel port. The Windows DDK has details. Search for Parallel Devices and Drivers in the index.
Below are links to tools that you can use for port access. To make deciding easier, I've grouped them according to whether they are for use with 16-bit or 32-bit compilers, and which operating systems they support. The list includes freeware, shareware, and commercial products.
Programming Tools for Port I/O and Interrupts
32-bit-only Tools
Use these in 32-bit programs created with products such as 32-bit VB4, VB5, or VB6.
For Windows 95/98 and NT (and probably Windows 2000/Me/XP)
- DriverLinx Port I/O. Freeware. Supports: port I/O. From Scientific Software Tools. John Pappas has written TDLPortIO, a freeware interface for DriverLinx for use with C++ Builder, Delphi, and other languages.
- DriverX. Supports: port I/O and interrupts. From Tetradyne Software.
- Ez-Driver Device Driver Toolkit supports port I/O, interrupts, and DMA transfers. Includes a parallel-port experiment board. From Device Drivers International.
- IO ActiveX Communications module. Shareware. Line-printer-type access to LPT ports.. From JSPayne.
- Ioport & NTPort. Shareware. Supports: port I/O. From Robert Woudsma at Upper Canada Technologies.
- Parallel Port Direct I/O Access package. Shareware. Supports: port I/O. Supports access under NT by changing the I/O permission map for the process that claims the port. From Peter Shoebridge at Zeecube Software
- TVicHW32 & TVicPort. Shareware. Supports: port I/O and hardware interrupts. From EnTech Taiwan
- W95pio and Ntpio. Freeware. Supports: port I/O. Intended for use with HP's VEE visual programming language, but adaptable to other uses. Hosted by Gizmos-N-Gadjets. Ntpio is also available from Agilent's website.
- WinIO. Freeware. Supports: port I/O. Includes a DLL, declarations, and C source code. From Internals.com.
- WinRT, WinRT-VB, WinDK. Supports: port I/O and hardware interrupts. A variety of products for many uses. From BSQUARE. (These products are no longer available from BSQUARE. I'll post an update if I hear any news about their fate.)
For Windows 95/98 (and probably Windows Me) only
- Inpout32.zip. Freeware. Supports: port I/O. The file contains inpout32.dll. I wrote inpout32 in Delphi 2. The zip file includes the DLL, Visual-Basic declarations for inp and out, documentation, a test program, and the Delphi source code, which includes assembly code for port I/O. If you don't see the DLL file after you unzip the files, you probably have system files hidden. To unhide them, go to My Computer > View > Folder Options > View > Hidden Files and select Show All Files. Instructions for using inpout32 with C++ are in Jan's FAQ. This file was a download of the week in Visual Basic Programmer's Journal's VB Zone Development Exchange. Operating sytems: Windows 95/98. From Lakeview Research.
- Lptaccess. Freeware. This is a VxD that enables an application to reserve port addresses for its exclusive use. Details are in Karen Hazzah's VxD Advisor column in the January 1998 issue of Windows Developer's Journal. The magazine's website has the program code and info about the magazine.
- The tutorial Visual Basic DLLs and PC Interfacing is an excellent explanation of how to write your own inpout DLL in Visual C++. From Paul Oh.
- Win95io.zip. Freeware. Supports: port I/O. Another inpout DLL. The DLL is just 2048 bytes. From Jonathan Wood at Softcircuits.
- EasyIrq. Freeware. A driver to handle port interrupts. From Sergio Massara.
For Windows NT (and probably Windows 2000 and Windows XP) only
- Direct I/O. Shareware. Incluces interrupt emulation. From Ingenieurbuero Paule.
- NTPort Library. Shareware. From Zeal SoftStudio.
- PortTalk. Freeware. From BeyondLogic.
- The SHA toolkit. Freeware. Enables port I/O, hardware interrupts, and DMA from C++ and Delphi applications. From Sybera.
- Thesycon has a driver for NT and Windows 2000.
- Tinyport. Shareware. Supports: port I/O. A ready-to-run kernel-mode device driver. Tinyport complies with the rules that Microsoft has specified for NT drivers, so it doesn't undermine NT's stability and can be used in critical applications. From Manfred Keul.
- UserPort is a kernel mode driver for Windows NT/2000 that gives usermode programs access to I/O ports. From Tomas Franzon. Updated 5/31/01. Inspired by the article 'Direct Port I/O and Windows NT' by Dale Roberts, which describes a way to defeat NT's security for port I/O. Dr. Dobbs' Journal, May 1996. The article is available on CD.
- ParIO is an NT Parclass driver modified from a Microsoft DDK demo.From Martin Davey
16-bit-only Tools
Use these with products such as Visual Basic 3 or 16-bit Visual Basic 4.
- inpout16.zip Freeware. Supports: port I/O. Includes an inpout DLL, source code in PowerBasic, and an example VB project. From Lakeview Research.
- inpout.zip. Freeware. Supports: port I/O. Another inpout DLL. Includes assembly-language source code. From Jay Munro.
- Port16 ActiveX control. Shareware. From Hone Software.
- vbasm.zip. Freeware. Supports: port I/O. A DLL that adds Inp, Out, Peek, Poke, Call Interrupt, and more for accessing ports and memory. From Jonathan Wood at Softcircuits.
For 16- and 32-bit Programs (Windows 3.x, Windows 95/98)
- PowerBasic is the source for several products that are useful for applications that access ports. PowerBasic's 16-bit and 32-bit DLL compilers enable you to write and compile DLLs in Basic. The Basic syntax is nearly identical to classic QuickBasic. Because the DLLs are compiled, not interpreted like Visual Basic code, they're fast. The 16-bit edition includes inp and out for port access. The 32-bit edition allows port access under Windows 95/98 via inline assembly code. There's also a 32-bit Basic console compiler for text-only Windows applications and even a DOS compiler.
- 'Using 16-bit DLLs with 32-bit VB.' This article explains, step-by-step, a method for using 16-bit DLLs in 32-bit VB applications. The example described is port I/O with Vbasm (see above). To use this method, you must have both a 16-bit and a 32-bit edition of Visual Basic. From COOL.STF.
- Vbio.dll. Freeware. From Zeal SoftStudio.
Other Driver Information and Sources
- Windows 2000 and Windows Me include a USB printer driver, and the driver can be distributed for use with Windows 98.
- Dan Norton has an FAQ and many links relating to Device Driver Development
- The Device Driver Resource Page has many links. From Bob Weiman and Oracle Engineering.
- Warp Nine Engineering has IEEE-1284 drivers.
Books about Parallel Port Hardware and Programming
Here are links to a variety of books about parallel port hardware and programming. The titles are listed alphabetically, except for my book, which is first. :)
Jan Axelson
1996, Lakeview Research
343 pages, $39.95
Covers all of the port's modes and how to use them in custom applications.
Build Your Own Low-Cost Data Acquisition and Display Devices
by Jeffrey Hirst Johnson
1993, McGraw Hill/TAB Electronics
305 pages, $24.95
Lots of detail about the port hardware (serial ports too) and ISA interfacing, with DOS Pascal program code.
by Jeffrey Hirst Johnson
1993, McGraw Hill/TAB Electronics
305 pages, $24.95
Lots of detail about the port hardware (serial ports too) and ISA interfacing, with DOS Pascal program code.
Controlling the World With Your PC
by Paul Bergsman
1994, LLH Technology Pub
257 pages, $35
Many projects with DOS code in BASIC, C and Pascal
by Paul Bergsman
1994, LLH Technology Pub
257 pages, $35
Many projects with DOS code in BASIC, C and Pascal
Programming the Parallel Port: Interfacing the PC for Data Acquisition & Process Control
by Dhananjay V. Gadre
1998, CMP Books
308 pages, $44.95
Includes source code in C for DOS and Linux.
by Dhananjay V. Gadre
1998, CMP Books
308 pages, $44.95
Includes source code in C for DOS and Linux.
Active3 years, 1 month ago
I don't get any error or exception.
Button in one Window:
and inpout.dll interface:
What is wrong?LED on D2 is on all the time.
I have Windows 7 x64 Ultimate.
Matt Johnson-Pint152k4747 gold badges300300 silver badges424424 bronze badges
HoochHooch11.3k2626 gold badges7373 silver badges139139 bronze badges
4 Answers
For x64 you should use 'InpOutx64.dll'.
Visit: http://www.highrez.co.uk/Downloads/InpOut32/default.htmThere you can read more and find samples.
HABJANHABJAN8,02922 gold badges3030 silver badges5353 bronze badges
HoochHooch11.3k2626 gold badges7373 silver badges139139 bronze badges
You are not going to get an exception when you get this wrong, at most a blue screen. Pick one of:
- you are using the wrong address (0x3bc, 0x2f8)
- you wired the LED wrong
- you broke into the wrong museum to get the hardware
The question is too poorly documented to help you beyond this.
Hans PassantHans PassantSerial Port Adalah
812k113113 gold badges13841384 silver badges21672167 bronze badges
Serial Port Example
I resolved a problem with LPT port on Windows 2000 on my old laptop, where the data port (pin2-pin9) could not be set.
Using this imported function:
after every reboot or restart of Windows I have to call this line:
so that the port works properly. I think the problem is in the bi-directional settings (control port at 6th bit on 0x37A).
mghie30.3k66 gold badges7474 silver badges118118 bronze badges
Bokili ProductionBokili Production