第2个回答 2011-12-20
#include<reg51.h>
void delay(unsigned int i);
main()
{
unsigned char a=0xff;
while(1)
{
P2 = a;
delay(1000);
a++;
while(0)
{
P2=a;
delay(1000);
a--;
}
}
}
void delay (unsigned int i)
{
unsigned char j;
for(i;i>0;i--)
for(j=500;j>0;j--);
}