- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
=11 : Up/Down Counting Mode with Interrupt for double
PWM updates
dsPIC Peripheral Module Training – RTC Taiwan
SLIDE 8
PTPER PDC3 PDC2 PDC1
Edge Aligned PWM
PTMR counter LSbit of duty cycle specifies Tcy/2 boundary Divide count period value by 2 to get PTPER PWM frequency is halved for center-aligned
R/W-0 PTEN
bit15
R/W-0
bit7
U-0
R/W-0
-
PTSIDL
14
13
R/W-0
R/W-0
PTOPS<3:0>
6
5
U-0 -
12
R/W-0
4
U-0 -
11
U-0 -
10
R/W-0 R/W-0
PTCKPS<1:0>
3
2
U-0
U-0
-
-
9
bit8
R/W-0 R/W-0
PTMOD<1:0>
O Single Event
Interrupt – When the PTMR is reset to “0” Period – PTMR is matched with PTPER Duty – Set PTEN bit (PTMR=0)
O Up/Down Counting
Interrupt – When the PTMR count downwards to zero Period and Duty - PTMR count downwards to zero
PWM interrupt every 1-16 periods
O 1:1, 1:4, 1:16, or 1:64 input clock prescaler options O 1:1 ~ 1:16 Interrupt Postscaler options
dsPIC Peripheral Module Training – RTC Taiwan
Motor Control PWM Module
dsPIC Peripheral Module Training – RTC Taiwan
SLIDE 1
Session Agenda
O MC Peripheral Overview
PWM Time Base and Period Setting Duty Cycle Programming Dead Band Generators Output Override Fault pins A/D Converter Synchronization MC PWM in Power Safe Modes
=10 : Up/Down Counting Mode
The PTMR will count upwards then count downwards when the PTMR is matched with PTPER. The PTMR count down to zero then PTMR will change to up-count.
dsPIC Peripheral Module Training – RTC Taiwan
SLIDE 13
MC PWM Period
O PWM Frequency and Counting Resolution
The 15-bit PTMR increments every Tcy PTPER sets the counting period in Tcy 16-bit duty cycles allow Tcy/2 edge resolution Upper 15 bits of Duty Cycle compared to
PTEN cleared by Hardware
PWMIF cleared in Software
SLIDE 10
Center Aligned PWM
PTPER
PDC1 PDC2
0 PWM1H
Period
Duty Cycle Update here
PTMR value
PWM2H
PDC2 Value
= 01 : Signal-Event Mode
The PTMR will count upwards when the PTEN is set. When the PTMR is matched the PTPER, the PTMR will be reset and also clear the PTEN bit to halt the time Base operation.
Duty Cycle Generator #2
Duty Cycle Generator #1
Dead Time Unit Dead Time Unit Dead Time Unit Dead Time Unit
PWM Output Control Logic
A/D Conversion Trigger
dsPIC Peripheral Module Training – RTC Taiwan
SLIDE 5
MC-PWM Timebase
PTCON : PWM Time Base Control Register O Dedicated 15-bit time-base, period register
SLIDE 6
Motor Control PWM
O PTCON register
PTMOD - Timebase Mode Select Bits PTCKPS - Timebase clock pre-scale PTOPS - Timebase interrupt post-scale PTSIDL - Stop in IDLE mode PTEN - Timebase Enable
dsPIC Peripheral Module Training – RTC Taiwan
PWM4H PWM4L PWM3H PWM3L PWM2H PWM2L PWM1H PWM1L
Fault A Fault B
Four PWM output pairs with output polarity control
SLIDE 9
Single Event PWM
PTPER
PDC2 PDC1 PTMR
PTEN PWM1H
Duty Cycle update immediately When PTEN bit is cleared
PWM2H
PWMIF
PTEN bit set by Software
dsPIC Peripheral Module Training – RTC Taiwan
Up count (edge align), up/down count (center align)
O PWM resolution : Tcy/2 For Example:
At 20 MIPS: 19.5 KHz @ 11 bit i.e. 11 bit resolution above audible frequencies
dsPIC Peripheral Module Training – RTC Taiwan
SLIDE 2
Motor Control PWM
O MCPWM Features
Designed for ACIM, BLDC, SR, UPS Dedicated time base with TCY/2 edge resolution Complementary PWM signals w/ dead time Output pin polarity set with configuration bits Special PWM generation modes Multiple output modes Override register for commutation applications Special event trigger for A/D conversion Fault pins for protection of power circuits
New Duty Cycle loaded from PDCx
PTMR = PTPER
PTMR Counter
PWM1H PWM2H PWM3H
Duty 1 Duty 2 Duty 3
PWM Period
dsPIC Peripheral Module Training – RTC Taiwan
Interrupt is generated And Period reload
O Up/Down Counting with Double Updates
Interrupt – Each PTMR is equal zero and match with PTPER Period – When the PTMR count downwards to zero Duty – Each PTMR is equal zero and match with PTPER
dsPIC Peripheral Module Training – RTC Taiwan
SLIDE 315-bit Time-base
Manual Override
Duty Cycle Generator #4
Duty Cycle Generator #3
Interrupt and Period Update
dsPIC Peripheral Module Training – RTC Taiwan
SLIDE 11
Center Aligned PWM with Double Update
Duty Cycle Update and Interrupt
PTPER
PDC1 PDC2
0 PWM1H
PWM2H
PDC2 Value
Period register Reload
dsPIC Peripheral Module Training – RTC Taiwan
PTMR value
SLIDE 12
PWM Interrupt
O Free Running
Interrupt – When the PTMR is reset to “0” Period & Duty – PTMR is matched with PTPER
Two fault pins w/ programmable fault
states
SLIDE 4
MC PWM Registers
O PTCON : PWM Time Base Control register O PTMR : PWM Time Base counter O PTPER : PWM Time Base Period register O SEVTCMP : PWM Special Event Compare register O PWMCON1 : PWM Control register #1 O PWMCON2 : PWM Control register #2 O DTCON1: Dead Time Control register #1 O DTCON2: Dead Time Control register #2 O FLTACON : Fault A Control register O FLTBCON : Fault B Control register O PDCx : PWM Duty Cycle register #1 ~ #4
1
bit0
dsPIC Peripheral Module Training – RTC Taiwan
SLIDE 7
MC PWM Mode
O PTMOD<1:0> bit in the PTCON register
= 00 : Free run mode.
The PTMR will count upwards until the value is matched with PTPER, PTMR will reset.