單片機(jī)流水燈實(shí)驗程序
程序:#include
#include
#define uni unsigned int
#define unc unsigned char
void delay(int);
unc tems;
void main()
{
tems = 0xfe;
P1 = tems;//給P1口賦值
while(1)
{
tems = _cror_(tems,1);//移位操?
delay(300);
P1 = tems;
}
}
void delay(int z)//延時子程序
{
uni x,y;
for(x=z;x>0;x--)
for(y=500;y>0;y--);
}
評論