45
Pulse Width Modulation By: Zak Ahmad Phuc Dao Joel Toussaint

PWM_F10

Embed Size (px)

DESCRIPTION

its about the pwm

Citation preview

Pulse Width Modulation

Pulse Width ModulationBy:Zak AhmadPhuc DaoJoel ToussaintOutlineIntroductionPWM DefinitionsGenerationTypesPWM on the HCS12Applications

2Presented by Zak AhmadIntroductionPulse Width Modulation (PWM) is a technique for delivering partial power to a load via digital means.Other devices for delivering partial power: potentiometer and rheometer.

3

Bright BulbDim BulbPartial PowerPresented by: Zak AhmadIntroductionPulse Width Modulation (PWM) is a method for changing how long a square wave stays on.The on-off behavior changes the average power of the signal.If signal toggles between on and off quicker than the load, then the load is not affected by the toggling.

4Presented by: Zak AhmadDuty Cycle - IntroductionThe duty cycle (the width of the signal) is modulated.It is a percentage measurement of how long the signal stays on.Period (T)Duty Cycle (D)VLVHOnOff5Presented by: Zak Ahmad5Duty Cycle - DefinitionPeriod (T)Duty Cycle (D)VLVHOnOff6

Usually, VL is taken as zero volts for simplicity.Duty Cycle is determined by:Average signal can be found as:Presented by: Zak AhmadAdvantagesAverage value proportional to duty cycle, DLow power used in transistors used to switch the signalFast switching possible due to MOSFETS and power transistors at speeds in excess of 100 kHzDigital signal is resistant to noise Less heat dissipated versus using resistors for intermediate voltage values

7Presented by: Zak AhmadDisadvantagesCostComplexity of circuitRadio Frequency InterferenceVoltage spikes Electromagnetic noise

8Presented by: Zak AhmadPWM Generation - AnalogIntersective Method9

When sine is greater than sawtooth PWM is high.When sine is less than sawtooth PWM is low.PWM toggles when sine equals sawtoothPresented by: Zak Ahmad11223344PWM Generation - DigitalDelta Method10

Output is integratedLimit signals which are offset from a referenceWhen output signal reaches limit, PWM state changesPresented by: Zak AhmadPWM Generation - DigitalDelta Sigma Method11

Error = Ref PWMError is integratedWhen integration signal reaches limit, PWM state changesPresented by: Zak AhmadTypes of PWM Left AlignedLeft edge is fixed, the trailing edge is modulated.

12PeriodDuty Cycle~60%VloVhiOnOffPeriodVloVhiOnOffDuty Cycle~30%Presented by: Zak AhmadTypes of PWM Center AlignedCenter of signal is fixed, both edges are modulated13PeriodVloVhiPeriodVloVhiDuty Cycle~30%Duty Cycle~60%Presented by: Zak AhmadChoosing PWM FrequencyApplication dependant.Not too low:Audible frequenciesTwice the inverse of device time constant10 Times higher than control system frequencyNot too high:Transistors generate more heat at higher frequenciesSome loads will not respond at higher frequencies14Presented by: Zak AhmadPWM You Tube VideoYou Tube search: PWM Tutorial

OR

Click Link15Presented by: Zak AhmadOutlineIntroductionPWM DefinitionsGenerationTypesPWM on the HCS12Applications16Presented by Phuc DaoImplementing PWM Using the MC9S12C3217

Dedicated PWM8B6C Chip6 Independent 8-bit channels3 Independent 16-bit channelsSignal is outputted through Port P

Presented by: Phuc DaoPWM8B6C Module 18Dedicated counter for each channelProgrammable duty cycle and periodIndependently adjustable clock, polarity, and alignment

Presented by: Phuc DaoPWM8B6C Module - Other Features Four source clocks (A, B, SA, SB) for a wide frequency rangeEmergency shutdownSome changes take a complete cycle to take effectModes of Operation:Normal: everything is availableWait: Low-power consumption and clock disabledFreeze: Option to disable input clock19Presented by: Phuc Dao19

PWM8B6C Memory Map20Configured through specific registersBase address is defined at the MCU levelAddress offset is defined at the module levelRegister address = base address + address offsetRegisters are located from $00E0 - $00FF

Presented by: Phuc Dao20PWM Enable Register (PWME)PWME is located at $00E0Set PWMEx0: to disable PWM channel x1: to enable PWM channel xIf 16-bit resolution is used, then PWME4/2/0 are disabled

21

Presented by: Phuc DaoPWM Polarity Register (PWMPOL)PWMPOL is located at $00E1Set PPOLx to0: output channel starts low and goes high when duty cycle is reached1: output channel starts high and goes low when duty cycle is reached

22Presented by: Phuc DaoPWM Clock Select Register (PWMCLK)PWMCLK is located at $00E2Set PCLK5, PCLK4, PCLK1, PCLK0 to 0 to use Clock A1 to use Clock SASet PCLK3, PCLK2 to 0 to use Clock B1 to use Clock SB

23Presented by: Phuc Dao23PWM Prescaler Register (PWMPRCLK)PWMPRCLK is located at $00E3Used to prescale clocks A and B

24

Presented by: Phuc Dao24PWM Scale A Register (PWMSCLA)PWMSCLA is located at $00E8Scale value used in scaling Clock A to generate Clock SANote: When PWMSCLA = $00, PWMSCLA value is considered a full scale value of 256.

25Presented by: Phuc Dao25PWMSCLB is located at $00E9Scale value used in scaling Clock B to generate Clock SBNote: When PWMSCLA = $00, PWMSCLA value is considered a full scale value of 256.

26PWM Scale B Register (PWMSCLB)Presented by: Phuc Dao26PWM Control Register (PWMCTL)PWMCTL is located at $00E5Set CONxy to 0: to keep PWM channels separate (8-bit resolution)1: to concatenate PWM channels x and y together (16-bit resolution)Channel y determines the configurationx becomes the high byte and y becomes the low byteBits PSWAI and PFRZ set either wait or freeze modeNote: change these bits only when the corresponding channels are disabled27

Presented by: Phuc Dao27PWM Counter Register (PWMCNTx)Total of (6) 8-bit counters located at $00EC - $00F1One up/down counter per channelIn left aligned mode, the counter counts from 0 to the value in the period register-1. In center aligned mode, the counter counts from zero to the value in the period register-1 and then back down to zero.Any write to the register causes the value to be reset to #$00 and the counting procedure is restarted.

28Presented by: Phuc Dao28PWM Period Register (PWMPERx)(6) Period Registers located at $00F2 - $00F7 Determine the PWM periodChanges occur when:Current period endsCounter is written toChannel is disabled

Left-Aligned:

Center-Aligned:29

Presented by: Phuc Dao29PWM Duty Register (PWMDTYx)

(6) Duty Registers located at $00F8 - $00FDDetermines the duty of the associated PWM channelChanges occur when:Current period endsCounter written toChannel is disabled

Polarity = 0:30Polarity = 1:

Presented by: Phuc Dao30PWM Center Align Register (PWMCAE)PWMCAE is located at $00E4Set CAEx to 0: for left align output signal1: for center align output signalNote: can only be set when channel is disabled

31Presented by: Phuc Dao31Left vs. Center Aligned

Signal changes when counter is equal to period registerIn 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 32Presented by: Phuc Dao3233PWM ResolutionThe true resolution depends on the value in PWMPERx even though the PWM module is said to be 8-bit. The number of distinct duty cycles equals the value stored in PWMPERx.Maximum number of distinct duty cycles is achieved by writing $FF to the register PWMPERx so that it can represent 256 duty cycle states (00, 01, 02, , to FF), which corresponds to 28=256 resolution. Presented by: Phuc DaoOutlineIntroductionPWM DefinitionsGenerationTypesPWM on the HCS12Applications

34Presented by Joel ToussaintApplications TelecommunicationsDC motorsRC devicesAudio/video effectsVoltage regulation Use as ADC

Presented by: Joel Toussaint35Telecommunications Used in communication since a digital signal is more robust and less vulnerable to noise.Effective at data transmission over long distance transmission linesThe widths of the pulses correspond to specific data values encoded at one end and decoded at the other.Pulses of various lengths (the information itself) will be sent at regular intervals (the carrier frequency of the modulation).

Presented by: Joel Toussaint

36Application to DC MotorsVoltage supplied is directly proportional to the duty cycle Ability to control the speed of the motor via the duty cycle Example Can be used in regulating room temperature. A PC can sense the current temperature (using an analog-to-digital converter) and then automatically increase/decrease the fan's speed accordingly.

Presented by: Joel Toussaint37

Transmitters send PWM signals to the receivers on board of Radio controlled devices for specific control.

RC devicesPresented by: Joel Toussaint38Brightness controlled with a PWM circuit.

Presented by: Joel Toussaint39Video devicesPWM dimming provides superior color quality in LED video displayWith a 12 bits resolution the TLC5940 PWM dimming can provide up to 68.7 million colors to a pixel.

Presented by: Joel Toussaint40Audio devices Used in audio amplifiers to generate output signals for cellphone speakers to high-power stereo systemsProduce less heat than traditional analog amplifiers Saving energy. Critical for hand held electronics. Gives a sound effect similar to chorus when used in audio circuit.

41Power delivery effective at data transmission over long distance transmission linePower transfer: PWM used to reduce the total power given to a load without relying on resistive losses

Presented by: Joel Toussaint42Using PWM to generate an analog voltage levelAny shape waveform can be created PWM frequency should be much higher than the frequency of waveform generated

Presented by: Joel Toussaint

43Example of PWM circuit with 555 timer

Presented by: Joel Toussaint

44Reference http://cp.literature.agilent.com/litweb/pdf/5988-9904EN.pdfhttp://www.robotroom.com/PWM4.htmlMC9S12C Family, MC9S12GC Family Reference Manual, (pp. 347-382)ME 4447/6405 PWM Student Lectureswww.wikipedia.orgHan-Way Huang, The HCS12/9S12: An Introduction to Software & Hardware Interfacing. Thomson Delmar Learning, United States. 2006.http://www.pcmag.com/encyclopedia_term/0,2542,t=PWM&i=49992,00.asphttp://www.ece.tamu.edu/~reddy/ee449/notes/pulse.pdfhttp://cp.literature.agilent.com/litweb/pdf/5988-9904EN.pdfhttp://homepages.which.net/~paul.hills/SpeedControl/SpeedControllersBody.html

45