中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 基于單片機(jī)的彩燈設(shè)計(jì)

        基于單片機(jī)的彩燈設(shè)計(jì)

        作者: 時(shí)間:2011-10-12 來(lái)源:網(wǎng)絡(luò) 收藏

        3.軟件

        圖3 控制LED調(diào)光電路流程圖

          4.程序

          #includereg52.h>

          sbit LED1=P1^0;

          sbit LED=P1^1;

          sbit LED2=P1^2;

          unsigned char CYCLE;

          unsigned char PWM_ON;

          void delay (unsigned int cnt)

          {

          while(--cnt);

          }

          main()

          { bit flag;

          TMOD=0x01;

          TH0=(65536-100)/256;

          TL0=(65536-100)%256;

          IE=0x82;

          TR0=1;

          CYCLE=50;

          while(!flag)

          { delay(20000);

          PWM_ON++;

          if(PWM_ON==CYCLE)

          { flag=1;

          }

          }

          while(flag)

          { delay(20000);

          PWM_ON--;

          if(PWM_ON==0)

          { flag=0;

          }

          }

          }

          void time(void) interrupt 1

          { STatic unsigned char count;

          TH0=(65536-100)/256;

          TL0=(65536-100)%256;

          if(count==PWM_ON)

          { LED1=1;

          LED=1;

          LED2=1;

          }

          count++;

          if(count==CYCLE)

          { count=0;

          if(PWM_ON!=0)

          LED1=0;

          LED=0;

          LED2=0;

          }}

          *


        上一頁(yè) 1 2 下一頁(yè)

        評(píng)論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉