專注電子技術(shù)學(xué)習(xí)與研究
當(dāng)前位置:單片機教程網(wǎng) >> MCU設(shè)計實例 >> 瀏覽文章

PIC單片機實現(xiàn)流水燈

作者:佚名   來源:本站原創(chuàng)   點擊數(shù):  更新時間:2013年10月17日   【字體:

#include<pic.h>//流水燈20091028 22:00
#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);
  }
 }
}

關(guān)閉窗口

相關(guān)文章