非常简单嘛!
#include<reg51.h>
#include<intrins.h>
#define GPIO_LED P2//将P2口另外取名为GPIO_LED
void Delay10ms(unsigned int);
void main(void)
{
GPIO_LED=0xfe;
Delay10ms(50);
while(1)
{
GPIO_LED=_crol_(GPIO_LED,1);
Delay10ms(50);
}
}
void Delay10ms(unsigned int c)
{
unsigned char a,b;
for(;c>0;c--)
for(b=38;b>0;b--)
for(a=130;a>0;a--);
} |