专注电子技术学习与研究
当前位置:单片机教程网 >> MCU设计实例 >> 浏览文章

XS128单片机实验:B口灯交替闪亮

作者:韩冰   来源:本站原创   点击数:  更新时间: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);
  }
 
}
 
 

关闭窗口

相关文章