欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: ATMEGA16A單片機流水燈程序 [打印本頁]

作者: 夏宇閃擎    時間: 2019-7-22 06:38
標題: ATMEGA16A單片機流水燈程序
* 【函數功能】: 流水燈實驗         
* 【晶    振】:  8M               
* 【單 片 機】:  ATMEGA16A        
/******************************************************************************/  
       #define  uchar  unsigned char
           #define  uint   unsigned int
       #include <iom16v.h>
       #include <macros.h>
           
       void delayms(void)         // 延時子程序      
        {                                                
                 unsigned int i,j;
                         for(i=0;i<100;i++)
                            for(j=0;j<3000;j++);
        }
        void  main(void)
        {
                 uchar  i,j;            //定義變量
         PORTD=0xFF;                        //設為輸出口
         DDRD=0xFF;                                //PD口設為輸出高電平,燈滅
         while(1)
            {
                i=1;
                for (j=0;j<8;j++)  //循環8次,即PD0~~PF7輪流閃亮  
                               {
                                             PORTD=~i;                //反相輸出,低電平有效
                                 delayms();
                                 i=i<<1;                        //左移一位
                           }
               
               }
        }
         
        
         
        




歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1