Presentation is loading. Please wait.

Presentation is loading. Please wait.

Gregory Bonisteel Bryan Oneal Jieun Yoo 1 ME 4447/6405 November 3 rd, 2011.

Similar presentations


Presentation on theme: "Gregory Bonisteel Bryan Oneal Jieun Yoo 1 ME 4447/6405 November 3 rd, 2011."— Presentation transcript:

1 Gregory Bonisteel Bryan Oneal Jieun Yoo 1 ME 4447/6405 November 3 rd, 2011

2  Introduction and Definition ◦ Duty Cycle  Types of PWM  Method of Generation  Implementation on the HCS12  Applications of PWM  Choosing PWM Frequency 2

3  Introduction and Definition ◦ Duty Cycle  Types of PWM  Method of Generation  Implementation on the HCS12  Applications of PWM  Choosing PWM Frequency 3

4  Pulse 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. 4

5 A percentage measurement of how long the signal stays on. 5 Period (T) Duty Cycle (D) VLVL VHVH OnOff

6  Duty Cycle:  Average signal : (Usually, V L is taken as zero volts for simplicity.) 6 Period (T) Duty Cycle (D) VLVL VHVH OnOff

7 7 The average value of a PWM signal increases linearly with the duty cycle Presented by: Bryan O’Neal

8  The lead edge is fixed at the lead edge of the window and the trailing edge is modulated. 8

9  The trail edge is fixed and the lead edge is modulated. 9

10  The pulse center is fixed in the center of the time window and both edges of pulse are modulated 10

11  Analog PWM signals can be made by combining a saw- tooth waveform and a sinusoid 11 PWM output is formed by the intersection of the saw-tooth wave and sinusoid

12  Output signal compared with limits  Every time limits reached, changes state

13  PWM signal generated by Delta method  Error = output – reference  Error integrated ◦ State changes when integration reaches limits

14  Introduction and Definition ◦ Duty Cycle  Types of PWM  Method of Generation  Implementation on the HCS12  Applications of PWM  Choosing PWM Frequency 14

15 Similar to output compare Port P Six 8-bit channels or three 16-bit channels for greater resolution Four clock sources (A, B, SA and SB) provide for a wide range of frequencies Emergency shutdown Modes of operation –Wait mode –Freeze mode

16 Each Channel has; Enable/disable switch Dedicated counter Programmable period and duty cycle Programmable center or left aligned Programmable clock select logic Software selectable duty pulse polarity

17

18  Located at $00E0  Set PWMEx to 0 to disable the channel  Set PWMEx to 1 to enable it  Note: ◦ Channel is activated when bit is set ◦ If 16-bit resolution used, then PWME4/2/0 are deactivated

19  Located at $00E1  Set PPOLx to 0, signal goes from low to high  Set PPOLx to 1, signal goes from high to low

20  Located at $00E2  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

21 Located at $00E3 Used to prescale clocks A and B

22  Located at $00E4  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 ◦ Signal changes when counter is equal to period register

23 Left vs. Center Aligned In the left aligned mode, the PWM counter is a up-counter and rests to zero when it overflows In the center aligned mode, the PWM counter goes from a down-count to a up-count to down- count, etc.

24  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 byte  Channel y determines the configuration  Bits PSWAI and PFRZ set either wait or freeze mode  Note ◦ Changes only occur when channels are disabled

25  Located at $00E8  Programmable scaling of clock A to generate clock SA  Note

26  Located at $00E9  Programmable scaling of clock B to generate clock SB  Note

27  Located at $00EC through $00F1  One per channel  It tracks the cycle counts  When channel is enabled up-count starts  Note ◦ Writing to counter while a channel is enable can cause irregular PWM cycles

28  Located at $00F2 through $00F7  PWMPERx  Store a hexadecimal value to limit maximum value of counter  Changes occur when one of following happen ◦ Current period ends ◦ Counter is written to ◦ Channel is disabled

29  Located at $00F8 through $00FD  Store a hexadecimal value to control when signal changes  Changes occur when: ◦ Current period ends ◦ Counter written to ◦ Channel is disabled

30 $00FE

31 Example: Configuring PWM Channel 0  Frequency: 40 kHz  Period = 1/Frequency = 25μs  Duty Cycle = 50%  Positive polarity  Left aligned output  To choose clock source, consider resolution of PWM ◦ Number of distinct duty cycle values is equal to the PWM period in clock cycles  Bus clock period is 125 ns  200*125ns = 25μs  Since 200 < 255, we can use clock A with a prescaler=1

32  PWMCLK = #$00 - PWM0 uses clock A  PWMPRCLK = #$00 - Prescaler = 1  PWMPOL = #$01 - Positive polarity  PWMCAE = #$00 - Left aligned  PWMPER0 = #$C8 - Period = 200  PWMDTY0 = #$64 - Duty cycle = 100/200 = 50%  PWME = #$01 - Enable PWM channel 0 Example: Configuring PWM Channel 0

33 PWMEEQU$00E0 PWMCAEEQU$00E4 PWMDTY0EQU$00F8 PWMPER0EQU$00F2 PWMPOLEQU$00E1 PWMCLKEQU$00E2 PWMPRCLKEQU$00E3 ORG$1000 LDAA#$00 STAAPWMCLK;Use Clock A STAAPWMPRCLK ;Clock A prescaler = 1 STAAPWMCAE;Left aligned output LDAA#$01 STAAPWMPOL;Positive polarity (starts high) LDAA#$C8 STAAPWMPER0;Period = 200 (25μs) LDAA#$64;100 decimal STAAPWMDTY0;Duty cycle = 50% (100/200) LDAA#$01 STAAPWME;Enable PWM Channel 0... Assembly Code

34 Configuring Channel 0 in C Code // Setup chip in expanded mode MISC = 0x03; PEAR = 0x0C; MODE = 0xE2; TERMIO_Init(); // Init SCI Subsystem EnableInterrupts; PWMPER0 = 200; // set PWM period (125 ns * 200 = 25 us = 40 kHz) PWMDTY0 = 100; // set initial duty cycle (100/200 = 50%) // setup PWM system PWMCLK_PCLK0 = 0; // set source to clock A PWMPRCLK_PCKA0 = 0; // set prescaler for clock A = 1, so clock A = bus clock PWMPRCLK_PCKA1 = 0; PWMPRCLK_PCKA2 = 0; PWMCAE_CAE0 = 0; // "left aligned" output PWMPOL_PPOL0 = 1; // set duty cycle to indicate % of high time PWMCNT0 = 0; // write to counter to make changes take effect PWME_PWME0 = 1; // enable PWM 0

35  Introduction and Definition ◦ Duty Cycle  Types of PWM  Method of Generation  Implementation on the HCS12  Applications of PWM  Choosing PWM Frequency 35

36  You Tube search: PWM Tutorial OR Click Link 36

37 37 In the past, motors were controlled at intermediate speeds by using variable resistors to lower delivered power For 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 inefficient PWM provided a great way to have compact and low cost means for applying adjustable power for many devices. Motivation for PWM

38 38 PWM Applications PWM Applications  Use as ADC  DC Motors  Telecommunications  Voltage regulation  RC devices  Audio/Video effects  Power delivery  Amplification

39 39 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 PWM used with D/A conversion

40  Voltage 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. 40

41 41 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 The 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). PWM used to transmit data in telecommunications

42  Any shape waveform can be created  PWM frequency should be much higher than the frequency of waveform generated 42

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

44  Used in audio amplifiers to generate output signals for cellphone speakers to high-power stereo systems  Produce 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. 44

45  PWM dimming provides superior color quality in LED video display  With a 12 bits resolution the TLC5940 PWM dimming can provide up to 68.7 million colors to a pixel. 45

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

47 47 Potentiometer is used to adjust the duty cycle Example: PWM with 555 Timer

48 48

49 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. 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 49

50 50 Output signal (actuator response) Input signal (PWM)

51 51 The procedure works similar to the generation of analog PWM using a sinusoid and saw-tooth wave

52 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 $ amps, used for hybrid vehicles $ SMALL Large HUGEHUGE 52


Download ppt "Gregory Bonisteel Bryan Oneal Jieun Yoo 1 ME 4447/6405 November 3 rd, 2011."

Similar presentations


Ads by Google