Dev C++ Parallel Port Interfacing...

Status
Not open for further replies.

myasir786

Newbie level 6
Joined
Mar 10, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,391
#include <conio.h>
#include <windows.h>
#include<iostream>
using namespace std;
int main()
{
cout<<"Parallel Port Interfacing"<<endl;
cout<<"Press 8 to forw, 2 to reverse,4 to left,6 to right,1 to forw&left and 3 to forw&right:"<<endl;
int inp;
do
{
inp=getch();
out32(0x378,0x00);
if(inp=='8')//D0 forward
{
cout<<"forward";
out32(0x378,0x01);
}
else if(inp=='2')//D1 reverse
{
cout<<"reverse";
out32(0x378,0x02);
}
else if(inp=='4')//D2 left
{
cout<<"left";
out32(0x378,0x04);
}
else if(inp=='6')//D3 right
{
cout<<"right";
out32(0x378,0x08);
}
else if(inp=='1')//D0&D2 forward&left
{
cout<<"forward and left";
out32(0x378,0x05);
}
else if(inp=='3')//D0&D3 forward&right
{
cout<<"forward and right";
out32(0x378,0x09);
}
}
while(inp=='1'||inp=='2'||inp=='3'||inp=='4'||inp=='6'||inp=='8');
system("pause");
return 0;
}


this is the program written by me in dev C++... i want to know that how to declare out32 function for the parallel port i have tried different type or output fuction but none has worked... and i also want to add a condition in my source code that will stop bid just as i leave the button...
actually i want to control a car by parallel port...
 

if you want to access par port under windows , use "inout32"
 
i have already used that inpout32.dll file but my program is not compiling the output file neither "outportb" nor "out32"... their must be some header file or some definition or function which declares the output file like outportb or out32... do let me know that header file if it is in your knowledge...
 

after the #include <...> lines, insert the following:

short _stdcall Inp32(short PortAddress); */
void _stdcall Out32(short PortAddress, short data);

and link with inpout32.dll
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…