1 / 14

Motor Control PWM

Motor Control PWM. 2008/4/23. MCPWM 相關電路圖. 暫存器. PTPER : PWM 週期暫存器 PTMR : PWM 計數暫存器 PTMRbits.PTDIR :計數方向 PDCx :第 x 組 PWM 責任週期暫存器 PWMIF : PWM 中斷旗標. PWM Time Base Mode. Free Running mode (PWM_MOD_FREE) Single Event mode (PWM_MOD_SING) Continuous Up/Down Count mode (PWM_MOD_UPDN)

arch
Download Presentation

Motor Control PWM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Motor Control PWM 2008/4/23

  2. MCPWM相關電路圖

  3. 暫存器 • PTPER:PWM週期暫存器 • PTMR:PWM計數暫存器 • PTMRbits.PTDIR:計數方向 • PDCx:第x組PWM責任週期暫存器 • PWMIF:PWM中斷旗標

  4. PWM Time Base Mode • Free Running mode • (PWM_MOD_FREE) • Single Event mode • (PWM_MOD_SING) • Continuous Up/Down Count mode • (PWM_MOD_UPDN) • Continuous Up/Down Count mode with interrupts for double-updates • (PWM_MOD_DBL)

  5. 對齊模式 • 邊緣對齊 • Free Running mode • Single Event mode • 中央對齊 • Continuous Up/Down Count mode

  6. Free Running mode • PTCONbits.PTMOD = 0b00 • PTMR遞增計數,與PTPER符合後重置,週而復始。 Period PTPER PTMR PDCx<15:1> PWMxH Duty Cycle 產生中斷

  7. Single Event mode • PTCONbits.PTMOD = 0b01 • 設定PTEN後開始遞增計數 • PTMR與PTPER比較符合後,PTMR重置,PTEN自動清除 PTPER PDCx<15:1> PTMR PTEN PWMxH PWMIF

  8. Continuous Up/Down Count mode • PTCONbits.PTMOD = 0b10 • PTMR遞增計數到PTPER後開始遞減計數 • PTMR遞減計數到0後開始遞增計數 Period PTPER PTMR PDCx<15:1> PWMxH PTDIR 產生中斷

  9. Up/Down Count & Double Updates • PTCONbits.PTMOD = 0b11 • PTMR等於0或是頂到PTPER都產生中斷 Period PTPER PTMR PDCx<15:1> PWMxH PTDIR 產生中斷

  10. 週期的計算 • Free Running Count Mode • PTPER = FCY / (FPWM.Prescaler) – 1 • Up/Down Counting Mode • PTPER = FCY / (FPWM.Prescaler .2) – 1

  11. PDCx 0 1 • PDCx<15:1>用來與PTMR<14:0>比較 • PDCx<0>用來決定PWM訊號邊緣發生在TCY或是TCY/2 • 所以 PTPER = 0x7FFF, PDCx = 0x7FFF 時 Duty = 50% 15 PDCx

  12. PDCx 9TCY PTPER = 8 TCY PTMR PDC1 = 12 PDC1<15:1> = 6, PDC1<0> = 0 Duty = 6 / (8+1) = 67% PWM1H TCY/2 PDC2 = 13 PDC2<15:1> = 6, PDC2<0> = 1 Duty = 6.5 / (8+1) = 72% PWM2H

  13. 責任週期的計算 • Free Running Count Mode • Duty cycle = [(PDCx / 2) – DT] / (PTPER + 1) • Up/Down Counting Mode • Duty cycle = (PDCx – DT) / [(PTPER + 1) . 2] Note: DT = Dead Time

  14. PWM Output Mode • Complementary (PWM_MODx_COMP) • Independent (PWM_MODx_IND) PWMxH PWMxL PWMxH PWMxL

More Related