Tools Required for Interfacing Parallel Port in Visual C++
1. Microsoft Visual Studio
2. inpout32.dll (www.logix4u.net)
3. inpout32.lib (www.logix4u.net)
4. LPT.exe (http://neil.fraser.name/software/lpt/)
Step and Code for Parallel Port Interfacing.
1. Creat a new Visual C++ Project using Visual Studio
2. Copy the inpout32.dll and inpout32.lib into your project directory
3. Goto project properties (Alt+F7), Expand Configuration Properties, Expand Linker, Click on Input, and type inpout32.lib in Additional Dependencies row and click Ok
4. Open the C source file of the project and code
#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
#include "stdlib.h"
/* ----Prototypes of Inp and Outp--- */
short _stdcall Inp32(short PortAddress);
void _stdcall Out32(short PortAddress, short data);
/*--------------------------------*/
void main(void)
{
int Data; //Data to be sent on parallel port
Out32(0X378,Data); //if Inp32(0x378); used then it will take input from parallel port
}
now to check the working of the program execute LPT.exe it will start monitoring your prarallel power status, and you may check the code you just compiled.
Best of Luck
No comments:
Post a Comment