利用循環(huán)左移函數(shù)流水燈---單片機C語言編程
[導(dǎo)讀]#include#include
void delayms(unsigned char ms)
// 延時子程序
{
unsigned char i;
while(ms--)
{
for(i = 0; i < 120; i++);
}
}main()
{
unsigned char LED;
LED = 0xfe;
P0 = LED;
while(1)
#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);//循環(huán)左移1位,點亮下一個LED
P0 = LED;
}
}





