Professional Documents
Culture Documents
dsPIC30F6010
MOTOR
MOTOR CONTROL
CONTROL PWM
PWM
MODULE
MODULE
JAYA VENKATA PHANI SEKHAR CHENNU 2014EEP2408
JAYA VENKATA PHANI SEKHAR CHENNU 2014EEP2408
RONIL CHAUDHURI - 2014EEP2820
RONIL CHAUDHURI - 2014EEP2820
APPLICATIONS
APPLICATIONS SUPPORTED
SUPPORTED
Three phase Induction Motor
Three phase Induction Motor
Switched Reluctance Motor
Switched Reluctance Motor
Brushless DC Motor
Brushless DC Motor
Uninterruptible Power Supplies
Uninterruptible Power Supplies
FEATURES
FEATURES OF
OF PWM
PWM CONTROL
CONTROL
8 PWM I/O pins with 4 duty cycle generators
MODULE
8 PWM I/O pins with 4 duty cycle generators
MODULE
mode
mode
Manual override register for PWM output pins.
Manual override register for PWM output pins.
Special Event Trigger for synchronizing A/D conversions
Special Event Trigger for synchronizing A/D conversions
Each output pin associated with the PWM can be individually
Each output pin associated with the PWM can be individually
PWM
PWM MODULE
MODULE
BLOCK
BLOCK
DIAGRAM
DIAGRAM
CONTROL
CONTROL REGISTERS
REGISTERS
PTCON: PWM Time Base Control Register
PTCON: PWM Time Base Control Register
PTMR: PWM Time Base Register
PTMR: PWM Time Base Register
PTPER: PWM Time Base Period Register
PTPER: PWM Time Base Period Register
SEVTCMP: PWM Special Event
SEVTCMP: PWM Special Event
Compare Register
Compare Register
PWMCON1: PWM Control Register 1
PWMCON1: PWM Control Register 1
PWMCON2: PWM Control Register 2
PWMCON2: PWM Control Register 2
DTCON1:
8-OUTPUT
8-OUTPUT PWM
PWM REGISTER
REGISTER
MAP
MAP
PTCON:
PTCON: PWM
PWM Time
Time Base
Base Control
Control
Register
Register
PTCON:
PTCON: PWM
PWM Time
Time Base
Base Control
Control
Register
Register
PWM
PWM TIME
TIME BASE
BASE
It is provided by 15 bit timer.
It is provided by 15 bit timer.
The time base is accessible via the PTMR SFR.
The time base is accessible via the PTMR SFR.
PTMR<15> is a Read Only Status bit, PTDIR, that indicates
PTMR<15> is a Read Only Status bit, PTDIR, that indicates
PWM
PWM TIME
TIME BASE
BASE
Counting period for PTMR is set by writing a 15-bit
Counting period for PTMR is set by writing a 15-bit
PWM
PWM TIME
TIME BASE
BASE
FOUR MODES OF OPERATION
FOUR MODES OF OPERATION
1. Free Running mode (PTMOD<1:0> = 00)
1. Free Running mode (PTMOD<1:0> = 00)
2. Single Shot mode (PTMOD<1:0> = 01)
2. Single Shot mode (PTMOD<1:0> = 01)
3. Continuous Up/Down Count mode (PTMOD<1:0> = 10)
3. Continuous Up/Down Count mode (PTMOD<1:0> = 10)
4. Continuous Up/Down Count mode with interrupts for double
4. Continuous Up/Down Count mode with interrupts for double
updates (PTMOD<1:0> = 11)
updates (PTMOD<1:0> = 11)
These four modes are selected by the PTMOD<1:0> bits in the
These four modes are selected by the PTMOD<1:0> bits in the
PTCON SFR
PTCON SFR
PWM
PWM TIME
TIME BASE
BASE
Free Running Mode
Free Running Mode
PWM Time base PTMR counts upwards
PWM
Time base
PTMR
counts
till
it matches
with
PTPER
Time upwards
Base
till
it
matches
with
PTPER
Time
Base
Period Value.
Period Value.
PTMR register is reset on next input
PTMR register is reset on next input
clock edge.
clock edge.
Above two steps continue as long as
Above two steps continue as long as
PTEN bit is set.
PTEN bit is set.
At each period match instant, an
At each period match instant, an
interrupt event is generated.
interrupt event is generated.
The frequency of these interrupt
The frequency of these interrupt
events is reduced by using postscaler
events isbits.
reduced by using postscaler
selection
selection bits.
PWM
PWM TIME
TIME BASE
BASE
1.
PWM
PWM TIME
TIME BASE
BASE
PWM TIME BASE PRESCALER
PWM TIME BASE PRESCALER
PWM
PWM Period
Period
PTPER is a 15-bit register and is used to set the counting period for the
PTPER is a 15-bit register and is used to set the counting period for the
The value held in the PTPER buffer is automatically loaded into the
The value held in the PTPER buffer is automatically loaded into the
PTPER register when the PWM time base is disabled (PTEN = 0).
PTPER register when the PWM time base is disabled (PTEN = 0).
PWM
PWM Period
Period
Free
FreeRunning
RunningMode
ModePWM
PWM
Period
Period
Up/Down
Up/DownMode
ModePWM
PWM
Period
Period
Maximum
Maximumresolution
resolution(in
(in
bits)
bits)
Edge-Aligned
Edge-Aligned PWM
PWM
PWM signals are produced when the PWM time base is in the
PWM
signalsor
are
produced
when the PWM time base is in the
Free
Running
Single
Shot mode.
Free Running or Single Shot mode.
For edge-aligned PWM outputs, the output period is specified in
For edge-aligned PWM outputs, the output period is specified in
PTPER and duty cycle is specified in the appropriate duty cycle
PTPER and duty cycle is specified in the appropriate duty cycle
register.
register.
The PWM output is driven active at the beginning of the period
The PWM output is driven active at the beginning of the period
(PTMR = 0) and is driven inactive when the value in the duty
(PTMR
= 0) and
is driven
inactive when the value in the duty
cycle
register
matches
PTMR.
cycle register matches PTMR.
If particular duty cycle register is zero, then the output on the
If particular duty cycle register is zero, then the output on the
corresponding PWM pin will be inactive for the entire PWM
corresponding PWM pin will be inactive for the entire PWM
period.
period.
If the duty cycle register is greater than the value held in the
If the duty cycle register is greater than the value held in the
PTPER register, the output on the PWM pin will be active for the
PTPER
register,
the output on the PWM pin will be active for the
entire
PWM
period.
entire PWM period.
Center-Aligned
Center-Aligned PWM
PWM
PWM signals are produced when the PWM time base is up/down
PWM signals
counter
mode. are produced when the PWM time base is up/down
counter mode.
The PWM output is driven to the active state when duty cycle
The PWM output is driven to the active state when duty cycle
register matches the value of PTMR and the PWM time base is
registerdownwards
matches the
value =
of1).
PTMR and the PWM time base is
counting
(PTDIR
counting downwards (PTDIR = 1).
The PWM output is driven to the inactive state when the PWM
The PWM output is driven to the inactive state when the PWM
time base is counting upwards (PTDIR = 0) and the PTMR
time base
is counting
(PTDIR
= 0) and the PTMR
register
value
matches upwards
the duty cycle
value.
register value matches the duty cycle value.
If particular duty cycle register is zero, then the output on the
If particular duty cycle register is zero, then the output on the
corresponding PWM pin will be inactive for the entire PWM
corresponding PWM pin will be inactive for the entire PWM
period.
period.
If the duty cycle register is equal to the value held in the PTPER
If the duty cycle register is equal to the value held in the PTPER
register, the output on the PWM pin will be active for the entire
register,
the output on the PWM pin will be active for the entire
PWM
period.
PWM period.
PWM
PWM DUTY
DUTY CYCLE
CYCLE
There are four 16-bit special function registers
There are four 16-bit special function registers
PWM
PWM DUTY
DUTY CYCLE
CYCLE
PWM duty cycle registers are double-buffered to allow glitch
PWM duty cycle registers are double-buffered to allow glitch
COMPLEMENTARY
COMPLEMENTARY PWM
PWM
OPERATION
Each pair of PWM outputs is obtained by a
OPERATION
COMPLEMENTARY
COMPLEMENTARY PWM
PWM
OPERATION
Complementary mode is selected for each PWM
OPERATION
DEAD-TIME
DEAD-TIME GENERATORS
GENERATORS
Used when any of the PWM I/O pin pairs are operating in the
Used when any of the PWM I/O pin pairs are operating in the
1. Different turn off times in the high side and low side transistors
1. Different turn off times in the high side and low side transistors
in a complementary pair.
in a complementary pair.
First dead time is inserted between the turn off event of the lower
First dead
is inserted between
the turn
off event
of the
transistor
oftime
the complementary
pair and
the turn
on event
of lower
the
transistor
of the complementary pair and the turn on event of the
upper
transistor.
upper transistor.
b) The second dead time is inserted vice-versa
b) The second dead time is inserted vice-versa
a)
a)
2. Two dead times can be assigned to individual PWM I/O pin pairs.
2. Two dead times can be assigned to individual PWM I/O pin pairs.
) This mode allows the PWM module to drive different transistor/load
) This mode allows the PWM module to drive different transistor/load
DEAD-TIME
DEAD-TIME GENERATORS
GENERATORS
6-bit down counter is used to produce the dead-time
6-bit down counter is used to produce the dead-time
insertion.
insertion.
The DTCON2 SFR contains control bits that allow the dead
The DTCON2 SFR contains control bits that allow the dead
times to be assigned to each of the complementary
times to be assigned to each of the complementary
outputs.
outputs.
DTSxA - Selects PWMxL/PWMxH active edge dead time.
DTSxA - Selects PWMxL/PWMxH active edge dead time.
DTSxI - Selects PWMxL/PWMxH inactive edge dead time.
DTSxI - Selects PWMxL/PWMxH inactive edge dead time.
DEAD-TIME
DEAD-TIME RANGES
RANGES
The amount of dead time is selected by specifying the
The amount of dead time is selected by specifying the
INDEPENDENT
INDEPENDENT PWM
PWM OUTPUT
OUTPUT
An independent PWM Output mode is required for driving
An independent PWM Output mode is required for driving
SINGLE
SINGLE PULSE
PULSE PWM
PWM
OPERATION
OPERATION
The PWM module produces single pulse outputs when the
PWM
PWM OUTPUT
OUTPUT OVERRIDE
OVERRIDE
The PWM output override bits allow the user to manually
The PWM output override bits allow the user to manually
PWM
PWM OUTPUT
OUTPUT OVERRIDE
OVERRIDE
COMPLEMENTARY OUTPUT MODE
COMPLEMENTARY OUTPUT MODE
OVERRIDE SYNCHRONIZATION
OVERRIDE SYNCHRONIZATION
PWM
OUTPUT
AND
POLARITY
PWM
OUTPUT
AND
POLARITY
There are three device Configuration bits associated
There are three device Configuration bits associated
CONTROL
with
the PWM module that provide PWM output pin
CONTROL
with the PWM module that provide PWM output pin
control:
control:
PWM
PWM FAULT
FAULT PINS
PINS
When asserted, the two fault pins (FLTA and FLTB) can optionally
When asserted, the two fault pins (FLTA and FLTB) can optionally
PWM
PWM FAULT
FAULT PINS
PINS
SPECIAL CASE: when a PWM module I/O pair is in the
SPECIAL CASE: when a PWM module I/O pair is in the
Complementary mode and both pins are programmed to be
Complementary mode and both pins are programmed to be
active on a Fault condition
active on a Fault condition
PWMxH pin always has priority in the Complementary mode,
PWMxH pin always has priority in the Complementary mode,
so that both I/O pins cannot be driven active simultaneously
so that both I/O pins cannot be driven active simultaneously
If both Fault input pins have been assigned to control a
If both Fault input pins have been assigned to control a
particular PWM I/O pin, the Fault state programmed for the Fault
particular PWM I/O pin, the Fault state programmed for the Fault
A input pin will take priority over the Fault B input pin
A input pin will take priority over the Fault B input pin
FAULT
FAULT INPUT
INPUT STATES
STATES
Latched Mode
Latched Mode
The operating mode for each Fault input pin is selected using
The operating mode for each Fault input pin is selected using
the FLTAM and FLTBM control bits in the FLTACON and
the FLTAM and FLTBM control bits in the FLTACON and
FLTBCON Special Function Registers
FLTBCON Special Function Registers