利用循环左移函数流水灯---单片机C语言编程
扫描二维码
随时随地手机看文章
#include #include main()
void delayms(unsigned char ms)
// 延时子程序
{
unsigned char i;
while(ms--)
{
for(i = 0; i < 120; i++);
}
}
{
unsigned char LED;
LED = 0xfe;
P0 = LED;
while(1)
{
delayms(250);
LED = _crol_(LED,1);//循环左移1位,点亮下一个LED
P0 = LED;
}
}