2Outline Introduction and Definition Types of PWM Method of Generation Duty CycleTypes of PWMMethod of GenerationImplementation on the HCS12Applications of PWMChoosing PWM Frequency
3Presenter: Jieun Yoo Introduction and Definition Types of PWM Duty CycleTypes of PWMMethod of GenerationImplementation on the HCS12Applications of PWMChoosing PWM Frequency
4DefinitionPulse Width Modulation (PWM) is the way of controlling a digital signal simulating an analog signal.The on-off behavior changes the average power of signal.Output signal alternates between on and off with in specified period.
5Duty Cycle A percentage measurement of how long the signal stays on. Period (T)Duty Cycle (D)VLVHOnOff
6Duty Cycle Duty Cycle: Average signal : (Usually, VL is taken as zero volts for simplicity.)Period (T)Duty Cycle (D)VLVHOnOff
7Duty Cycle Characteristic Presented by: Bryan O’NealDuty Cycle CharacteristicThe average value of a PWM signal increases linearly with the duty cycle
8Types of PWM – Lead Edge Modulation The lead edge is fixed at the lead edge of the window and the trailing edge is modulated.
9Types of PWM – Trail Edge Modulation The trail edge is fixed and the lead edge is modulated.
10Types of PWM – Centered Pulses The pulse center is fixed in the center of the time window and both edges of pulse are modulated
11Analog Generation of PWM Analog PWM signals can be made by combining a saw- tooth waveform and a sinusoidPWM output is formed by the intersection of the saw-tooth wave and sinusoid
12Digital Generation - Delta Method Output signal compared with limitsEvery time limits reached, changes state
13Digital Generation - Delta Sigma Method PWM signal generated by Delta methodError = output – referenceError integratedState changes when integration reaches limits
14Presenter: Gregory Bonisteel Introduction and DefinitionDuty CycleTypes of PWMMethod of GenerationImplementation on the HCS12Applications of PWMChoosing PWM Frequency
15Pulse Width Modulator: PWM8B6CV1 Similar to output comparePort PSix 8-bit channels or three 16-bit channels for greater resolutionFour clock sources (A, B, SA and SB) provide for a wide range of frequenciesEmergency shutdownModes of operationWait modeFreeze mode
16PWM Block Diagram Each Channel has; Enable/disable switch Dedicated counterProgrammable period and duty cycleProgrammable center or left alignedProgrammable clock select logicSoftware selectable duty pulse polarity
18PWM Enable Register Located at $00E0 Set PWMEx to 0 to disable the channelSet PWMEx to 1 to enable itNote:Channel is activated when bit is setIf 16-bit resolution used, then PWME4/2/0 are deactivated
19PWM Polarity Register Located at $00E1 Set PPOLx to 0, signal goes from low to highSet PPOLx to 1, signal goes from high to low
20PWM Clock Select Register Located at $00E2Set PCLK5/4/1/0 to 0 to use clock ASet PCLK5/4/1/0 to 1 to use clock SASet PCLK3/2 to 0 to use clock BSet PCLK3/2 to 1 to use clock SB
21PWM Prescale Clock Select Register Located at $00E3Used to prescale clocks A and B
22PWM Center Align Enable Register Located at $00E4Set CAEx to 0 for left align signalSet CAEx to 1 for center align signalNote:Can only be set when channel is disabledSignal changes when counter is equal to period register
23Left vs. Center AlignedIn the left aligned mode, the PWM counter is a up-counter and rests to zero when it overflowsIn the center aligned mode, the PWM counter goes from a down-count to a up-count to down-count, etc.
24PWM Control Register Located at $00E5 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).x becomes the high byte and y becomes the low byteChannel y determines the configurationBits PSWAI and PFRZ set either wait or freeze modeNoteChanges only occur when channels are disabled
25PWM Scale A Register Located at $00E8 Programmable scaling of clock A to generate clock SANote
26PWM Scale B Register Located at $00E9 Programmable scaling of clock B to generate clock SBNote
27PWM Channel Counter Register Located at $00EC through $00F1One per channelIt tracks the cycle countsWhen channel is enabled up-count startsNoteWriting to counter while a channel is enable can cause irregular PWM cycles
28PWM Channel Period Register Located at $00F2 through $00F7PWMPERxStore a hexadecimal value to limit maximum value of counterChanges occur when one of following happenCurrent period endsCounter is written toChannel is disabled
29PWM Channel Duty Register Located at $00F8 through $00FDStore a hexadecimal value to control when signal changesChanges occur when:Current period endsCounter written toChannel is disabled
31Example: Configuring PWM Channel 0 Frequency: 40 kHzPeriod = 1/Frequency = 25μsDuty Cycle = 50%Positive polarityLeft aligned outputTo choose clock source, consider resolution of PWMNumber of distinct duty cycle values is equal to the PWM period in clock cyclesBus clock period is 125 ns 200*125ns = 25μsSince 200 < 255, we can use clock A with a prescaler=1
34Configuring Channel 0 in C Code // Setup chip in expanded modeMISC = 0x03;PEAR = 0x0C;MODE = 0xE2;TERMIO_Init(); // Init SCI SubsystemEnableInterrupts;PWMPER0 = 200; // set PWM period (125 ns * 200 = 25 us = 40 kHz)PWMDTY0 = 100; // set initial duty cycle (100/200 = 50%)// setup PWM systemPWMCLK_PCLK0 = 0; // set source to clock APWMPRCLK_PCKA0 = 0; // set prescaler for clock A = 1, so clock A = bus clockPWMPRCLK_PCKA1 = 0;PWMPRCLK_PCKA2 = 0;PWMCAE_CAE0 = 0; // "left aligned" outputPWMPOL_PPOL0 = 1; // set duty cycle to indicate % of high timePWMCNT0 = 0; // write to counter to make changes take effectPWME_PWME0 = 1; // enable PWM 0
35Presenter: Bryan Oneal Introduction and DefinitionDuty CycleTypes of PWMMethod of GenerationImplementation on the HCS12Applications of PWMChoosing PWM Frequency
36PWM Video Into to Applications You Tube search: PWM TutorialORClick Link
37Motivation for PWMIn the past, motors were controlled at intermediate speeds by using variable resistors to lower delivered powerFor example, a variable resister located in the foot pedal and connected in series with the motor of a sewing machine was used to control its speed.This method was inefficientPWM provided a great way to have compact and low cost means for applying adjustable power for many devices.
38PWM Applications Use as ADC DC Motors Telecommunications Voltage regulationRC devicesAudio/Video effectsPower deliveryAmplification
39PWM used with D/A conversion commonly used in toyslowpass filter smooths out transients from harmonic effectsfrequency values of harmonics doesn’t change, but the amplitude does, which adjusts the analog output signal
40Application to DC Motors Voltage supplied is directly proportional to the duty cycleAbility to control the speed of the motor via the duty cycleExampleCan 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.
41PWM used to transmit data in telecommunications clock signal is found “inside” PWM signalmore resistant to noise effects than binary data aloneeffective 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).
42Using PWM to generate an analog voltage level Any shape waveform can be createdPWM frequency should be much higher than the frequency of waveform generated
43RC DevicesTransmitters send PWM signals to the receivers on board of Radio controlled devices for specific control.
44Audio devicesUsed in audio amplifiers to generate output signals for cellphone speakers to high-power stereo systemsProduce less heat than traditional analog amplifiersSaving energy. Critical for hand held electronics.Gives a sound effect similar to chorus when used in audio circuit.
45Video devicesPWM dimming provides superior color quality in LED video displayWith a 12 bits resolutionthe TLC5940 PWM dimming canprovide up to 68.7 million colorsto a pixel.
46Power deliveryeffective 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
47Example: PWM with 555 Timer Potentiometer is used to adjust the duty cycle
49Frequency of the PWM Signal Lower LimitsUpper LimitsMust be at least 10 times higher than the control system frequencyHigher than 20kHz – audible frequency of sounds to avoid annoying sound disturbances.If too low the motor is pulsed, not continuous, because the motor’s inductance can not maintain the currentInverse of frequency should be much less than the motor/load time constantHigher error from ripple voltagesIf too high the inductance of the motor causes the current drawn to be unstableMOSFET transistor generates heat during switchingLimited by resolution of controllerEddy currents generated in electromagnetic coils which lead to adverse heatingHeat losses in electromagnetic materials is proportional to frequency squared
50Choosing your PWM frequency Input signal (PWM)Output signal (actuator response)
51Matlab can do PWM!The procedure works similar to the generation of analog PWM using a sinusoid and saw-tooth wave
52HUGE Where can I buy a PWM controller? Large - Texas Instruments - Digikey- Mouser Electronics- Critical Velocity Motor ControlHUGELargeSMALLTexas Instruments TAS5508B8-Channel Digital Audio PWM Processor64 pin chip, max 192 kHz frequency$7.2518 kHz frequencyContinuous 28 amps$55.95120 amps, used for hybrid vehicles$469.00