PIC單片機(jī)實(shí)現(xiàn)流水燈
#define uchar unsigned char
#define uint unsigned int
__CONFIG(0x3B31);
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=110;b>0;b--);
}
void main()
{
uchar i,temp;
TRISA=0x00;
while(1)
{
temp=1;
for(i=0;i<6;i++)
{
PORTA=~temp;//
temp=temp<<1;//
delay(200);
}
}
}
評(píng)論