#define uint unsigned int
void delay(int m);
void main()
{
uint temp=0xfe;
uint k,i,count;
P2=temp;
while(1)
{
while(k<8)
{
switch(count)
{case 0:
case 1:delay(50);break;
case 2:
case 3:delay(25);break;
case 4:
case 5:delay(100);break;
}
if(temp==0xff) temp<<=1;
else temp=(temp<<1)+1;
P2=temp;
k++;
}
count++;
if(count>5) count=0;
}
}
void delay(int m) //要想得到精确的延时,改成用定时器
{
for(i=0;i