You are on page 1of 1

#include <reg51.

h>
sbit sw1=P1^4;
sbit sw2=P1^5;
sbit sw3=P1^6;
sbit sw4= P1^7;
sbit usw= P1^0;
int fwd;
int stop;
int rev;
void main ()
{
fwd=0xAA;
stop=0;
rev=0x55;
while(1)
{
if (usw)
{
while (sw1 && sw3)
{
P2=fwd;
}
P2=stop;
while(usw);
while(sw2 && sw4)
{
P2=rev;
}
P2=stop;
}
}
}

You might also like