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

標題: 4LED 同時亮燈的單片機程序 [打印本頁]

作者: 呂紫恒    時間: 2017-11-9 16:06
標題: 4LED 同時亮燈的單片機程序
程序代碼如下#include<reg52.h>                   //52系列單片機頭文件     
#include<intrins.h>                  //包含_crol_函數(shù)所在的頭文件
#define uchar unsigned char           //宏定義
#define uint unsigned int              //宏定義
void delay_ms(uint x);                //聲明延時子函數(shù)
void main()                         //主函數(shù)
{
while(1)
  {
           uchar Data,num;
      Data = 0xfd;               //初值是11111101
for(num = 0;num < 4;num++)
     {
                 P1 = Data;              //把初值賦給P1(第一個小燈亮)
                delay_ms(300);          //延遲300ms
                Data=_crol_(Data,1);         //將Data循環(huán)左移1位再賦給Data
     }
  }
}
void delay_ms(uint x)                                                //延時子函數(shù)體
{
        uint i,j;
        for(i=x;i>0;i--)                           //i=x即延時時間約為x毫秒
                for(j=114;j>0;j--);
}









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