Parallel port or printer port can be used to control any hardware easily. In our project we first planned to control stepper motors through parallel port. We did our project in VC# .NET. Actually we didn’t know that .NET doesn’t have any inbuilt controls to access parallel port directly. We got stuck up and started to search for a solution.
Finally we found how to do it.
The easiest way to do it will be to use a dll file that provides an easy access to the parallel port. Here is how u can do it:
1.Download the dll file from the downloads tab of this blog and save it to windows\system32\ folder.
2.Create a new class and name it as ParallelPort.
3.Copy the code given below to the class you created before:
using System;
using System.Runtime.InteropServices;
namespace ParallelPort
{
Private class PortAccess
{
[DllImport("inpout32.dll", EntryPoint="Out32")]
public static extern void Output(int adress, int value);
[DllImport("inpout32.dll", EntryPoint="Inp32")]
public static extern void Input( int adress);
}
4.Now you can send data using the command:
ParallelPort.PortAcess.Output(address,data);
5.The data refers to the decimal value of the data to be sent and the address is the address of the parallel port in the computer (usually it’s value is 888).
Posted by Murali on May 13, 2008 at 5:52 pm
you seem to be too technical these days
Posted by Vicky on May 14, 2008 at 2:23 am
I was forced to learn these for my project da
Posted by mineralogically on May 28, 2008 at 6:51 pm
mineralogically says : I absolutely agree with this !