SlideShare a Scribd company logo
1 of 48
2
 Introduction and definitions
 Types of PWM
 Methods of generation
 Characteristics of PWM
 Applications and examples
 Implementation on the HCS12
What is it?
 Output signal alternates between on and off within
specified period
 Controls power received by a device
 The voltage seen by the load is directly proportional
to the source voltage
3
Definitions
 Duty Cycle: on-time / period
 Vlow is often zero
4
LOW
HI
AVG V
D
DV
V )
1
( 


Types of Pulse Width
 Pulse center fixed, edges modulated
 Leading edge fixed, tailing edge modulated
 Tailing edge fixed, leading edge modulated
 Pulse Width constant, period modulated
5
Types of Pulse Width
6
Analog PWM signals can be made by combining a
saw- tooth waveform and a sinusoid
7
PWM output is
formed by the
intersection of
the saw-tooth
wave and
sinusoid
Analog Generation of PWM
Digital Methods of Generating PWM
 Digital: Counter used to handle transition
 Delta : used to find the PWM at a certain limit
 Delta Sigma: used to find the PWM but has advantage of
reducing optimization noise
8
Applications to DC Motors
11
• The voltage supplied to a DC motor is proportional
to the duty cycle
• Both brushed and brushless motors can be used
with PWM
• Both analog and digital control techniques and
components are available
Three Phase AC motors with PWM
 3 different AC currents at
different phases
 Phase: 120 degrees apart
 Creates constant power
transfer
 Rotating magnetic field
 Pulses substitute for AC
current
12
Space Vector Modulation
 Used for three-phase AC motors
 Convert DC current to AC current
 Gates turned on/off at different intervals
 3 PWM created
13
Motor Control Diagrams
14
• average value proportional to duty cycle, D
• low power used in transistors used to switch
the signal
• fast switching possible due to MOSFETS
and power transistors at speeds in excess
of 100 kHz
• digital signal is resistant to noise
• less heat dissipated versus using resistors
for intermediate voltage values
15
Advantages of PWM
16
 Cost
 Complexity of circuit
 Radio Frequency Interference
 Voltage spikes
 Electromagnetic noise
Disadvantages of PWM
17
 Introduction and definitions
 Types of PWM
 Methods of generation
 Characteristics of PWM
 Applications and examples
 Implementation on the HCS12
Presenter: Jason Kulpe
• In the past, motors were controlled at intermediate
speed by using resistors to lower delivered power
• Electric stove heater
• Lamp dimmers
• Voltage regulation – convert 12 volts to 5 volts by
having a 41.7% duty cycle
• Sound production: PWM controlled signals give
sound effects similar to a chorus
• Power transfer: PWM used to reduce the total
power given to a load without relying on resistive
losses
18
Applications of PWM
• commonly used in toys
• lowpass filter smooths out transients from harmonic effects
• frequency values of harmonics doesn’t change, but the
amplitude does, which adjusts the analog output signal
19
PWM used with D/A conversion
20
• clock signal is found “inside” PWM signal
• more resistant to noise effects than binary data alone
• effective at data transmission over long distance transmission lines
PWM used to transmit data
in telecommunications
1. Must be at least 10 times higher
than the control system frequency
2. Higher than 20kHz – audible
frequency of sounds to avoid
annoying sound disturbances,
caused by magnetostriction
3. If too low the motor is pulsed, not
continuous, because the motor’s
inductance can not maintain the
current
4. Inverse of frequency should be
much less than the motor/load time
constant
5. Higher error from ripple voltages
Frequency of the PWM Signal
Upper Limits
Lower Limits
1. If too high the inductance of the
motor causes the current drawn to
be unstable
2. MOSFET transistor generates heat
during switching
3. Limited by resolution of controller
4. Eddy currents generated in
electromagnetic coils which lead to
adverse heating
5. Heat losses in electromagnetic
materials is proportional to
frequency squared
22
Potentiometer is
used to adjust
the duty cycle
23
Example: PWM with 555 Timer
1. Maxon EC-16 brushless motor,
Time constant = 8.75 ms
2. Want to avoid audible frequencies
f ≥ 20 kHz
3. PID control loop running at 150 Hz
f ≥ 10 ∙ 150 Hz
Requirements
Hz
117
5
.
8
1


 f
ms
f
24
Example: Specifying circuit elements
1
1
44
.
1
C
R
f 
Set f to 25 kHz to add in a factor of safety
Choosing C1 to be 100 nF, R1 is 576 Ω ~ 500 Ω
Recalculating with these values f = 28.8 kHz
This circuit has a
PWM frequency
according to:
≥ 117 Hz
≥ 20 kHz
≥ 1.5 kHz
f
Check constraints
25
Example: Specifying circuit elements
Matlab can do PWM!
26
The procedure works similar
to the generation of analog
PWM using a sinusoid and
saw-tooth wave
18 kHz frequency
Continuous 28 amps
$55.95
Where can I buy a PWM controller?
Texas Instruments
Digikey
Mouser Electronics
Critical Velocity Motor Control
Texas Instruments
TAS5508B
8-Channel Digital Audio
PWM Processor
64 pin chip, max 192 kHz
frequency
$7.25
120 amps, used for
hybrid vehicles
$469.00
SMALL
H
U
G
E
27
28
 Introduction and definitions
 Types of PWM
 Methods of generation
 Characteristics of PWM
 Applications and examples
 Implementation on the HCS12
Presenter: Alex Mariuzza
PWM Implementation
 The signal is outputted
through Port P
 Six Channels
 Dedicated Chip
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 29
29
PWM Module
 Each channel has a
dedicated counter
 Programmable duty
and period
 Independently
adjustable clock,
polarity, and
alignment
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 30
30
PWM Module- Other Features
 8-bit and 16-bit resolution supported
 Two PWM channels can be concatenated together
 Four source clocks (A, SA, B, SB)
 Emergency Shutdown
 Some changes take a complete cycle to be implemented
 Modes of Operation:
 Normal: everything is available
 Wait: Low-power consumption and clock disabled
 Freeze: Option to disable clock is available
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 31
31
PWM Configuration
 Configured through
specific registers
 Registers are located from
$00E0 to $00FE
 There are repeated
registers (ex. 0013-0017)
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 32
32
PWM Enable Register
 Located at $00E0
 Code Warrior variable: PWME
 Set PWMEx to 0 to disable the channel
 Set PWMEx to 1 to enable it
 Channel is activated when bit is set
 If 16-bit resolution used, then PWME4/2/0 are deactivated
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 33
33
PWM Polarity Register
 Located at $00E1
 Code Warrior variable : PWMPOL
 Set PPOLx to 0, signal goes from low to high
 Set PPOLx to 1, signal goes from high to low
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 34
34
PWM Clock Select Register
 Located at $00E2
 Code Warrior variable : PWMCLK
 Set PCLK5/4/1/0 to 0 to use clock A
 Set PCLK5/4/1/0 to 1 to use clock SA
 Set PCLK3/2 to 0 to use clock B
 Set PCLK3/2 to 1 to use clock SB
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 35
35
PWM Prescaler Register
 Located at $00E3
 Variable: PWMPRCLK
 Used to prescale clocks A and
B
   
 
Frequency
PWM
)
1
2
(
Frequency
Clock
Bus
Frequency
PWM
Resolution
Frequency
Clock
Bus
Presclarer





N
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 36
36
PWM Scale A Register
 Located at $00E8
 Code Warrior variable:
PWMSCLA
 Store a hexadecimal value
in order to change the clock
frequency of SA
 Note: if set to $00,
PWMSCLA is set to 256
PWMSCLA
2
Frequency
A
Clock
Frequency
SA
Clock


10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 37
37
PWM Scale B Register
 Located at $00E9
 Code Warrior variable:
PWMSCLB
 Store a hexadecimal value
in order to change the clock
frequency of SA
 Note: if set to $00,
PWMSCLB is set to 256
PWMSCLB
2
Frequency
B
Clock
Frequency
SB
Clock


10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 38
38
PWM Center Align Register
 Located at $00E4
 Code Warrior variable: PWMCAE
 Set CAEx to 0 for left align signal
 Set CAEx to 1 for center align signal
 Note: can only be set when channel is disabled
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 39
39
Signal Alignment
 Signal changes when counter
is equal to period register
 In the center aligned mode, the
PWM counter goes from a
down-count to a up-count to
down-count, etc.
 In the left aligned mode, the
PWM counter is a up-counter
and rests to zero when it
overflows
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 40
40
PWM Control Register
 Located at $00E5
 Code Warrior variable: PWMCTL
 Set CONxy to 0 to keep PWM channels separate (8-bit)
 Set CONxy to 1 to concatenate PWM channels x and y together (16-
bit).
 Channel y determines the configuration
 x becomes the high byte and y becomes the low byte
 Bits PSWAI and PFRZ set either wait or freeze mode
 Changes only occur when channels are disabled
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 41
41
PWM Counter Register
 Located at $00EC through $00F1
 Code Warrior variable: PWMCNTx
 One per channel
 It tracks the cycle counts
 It can be read
 If written to, the count is reset to $00 and a up-count starts
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 42
42
PWM Period Register
 Located at $00F2 through $00F7
 Variable: PWMPERx
 Store a hexadecimal value to limit
maximum value of counter
 Changes occur when:
 Current period ends
 Counter is written to
 Channel is disabled
Frequency
Signal
PWM
Frequency
Source
PWM
PWMPERx 
Left-Aligned:
Frequency
Signal
PWM
2
Frequency
Source
PWM
PWMPERx


Center-Aligned:
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 43
43
PWM Duty Register
100
PWMPERx
Cycle
Duty
-
PWMPERx
PWMDTYx


• Located at $00F8 through $00FD
• Code Warrior variable: PWMDTYx
• Store a hexadecimal value to control when signal changes
• Changes occur when:
• Current period ends
• Counter written to
• Channel is disabled
100
PWMPERx
Cycle
Duty
PWMDTYx


Polarity = 0:
10/29/2009 44
Polarity = 1:
44
PWM Shutdown Register
• Located at $00FE
• Code Warrior variable: PWMSDN
• PWMENA: Enables and disables emergency shut down
• PWMIF (Interrupt flag): Set when an input is detected in pin 5
• PWMIE (Interrupt Enable): Enables and disables CPU interrupts
• PWMRSTRT: Resets the counters
• PWMLVL (Shutdown Output Level): Determines if output is high
or low when shutdown
• PWM5IN (Input Status): Reflects status of pin 5
• PWM5INL: Determines active level of pin 5 45
45
How it all works
Clock A, SA, B, or SB
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 46
46
Example
 Desired Signal:
 8 kHz PWM signal
 Duty Cycle of 30%
 Left Aligned
 Channel 1
 Low → High
 8-bit channel
  $02
PWMPRCLK
4
91
.
3
10
8
)
1
2
(
10
8
Prescaler 3
8
6









$00
PWMCLK
FA
$
250
10
8
10
2
10
8
4
10
8
PWMPER1 3
6
3
6













 

AF
$
175
100
250
30
-
250
PWMDTY1 



$00
PWMCAE 
$02
PWME 
$00
PWMPOL
$00
PWMCTL
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 47
47
Assembly Code
PWME EQU $00E0
PWMPOL EQU $00E1
PWMCLK EQU $00E2
PWMPRCLK EQU $00E3
PWMCAE EQU $00E4
PWMCTL EQU $00E5
PWMPER1 EQU $00F3
PWMDTY1 EQU $00F9
ORG $1000
LDAA #$00
STAA PWMCLK ; Sets source clocks to clock A
STAA PWMPOL ; The signal goes from low to high
STAA PWMCTL ; Makes all channels 8-bit
STAA PWMCAE ; Signals are left aligned
LDAA #$FA
STAA PWMPER1 ; Sets the period to 250 clock cycles
LDAA #$AF
STAA PWMDTY1 ; Makes the duty cycle equal to 30%
LDAA #$02
STAA PWMPRCLK ; Sets the prescaler to 4
STAA PMWE ; Enables and starts channel 1
……
10/29/2009 48
48
C Code
#include <hidef.h> /* common defines and macros */
#include <mc9s12c32.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE “mc9s12c32”
// Set up chip in expanded mode
MISC = 0x03;
PEAR = 0x0C;
MODE = 0xE2;
//Set up PWM Registrer
PWMCLK = 0; // Sets source clocks to clock A
PWMPOL = 0; // The signal goes from low to high
PWMCTL = 0; // Makes all channels 8-bit
PWMCAE = 0; // Signals are left aligned
PWMPER1 = 250; // Sets the period of the signal to 250 clock
PWMDTY1 = 175; // Makes the duty cycle equal to 30%
PWMPRCLK = 2; //Sets the prescaler to 4
PMWE = 2; //Enables and starts channel 1
….
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 49
49
http://en.wikipedia.org/wiki/Pulse-width_modulation
http://www.netrino.com/Embedded-Systems/How-To/PWM-Pulse-Width-Modulation
Cetinkunt, Sabri. Mechatronics. Hoboken, NJ: Wiley, 2006. Print.
http://www.jimfranklin.info/microchipdatasheets/00538c.pdf
http://www.allaboutcircuits.com/vol_6/chpt_6/9.html
http://www.dprg.org/tutorials/2005-11a/index.html
http://www.4qdtec.com/pwm-01.html
http://skywalker.cochise.edu/rgill/ch02elec.ppt
http://pcbheaven.com/wikipages/PWM_Modulation/
Matlab 2009 online documentation
http://www.epanorama.net/links/motorcontrol.html#ac
MC9S12C Family, MC9S12GC Family Reference Manual, (pp. 347-382)
REFERENCES
50
Questions?
10/29/2009
Pulse Width Modulation - Val Tocitu,
Jason Kulpe, Alex Mariuzza 51
51

More Related Content

Similar to PWM_F09.ppt

RAM Audio Catalogue - Premium Audio Power Amplifiers
RAM Audio Catalogue - Premium Audio Power AmplifiersRAM Audio Catalogue - Premium Audio Power Amplifiers
RAM Audio Catalogue - Premium Audio Power Amplifiersproaudioindia
 
Motor Control of Drives using Control Electrical
Motor Control of Drives using Control ElectricalMotor Control of Drives using Control Electrical
Motor Control of Drives using Control Electricalbalaji765046
 
RF Basics, RF for Non-RF Engineers.pdf
RF Basics, RF for Non-RF Engineers.pdfRF Basics, RF for Non-RF Engineers.pdf
RF Basics, RF for Non-RF Engineers.pdfatsnoida3
 
Automatic doorbell with object detection
Automatic doorbell with object detectionAutomatic doorbell with object detection
Automatic doorbell with object detectionAnurag Alaria
 
AUDIO FREQUENCY TRACK CIRCUITS
AUDIO FREQUENCY TRACK CIRCUITSAUDIO FREQUENCY TRACK CIRCUITS
AUDIO FREQUENCY TRACK CIRCUITSsspardesh
 
Modulation
ModulationModulation
Modulationsristykp
 
Receiver Desense Common Issue
Receiver Desense Common IssueReceiver Desense Common Issue
Receiver Desense Common Issuecriterion123
 
BlueOptics Bo66jxx680d 10gbase cwdm xfp transceiver 1471nm 1611nm 80 km singl...
BlueOptics Bo66jxx680d 10gbase cwdm xfp transceiver 1471nm 1611nm 80 km singl...BlueOptics Bo66jxx680d 10gbase cwdm xfp transceiver 1471nm 1611nm 80 km singl...
BlueOptics Bo66jxx680d 10gbase cwdm xfp transceiver 1471nm 1611nm 80 km singl...CBO GmbH
 
Panasonic SA-AK450P SA-AK450PC - Manual de servicio
Panasonic SA-AK450P SA-AK450PC - Manual de servicioPanasonic SA-AK450P SA-AK450PC - Manual de servicio
Panasonic SA-AK450P SA-AK450PC - Manual de servicioAnonimo Goncen
 
Webinar: Simple Ideas to Make EMI Issues a Thing of the Past
Webinar: Simple Ideas to Make EMI Issues a Thing of the PastWebinar: Simple Ideas to Make EMI Issues a Thing of the Past
Webinar: Simple Ideas to Make EMI Issues a Thing of the PastVicor Corporation
 

Similar to PWM_F09.ppt (20)

RAM Audio Catalogue - Premium Audio Power Amplifiers
RAM Audio Catalogue - Premium Audio Power AmplifiersRAM Audio Catalogue - Premium Audio Power Amplifiers
RAM Audio Catalogue - Premium Audio Power Amplifiers
 
Clase 5 (1) (1).pdf
Clase 5 (1) (1).pdfClase 5 (1) (1).pdf
Clase 5 (1) (1).pdf
 
Speed control of motor
Speed control of motorSpeed control of motor
Speed control of motor
 
PCM-Part 1.pptx
PCM-Part 1.pptxPCM-Part 1.pptx
PCM-Part 1.pptx
 
Sine wave inverter
Sine wave inverterSine wave inverter
Sine wave inverter
 
Motor Control of Drives using Control Electrical
Motor Control of Drives using Control ElectricalMotor Control of Drives using Control Electrical
Motor Control of Drives using Control Electrical
 
Microcontroller part 3
Microcontroller part 3Microcontroller part 3
Microcontroller part 3
 
Seminar302
Seminar302Seminar302
Seminar302
 
Ec8791 lpc2148 pwm
Ec8791 lpc2148 pwmEc8791 lpc2148 pwm
Ec8791 lpc2148 pwm
 
RF Basics, RF for Non-RF Engineers.pdf
RF Basics, RF for Non-RF Engineers.pdfRF Basics, RF for Non-RF Engineers.pdf
RF Basics, RF for Non-RF Engineers.pdf
 
Automatic doorbell with object detection
Automatic doorbell with object detectionAutomatic doorbell with object detection
Automatic doorbell with object detection
 
AUDIO FREQUENCY TRACK CIRCUITS
AUDIO FREQUENCY TRACK CIRCUITSAUDIO FREQUENCY TRACK CIRCUITS
AUDIO FREQUENCY TRACK CIRCUITS
 
Unit 5 (13-05-23).pdf
Unit 5 (13-05-23).pdfUnit 5 (13-05-23).pdf
Unit 5 (13-05-23).pdf
 
Modulation
ModulationModulation
Modulation
 
Receiver Desense Common Issue
Receiver Desense Common IssueReceiver Desense Common Issue
Receiver Desense Common Issue
 
BlueOptics Bo66jxx680d 10gbase cwdm xfp transceiver 1471nm 1611nm 80 km singl...
BlueOptics Bo66jxx680d 10gbase cwdm xfp transceiver 1471nm 1611nm 80 km singl...BlueOptics Bo66jxx680d 10gbase cwdm xfp transceiver 1471nm 1611nm 80 km singl...
BlueOptics Bo66jxx680d 10gbase cwdm xfp transceiver 1471nm 1611nm 80 km singl...
 
Panasonic SA-AK450P SA-AK450PC - Manual de servicio
Panasonic SA-AK450P SA-AK450PC - Manual de servicioPanasonic SA-AK450P SA-AK450PC - Manual de servicio
Panasonic SA-AK450P SA-AK450PC - Manual de servicio
 
311 pulse modulation
311 pulse modulation311 pulse modulation
311 pulse modulation
 
Pll ppt
Pll pptPll ppt
Pll ppt
 
Webinar: Simple Ideas to Make EMI Issues a Thing of the Past
Webinar: Simple Ideas to Make EMI Issues a Thing of the PastWebinar: Simple Ideas to Make EMI Issues a Thing of the Past
Webinar: Simple Ideas to Make EMI Issues a Thing of the Past
 

Recently uploaded

VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 

Recently uploaded (20)

VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 

PWM_F09.ppt

  • 1.
  • 2. 2  Introduction and definitions  Types of PWM  Methods of generation  Characteristics of PWM  Applications and examples  Implementation on the HCS12
  • 3. What is it?  Output signal alternates between on and off within specified period  Controls power received by a device  The voltage seen by the load is directly proportional to the source voltage 3
  • 4. Definitions  Duty Cycle: on-time / period  Vlow is often zero 4 LOW HI AVG V D DV V ) 1 (   
  • 5. Types of Pulse Width  Pulse center fixed, edges modulated  Leading edge fixed, tailing edge modulated  Tailing edge fixed, leading edge modulated  Pulse Width constant, period modulated 5
  • 6. Types of Pulse Width 6
  • 7. Analog PWM signals can be made by combining a saw- tooth waveform and a sinusoid 7 PWM output is formed by the intersection of the saw-tooth wave and sinusoid Analog Generation of PWM
  • 8. Digital Methods of Generating PWM  Digital: Counter used to handle transition  Delta : used to find the PWM at a certain limit  Delta Sigma: used to find the PWM but has advantage of reducing optimization noise 8
  • 9. Applications to DC Motors 11 • The voltage supplied to a DC motor is proportional to the duty cycle • Both brushed and brushless motors can be used with PWM • Both analog and digital control techniques and components are available
  • 10. Three Phase AC motors with PWM  3 different AC currents at different phases  Phase: 120 degrees apart  Creates constant power transfer  Rotating magnetic field  Pulses substitute for AC current 12
  • 11. Space Vector Modulation  Used for three-phase AC motors  Convert DC current to AC current  Gates turned on/off at different intervals  3 PWM created 13
  • 13. • average value proportional to duty cycle, D • low power used in transistors used to switch the signal • fast switching possible due to MOSFETS and power transistors at speeds in excess of 100 kHz • digital signal is resistant to noise • less heat dissipated versus using resistors for intermediate voltage values 15 Advantages of PWM
  • 14. 16  Cost  Complexity of circuit  Radio Frequency Interference  Voltage spikes  Electromagnetic noise Disadvantages of PWM
  • 15. 17  Introduction and definitions  Types of PWM  Methods of generation  Characteristics of PWM  Applications and examples  Implementation on the HCS12 Presenter: Jason Kulpe
  • 16. • In the past, motors were controlled at intermediate speed by using resistors to lower delivered power • Electric stove heater • Lamp dimmers • Voltage regulation – convert 12 volts to 5 volts by having a 41.7% duty cycle • Sound production: PWM controlled signals give sound effects similar to a chorus • Power transfer: PWM used to reduce the total power given to a load without relying on resistive losses 18 Applications of PWM
  • 17. • commonly used in toys • lowpass filter smooths out transients from harmonic effects • frequency values of harmonics doesn’t change, but the amplitude does, which adjusts the analog output signal 19 PWM used with D/A conversion
  • 18. 20 • clock signal is found “inside” PWM signal • more resistant to noise effects than binary data alone • effective at data transmission over long distance transmission lines PWM used to transmit data in telecommunications
  • 19. 1. Must be at least 10 times higher than the control system frequency 2. Higher than 20kHz – audible frequency of sounds to avoid annoying sound disturbances, caused by magnetostriction 3. If too low the motor is pulsed, not continuous, because the motor’s inductance can not maintain the current 4. Inverse of frequency should be much less than the motor/load time constant 5. Higher error from ripple voltages Frequency of the PWM Signal Upper Limits Lower Limits 1. If too high the inductance of the motor causes the current drawn to be unstable 2. MOSFET transistor generates heat during switching 3. Limited by resolution of controller 4. Eddy currents generated in electromagnetic coils which lead to adverse heating 5. Heat losses in electromagnetic materials is proportional to frequency squared 22
  • 20. Potentiometer is used to adjust the duty cycle 23 Example: PWM with 555 Timer
  • 21. 1. Maxon EC-16 brushless motor, Time constant = 8.75 ms 2. Want to avoid audible frequencies f ≥ 20 kHz 3. PID control loop running at 150 Hz f ≥ 10 ∙ 150 Hz Requirements Hz 117 5 . 8 1    f ms f 24 Example: Specifying circuit elements
  • 22. 1 1 44 . 1 C R f  Set f to 25 kHz to add in a factor of safety Choosing C1 to be 100 nF, R1 is 576 Ω ~ 500 Ω Recalculating with these values f = 28.8 kHz This circuit has a PWM frequency according to: ≥ 117 Hz ≥ 20 kHz ≥ 1.5 kHz f Check constraints 25 Example: Specifying circuit elements
  • 23. Matlab can do PWM! 26 The procedure works similar to the generation of analog PWM using a sinusoid and saw-tooth wave
  • 24. 18 kHz frequency Continuous 28 amps $55.95 Where can I buy a PWM controller? Texas Instruments Digikey Mouser Electronics Critical Velocity Motor Control Texas Instruments TAS5508B 8-Channel Digital Audio PWM Processor 64 pin chip, max 192 kHz frequency $7.25 120 amps, used for hybrid vehicles $469.00 SMALL H U G E 27
  • 25. 28  Introduction and definitions  Types of PWM  Methods of generation  Characteristics of PWM  Applications and examples  Implementation on the HCS12 Presenter: Alex Mariuzza
  • 26. PWM Implementation  The signal is outputted through Port P  Six Channels  Dedicated Chip 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 29 29
  • 27. PWM Module  Each channel has a dedicated counter  Programmable duty and period  Independently adjustable clock, polarity, and alignment 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 30 30
  • 28. PWM Module- Other Features  8-bit and 16-bit resolution supported  Two PWM channels can be concatenated together  Four source clocks (A, SA, B, SB)  Emergency Shutdown  Some changes take a complete cycle to be implemented  Modes of Operation:  Normal: everything is available  Wait: Low-power consumption and clock disabled  Freeze: Option to disable clock is available 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 31 31
  • 29. PWM Configuration  Configured through specific registers  Registers are located from $00E0 to $00FE  There are repeated registers (ex. 0013-0017) 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 32 32
  • 30. PWM Enable Register  Located at $00E0  Code Warrior variable: PWME  Set PWMEx to 0 to disable the channel  Set PWMEx to 1 to enable it  Channel is activated when bit is set  If 16-bit resolution used, then PWME4/2/0 are deactivated 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 33 33
  • 31. PWM Polarity Register  Located at $00E1  Code Warrior variable : PWMPOL  Set PPOLx to 0, signal goes from low to high  Set PPOLx to 1, signal goes from high to low 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 34 34
  • 32. PWM Clock Select Register  Located at $00E2  Code Warrior variable : PWMCLK  Set PCLK5/4/1/0 to 0 to use clock A  Set PCLK5/4/1/0 to 1 to use clock SA  Set PCLK3/2 to 0 to use clock B  Set PCLK3/2 to 1 to use clock SB 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 35 35
  • 33. PWM Prescaler Register  Located at $00E3  Variable: PWMPRCLK  Used to prescale clocks A and B       Frequency PWM ) 1 2 ( Frequency Clock Bus Frequency PWM Resolution Frequency Clock Bus Presclarer      N 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 36 36
  • 34. PWM Scale A Register  Located at $00E8  Code Warrior variable: PWMSCLA  Store a hexadecimal value in order to change the clock frequency of SA  Note: if set to $00, PWMSCLA is set to 256 PWMSCLA 2 Frequency A Clock Frequency SA Clock   10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 37 37
  • 35. PWM Scale B Register  Located at $00E9  Code Warrior variable: PWMSCLB  Store a hexadecimal value in order to change the clock frequency of SA  Note: if set to $00, PWMSCLB is set to 256 PWMSCLB 2 Frequency B Clock Frequency SB Clock   10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 38 38
  • 36. PWM Center Align Register  Located at $00E4  Code Warrior variable: PWMCAE  Set CAEx to 0 for left align signal  Set CAEx to 1 for center align signal  Note: can only be set when channel is disabled 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 39 39
  • 37. Signal Alignment  Signal changes when counter is equal to period register  In the center aligned mode, the PWM counter goes from a down-count to a up-count to down-count, etc.  In the left aligned mode, the PWM counter is a up-counter and rests to zero when it overflows 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 40 40
  • 38. PWM Control Register  Located at $00E5  Code Warrior variable: PWMCTL  Set CONxy to 0 to keep PWM channels separate (8-bit)  Set CONxy to 1 to concatenate PWM channels x and y together (16- bit).  Channel y determines the configuration  x becomes the high byte and y becomes the low byte  Bits PSWAI and PFRZ set either wait or freeze mode  Changes only occur when channels are disabled 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 41 41
  • 39. PWM Counter Register  Located at $00EC through $00F1  Code Warrior variable: PWMCNTx  One per channel  It tracks the cycle counts  It can be read  If written to, the count is reset to $00 and a up-count starts 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 42 42
  • 40. PWM Period Register  Located at $00F2 through $00F7  Variable: PWMPERx  Store a hexadecimal value to limit maximum value of counter  Changes occur when:  Current period ends  Counter is written to  Channel is disabled Frequency Signal PWM Frequency Source PWM PWMPERx  Left-Aligned: Frequency Signal PWM 2 Frequency Source PWM PWMPERx   Center-Aligned: 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 43 43
  • 41. PWM Duty Register 100 PWMPERx Cycle Duty - PWMPERx PWMDTYx   • Located at $00F8 through $00FD • Code Warrior variable: PWMDTYx • Store a hexadecimal value to control when signal changes • Changes occur when: • Current period ends • Counter written to • Channel is disabled 100 PWMPERx Cycle Duty PWMDTYx   Polarity = 0: 10/29/2009 44 Polarity = 1: 44
  • 42. PWM Shutdown Register • Located at $00FE • Code Warrior variable: PWMSDN • PWMENA: Enables and disables emergency shut down • PWMIF (Interrupt flag): Set when an input is detected in pin 5 • PWMIE (Interrupt Enable): Enables and disables CPU interrupts • PWMRSTRT: Resets the counters • PWMLVL (Shutdown Output Level): Determines if output is high or low when shutdown • PWM5IN (Input Status): Reflects status of pin 5 • PWM5INL: Determines active level of pin 5 45 45
  • 43. How it all works Clock A, SA, B, or SB 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 46 46
  • 44. Example  Desired Signal:  8 kHz PWM signal  Duty Cycle of 30%  Left Aligned  Channel 1  Low → High  8-bit channel   $02 PWMPRCLK 4 91 . 3 10 8 ) 1 2 ( 10 8 Prescaler 3 8 6          $00 PWMCLK FA $ 250 10 8 10 2 10 8 4 10 8 PWMPER1 3 6 3 6                 AF $ 175 100 250 30 - 250 PWMDTY1     $00 PWMCAE  $02 PWME  $00 PWMPOL $00 PWMCTL 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 47 47
  • 45. Assembly Code PWME EQU $00E0 PWMPOL EQU $00E1 PWMCLK EQU $00E2 PWMPRCLK EQU $00E3 PWMCAE EQU $00E4 PWMCTL EQU $00E5 PWMPER1 EQU $00F3 PWMDTY1 EQU $00F9 ORG $1000 LDAA #$00 STAA PWMCLK ; Sets source clocks to clock A STAA PWMPOL ; The signal goes from low to high STAA PWMCTL ; Makes all channels 8-bit STAA PWMCAE ; Signals are left aligned LDAA #$FA STAA PWMPER1 ; Sets the period to 250 clock cycles LDAA #$AF STAA PWMDTY1 ; Makes the duty cycle equal to 30% LDAA #$02 STAA PWMPRCLK ; Sets the prescaler to 4 STAA PMWE ; Enables and starts channel 1 …… 10/29/2009 48 48
  • 46. C Code #include <hidef.h> /* common defines and macros */ #include <mc9s12c32.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE “mc9s12c32” // Set up chip in expanded mode MISC = 0x03; PEAR = 0x0C; MODE = 0xE2; //Set up PWM Registrer PWMCLK = 0; // Sets source clocks to clock A PWMPOL = 0; // The signal goes from low to high PWMCTL = 0; // Makes all channels 8-bit PWMCAE = 0; // Signals are left aligned PWMPER1 = 250; // Sets the period of the signal to 250 clock PWMDTY1 = 175; // Makes the duty cycle equal to 30% PWMPRCLK = 2; //Sets the prescaler to 4 PMWE = 2; //Enables and starts channel 1 …. 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 49 49
  • 47. http://en.wikipedia.org/wiki/Pulse-width_modulation http://www.netrino.com/Embedded-Systems/How-To/PWM-Pulse-Width-Modulation Cetinkunt, Sabri. Mechatronics. Hoboken, NJ: Wiley, 2006. Print. http://www.jimfranklin.info/microchipdatasheets/00538c.pdf http://www.allaboutcircuits.com/vol_6/chpt_6/9.html http://www.dprg.org/tutorials/2005-11a/index.html http://www.4qdtec.com/pwm-01.html http://skywalker.cochise.edu/rgill/ch02elec.ppt http://pcbheaven.com/wikipages/PWM_Modulation/ Matlab 2009 online documentation http://www.epanorama.net/links/motorcontrol.html#ac MC9S12C Family, MC9S12GC Family Reference Manual, (pp. 347-382) REFERENCES 50
  • 48. Questions? 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 51 51