在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<abbr id="27omo"></abbr>

<menu id="27omo"><dl id="27omo"></dl></menu>
    • <label id="27omo"><tt id="27omo"></tt></label>

      新聞中心

      EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 51單片機的七彩LED燈漸變調光調色程序

      51單片機的七彩LED燈漸變調光調色程序

      作者: 時間:2016-12-01 來源:網(wǎng)絡 收藏

      //***********************************************************************
      //Pattern4() 花樣函數(shù)4-------------7彩漸變
      //***********************************************************************
      void Pattern34()
      {
      Gra = 1; //漸變位 = 1
      }
      /*********************************************************/
      // 定時器0中斷服務程序
      /*********************************************************/
      void time0(void) interrupt 1
      {
      TR1 =0;
      TF0 =0;
      TH0=0xdb; //重新寫入初值
      TL0=0xff;
      if(!Gra) //執(zhí)行跳變程序
      {
      count ++;
      if(count > Speed)
      {
      LEDdelay = 1;
      count = 0;
      }
      }
      if(Gra)
      {
      TR1 = 1; //開啟TR1;
      if(!BP) //
      {
      if(Gra7)
      {
      P1 = led1[ledcount1]; //10ms到,亮相應的LED
      }
      if(Gra3)
      {
      P1 = led3[ledcount1]; //10ms到,亮相應的LED
      }
      Pulse++;
      value();
      if(Pulse >= Period)
      {
      Pulse = Period;
      BP = 1; //一個周期完成轉換模式
      }
      }
      if(BP)
      {
      if(Gra7)
      {
      P1 = led1[ledcount1]; //10ms到,亮相應的LED
      }
      if(Gra3)
      {
      P1 = led3[ledcount1]; //10ms到,亮相應的LED
      }
      value();
      Pulse--; //脈沖個數(shù)
      if(Pulse == 0)
      {
      Pulse = 0;
      BP = 0; //一個周期完成轉換模式
      ledcount1++;
      if(Gra7)
      {
      if(ledcount1 > 11)
      {
      ledcount1 = 0;
      }
      Gra7 = 0;
      }
      if(Gra3)
      {
      if(ledcount1 > 2)
      {
      ledcount1 = 0;
      }
      Gra3 = 0;
      }
      }
      }
      }
      }
      /*********************************************************/
      // 定時器1中斷服務程序
      /*********************************************************/
      void timer1() interrupt 3
      {
      PWM --;
      TH1 = 0xff; //0.05ms(20000分之一秒)
      TL1 = 0xD1;
      if(PWM == 0)
      {
      P1 = 0;
      TR1 = 0;
      }
      }
      /*********************************************************/
      // 外部中斷0中斷服務程序 下降沿觸發(fā)
      /*********************************************************/
      void extern0(void) interrupt 0
      {
      IE0 = 0; // 清標志位
      excount++;
      if(excount>50) // 50大約3秒
      {
      EA = 0;
      //P1_5 = 1;
      excount = 0;
      Reset();
      }
      }

      上一頁 1 2 下一頁

      評論


      技術專區(qū)

      關閉