Click here to Skip to main content
13,863,292 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


28 bookmarked
Posted 17 Aug 2012
Licenced CPOL

Parallel Port Control with C# .NET 2.0

, 17 Aug 2012
Rate this:
Please Sign up or sign in to vote.
Parallel port data register control with C# .NET 2.0 and inpout32.dll.

Sha-1 : 0976B8161468507304BC1B0F1FFF79263C71E10E


This is very simple application for data register out control with C#. When I interested control external electronical device I was looking such as application but I couldn't find any working properly and I wrote it. This article is about controlling data registers of parallel port (LPT port) with 2.0 and using inpout32.dll/inpout32.lib out32 function.

You can use this simple application for testing external electronic projects, tesing your parallel port's data registers, understand how they works.

1.How Inpout32.dll Works ?

Source code inpout32.dll

The outstanding feature of Inpout32.dll is , it can work with all the windows versions without any modification in user code or the DLL itself. The Dll will check the operating system version when functions are called, and if the operating system is Win9X, the DLL will use _inp() and _outp functions for reading/writing the parallel port. On the other hand, if the operating system is WinNT, 2000 or XP, it will install a kernel mode driver and talk to parallel port through that driver. The user code will not be aware of the OS version on which it is running. This DLL can be used in WinNT clone operating systems as if it is Win9X. The flow chart of the program is given below.

Look for 64 bit support Inpoutx64.dll.

Flowchart of inpout32.dll functions.

In this project used Out32 function from library.

namespace ParallelPortControl
    class PortControl // Import dll to project
        [DllImport("inpout32.dll", EntryPoint = "Out32")]
        public static extern void Output(int address, int value); // decimal

    public partial class Form1 : Form 
        int decData = 0;
        int decAdd = 888; // 378h Selected Default

        PortControl.Output(decAdd, decData);

2.How to Learn Parallel Port Address on Windows ?

You can find you parallel port's address easly on Windows Operating Systems. Right click computer on Desktop, Manage > Device manager > Ports > LPT1 or LPT2.

IEEE 1284 standard port addresses

Data Register

Status Register

Control Register













3.Using Decimal Input

128 64 32 16 8 4 2 1
D7 D6 D5 D4 D3 D2 D1 D0

If you want send 10010100 (1 is logic high voltage, 0 is logic low voltage) just add the decimal value which one is high(1) 128 + 16 + 4 = 148.


  2. Microsoft Developer Network



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Arman Aşçı
Turkey Turkey
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190214.1 | Last Updated 17 Aug 2012
Article Copyright 2012 by Arman Aşçı
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid