if(key1==0) //玩家1,燈左移
{
delay(5);
if(key1==0)
{
while(!key1);
if(temp1==0xff) //燈在P2口上
{
if(temp2==0xfe)
{
temp2=0xff;
P2=temp2;
temp1=0x7f;
P0=temp1;
}
if(temp2!=0xff)
{
temp2=_cror_(temp2,1);
P2=temp2;
}
}
else //燈在p0口
{
temp1=_cror_(temp1,1);
P0=temp1;
}
a=1; //用于跳出P0==OXfe的循環
}
}
if(key2==0) //玩家2,燈右移
{
delay(5);
if(key2==0)
{
while(!key2);
if(temp2==0xff)
{
if(P0==0x7f)
{
temp1=0xff;
P0=temp1;
temp2=0xfe;
P2=temp2;
}
if(temp1!=0xff)
{
temp1=_crol_(temp1,1);
P0=temp1;
}
}
else
{
temp2=_crol_(temp2,1);
P2=temp2;
}
b=1; //用于跳出P2==oxbf的循環
}
}
}
c51的編程,玩家2的燈在p2口沒有向右移,求幫忙看看 |