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

XS128單片機實驗:B口燈交替閃亮

作者:韓冰   來源:本站原創(chuàng)   點擊數(shù):  更新時間:2013年11月30日   【字體:


#include <hidef.h>           /* common defines and macros */
#include "derivative.h"      /* derivative-specific definitions */
#include "WQ.h"
//This is the first program of mine,it's used to text the board;
//LED will twinkle in very fast speed;
void DELAY(int y)
  {
   int i,x;
   for (i=y;i>0;i--)
      for(x=220;x>0;x--); 
  }
void main(void) {
  DDRB =0XFF;       //置1,作為輸出口
  while(1){
  PORTB=0x55;
  DELAY(550);
  PORTB=0XAA;
  DELAY(550);
  }
 
}
 
 

關(guān)閉窗口

相關(guān)文章