sinusoidal PWM


Closed Thread
Results 1 to 40 of 84

Thread: sinusoidal PWM

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Hi,
    Yes, convert from degrees which is the number in column A to radians which is what Excel wants.

    1) The SIN of an angle of 0-360° varies from -1 to +1 since we're going to use the values to set a PWM dutycycle we can't have negative numbers, we can't have a dutycycle of LESS than 0. So we add 1 to get a value ranging from 0 to 2 instead of +/-1.

    2) Then we divide that by 2 to get the value ranging from 0 to 1 to make the next step more logical...

    3) Again, since we're going to use the final value to set the dutycycle produced by the PWM generator we can't have the value ranging from 0 to 1, we need to scale the value up to match the number of bits of resolution we have in the PWM generator. If it's 8 bits multiply by 255 to get a value ranging from 0 to 255 (0 is 0% dutycycle, 255 is 100% dutycycle). If you have 9 bits resolution multiply by 512 and so on.

    /Henrik.

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Hi,
    The Standard Hardware PWM modules on the PICs are generally 10 bits CCPRxL (8 bits) plus the 2 LSBs being in the CCPxCON<5:4>. How many bits you can obtain from the PWM module is dependent on the frequency. Sometimes updating the registers could be a bit troublesome and not within a single instruction cycle. What I do personally is select a 10 bit resolution and use only the higher 8 bits. A straight loading of the CCPRxL does the job with the benefit of not hitting 100% duty cycle which is required for the bootstrap gate drivers.
    For the PICs with the PowerControl PWM module (sometimes also referred to as a motor control PWM) you can get upto 14 bits of resolution with a dedicated register pairs. And generally they at least have 3 PWM units with complementary outputs / dead time / Fault Input which simplifies the design and control of 3 phase systems greatly.

    My choices are the PIC18F1330 and PIC18F4431(has 4 channel sequential sampling capability like the 16bit PIC24/dsPICs).
    Regards

    Sougata

  3. #3
    Join Date
    Oct 2011
    Posts
    52


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Hi !

    Thankx sougata and HenrikOlsson for your helpwhich take me into good stages

    there some challenges have any one can help me
    (1) My PIC is16cF877 having CCP1 and CCP2 can it able to generate three phase SPWM?. for my little knowledge I know that for single phase the duty cycle is stored into CCP1 to generate SPWM. for three phase should I have a pic of three CCP modules?.

    (2) how can I improves these my small number of steps(10) cause I read page 63/281 of PIC 16F87X data sheet and microchip application note AN655 page 1/16 I saw the formular for resolution and number of steps respectively.

    The maximum PWM resolution (bits) for a given PWM frequensy is given by the formular below


    Resolution = log(FOSC/FWPM)/log(2) bits

    I want to set my PWM frequency = 5kHZ
    my FOSC = 4MHZ
    which gives resolution of 10 it's ok and scale factor of 1023

    but
    from microchip application note AN655
    PWM_Freq = (Sine_freq) • (# of steps) • 10

    my sine frequency is 50Hz
    PWM_Freq =5kHZ

    gives me 10 steps which I think is very small to give clear SPWM.

    thankx

  4. #4
    Join Date
    Oct 2011
    Posts
    52


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Hi !

    Thankx sougata and HenrikOlsson for your helpwhich take me into good stages

    there some challenges I have any one can help me:

    (1) My PIC is16cF877 have CCP1 and CCP2 can it able to generate three phase SPWM?. for my little knowledge I know that for single phase the duty cycle is stored into CCP1 to generate SPWM. for three phase should I have a pic with three CCP modules?.

    (2) how can I improves these small number of steps(10) cause I read page 63/281 of PIC 16F87X data sheet and microchip application note AN655 page 1/16 I .http://ww1.microchip.com/downloads/e...tes/00655a.pdf I read the formular for bits resolution and number of steps respectively.

    The maximum PWM resolution (bits) for a given PWM frequensy is given by the formular below


    Resolution = log(FOSC/FWPM)/log(2) bits

    I want to set my PWM frequency = 5kHZ
    my FOSC = 4MHZ
    which gives resolution of 10 it's ok and scale factor of 1023

    but
    from microchip application note AN655
    PWM_Freq = (Sine_freq) • (# of steps) • 10

    my sine frequency is 50Hz
    PWM_Freq =5kHZ

    gives me 10 steps which I think is very small to give clear SPWM .

    thankx

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Hi,
    What exactly do you mean with SPWM? What does the S mean?

    If you're generating the PWM signal with CCP-module you'll need 3 CCP-modules to generate three individual PWM signals. As have already been suggested ditch the '877 and take a look at the 18F2431/4431 which is designed for motor control providing deadtime control and dedicated hardware fault inputs to disable the PWM signals - and more.

    If you need to stick to a 16 series PIC then use the parametric search tool at Microchips website to look up a PIC with three CCP-modules, perhaps the 16F777.

    I just looked briefly at the app-note you reference and they seem to be using a low-pass filter to get a "true" sine-wave output, to do that they calculated/estimated that at least 10PWM cycles is needed to bring the output voltage to the desired value.

    How many "steps" do you want, per period? Let's say you have a lookup table of 32 'steps'. Ie it takes 32 "updates" to create one full cycle of the sinewave, so at 50Hz you need to change the PWM dutycycle 50*32=1600 times per second, which means that you'll get atleast three full PWM cycles for each "step" with a 5kHz PWM frequency, I think that'll work.

    /Henrik.

  6. #6
    Join Date
    Oct 2011
    Posts
    52


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Hi !


    SPWM stands for Sinusoidal Pulse With Modulation.These signals will be used to control Three phase inverter.

    thankx

  7. #7
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    I'm afraid the letter sequence SPWM actually was derived by Darrel for his contribution of Software Pulse Width Modulation.
    Dave Purola,
    N8NTA
    EN82fn

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts