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 C#.net 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 http://code.google.com/p/stimqt/downloads/detail?name=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
_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.
[DllImport("inpout32.dll", EntryPoint = "Out32")]
public static extern void Output(int address, int value);
public partial class Form1 : Form
int decData = 0;
int decAdd = 888;
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
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.
- Microsoft Developer Network