include<reg52.h>
void delay1ms(unsigned int a )
{
unsigned char b;
while(a--)
{ for(b=0;b<125;b++);
}
}
void main()
{
unsigned char i;
start:P0=0x01;
i=0 ;
while(1)
{
P0=~(1<<i++);
delay1ms(500);
if (P0==1)
{goto start;
}
}
}
include<reg52.h>
void delay1ms(unsigned int a )
{
unsigned char b;
while(a--)
{ for(b=0;b<125;b++);
}
}
void main()
{
unsigned char i;
start:P0=0x01;
i=0 ;
while(1)
{
P0=~(1<<i++);
delay1ms(500);
if (P0==1)
{goto start;
}
}
}
下一篇单片机堆栈指针的理解