#include <reg52.h>
sbit P1_0 = P1^0;
sbit P1_1 = P1^1;
sbit P3_4 = P3^4;
void DELAY()
{ unsigned int i,j;
for(i=0;i<500;i++)
{
for(j=0;j<300;j++);
}
}
void main()
{
unsigned char a=0,b=0;
while(1)
{
if(P3_4==1)
{
b=0;
while(a<3)
{
a++;
P1_0=1;
DELAY();
P1_0=0;
DELAY();
}
}
else
{
a=0;
while(b<3)
{
b++;
P1_1=1;
DELAY();
P1_1=0;
DELAY();
}
}
}
} |