精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • 求詳細解釋這個51單片機PWM波原理

    求詳細解釋這個51單片機PWM波原理
    初學者,求逐步詳解.
    #include
    sbit LED = P1^0;
    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 = 10;
    while(!Flag)
    {
    delay(200000);
    PWM_ON++;
    if(PWM_ON == CYCLE)
    {
    Flag=1;
    }
    }
    while(Flag)
    {
    delay(200000);
    PWM_ON--;
    if(PWM_ON == 0)
    {
    Flag=0;
    }
    }
    }
    void tim(void) interrupt 1 using 1
    {
    static unsigned char count;
    TH0=(65536-100)/256;
    TL0=(65536-100)%256;
    if (count==PWM_ON)
    {
    LED = 1;
    }
    count++;
    if(count == CYCLE)
    {
    count=0;
    if(PWM_ON!=0)
    LED = 0;
    }
    }
    其他人氣:528 ℃時間:2020-04-08 23:00:06
    優(yōu)質解答
    這個程序每一條語句你肯定能看懂,給你加注釋沒有必要,給你講講PWM的原理,你再對照程序看就明白了你要用51產生PWM去控制LED,首先你要確定PWM的周期T和占空比D,確定了這些以后,你可以用定時器產生一個時間基準t,比如定...
    我來回答
    類似推薦
    請使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點,以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機版