#include
#include
#include
void main()
{
clrscr();
int i=50;
a:int k=getch();
switch (k)
{ //with out CAPSLOCK ON /////////
case 0:
goto a;
case 72:// up arrow
cout<<"\n up arrow";
outportb(0x378,0x06);
//front direction
goto a;
case 80:// down arrow
cout<<"\n down arrow";
outportb(0x378,0x09);
//back goto a;
case 75://
left arrow cout<<"\n left arrow"; outportb(0x378,0x0a);
//left goto a;
case 77:
// right arrow cout<<"\n right arrow";
outportb(0x378,0x05);//right
goto a;
case 32:// space bar cout<<"\n space bar";
outportb(0x378,0xff);//stop
goto a;
case 114:// r key for rise cout<<"\n r key for rise";
outportb(0x378,0x2f);//rise direction
goto a;
case 102:// f key for fall cout<<"\n f key for fall";
outportb(0x378,0x1f);//fall direction
goto a; //with CAPSLOCK ON for pulse motion//
case 82:// pulse for lifting cout<<"\n R key for pulse rise";
outportb(0x378,0x2f);//rise direction delay(i);
outportb(0x378,0xff);//stop direction
goto a;
case 70:// pulse for fall cout<<"\n F key for pulse fall";
outportb(0x378,0x1f);//fall direction
delay(i);
outportb(0x378,0xff);//stop direction
goto a;
case 71:// home key cout<<"\n home key for pulse up direction";
outportb(0x378,0x06);//front direction
delay(i); outportb(0x378,0xff);//stop direction
goto a;
case 79:
//end key cout<<"\n end key for pulse down direction";
outportb(0x378,0x09);//back
delay(i);
outportb(0x378,0xff);//stop direction
goto a;
case 83://del key cout<<"\n del key for pulse left direction";
outportb(0x378,0x0a);//left
delay(i);
outportb(0x378,0xff);//stop
goto a;
case 81:// page down cout<<"\n Pg down key for pulse right direction";
outportb(0x378,0x05);//right
delay(i);
outportb(0x378,0xff);//stop
goto a;
case 115:
// s key for stop cout<<"\n S key for stop";
outportb(0x378,0xff);
goto a;
case 27:
// ESC key cout<<"\n ESC"; break;default:
outportb(0x378,0xff);//stop direction
goto a;
};
//end of switch casecout<<"\n end of program";
outportb(0x378,0x00);
getch();
}//end of void mian
Custom Search
NEW PARALLEL PORT PROGRAMM