Unstable sine PWM output


Closed Thread
Results 1 to 30 of 30

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Unstable sine PWM output

    If you don't have any Logic Analyser handy, I would use a PC soundcard and record the PWM waveform to see if it's a Scope Trigger problem first.

    Where your scope get it's trigger from?!? Internal or External?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Unstable sine PWM output

    The scope is trigerred to external (CH1), rising edge with noise rejection.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Unstable sine PWM output

    News :

    I've made some experiments, it's not an oscilloscope trigger problem.

    I think it comes from my code. But where?

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Unstable sine PWM output

    Hi, Pxidr84

    Something caught my attention ... in the reloading, you use DIV32; are you sure there's no possible interrupt while DIV32 works ???

    as timer0 is a low priority interrupt ... I'd check that two or three times.

    ... just an idea after a very quick browse ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: Unstable sine PWM output

    Quote Originally Posted by Acetronics View Post
    Hi, Pxidr84

    Something caught my attention ... in the reloading, you use DIV32; are you sure there's no possible interrupt while DIV32 works ???

    as timer0 is a low priority interrupt ... I'd check that two or three times.

    ... just an idea after a very quick browse ...

    Alain
    Hi,

    Timer0 interrupt is used for the calculation of the inverter paramaters (like the V/F ratio, the timer reload variable, etc.) It's a low priority interrupt because the Timer1 interrupt (used for the PWM generation) is very critical and must be
    executed all of the time.

    The DIV32 is used for calculate the timer reload value (the timer routine is from Henrik). However this routine is needed for output the desired sine frequency. This routine directly controls the Timer1 interrupt frequency. It is possible to avoid this DIV32 command (because it seems to take a LOT of ressources)?

    Maybe it's better to use Timer0 as a high priority interrupt?

    Maybe a PWM register is misconfigured?

    I don't know

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Unstable sine PWM output

    No ideas for this problem?

  7. #7
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Unstable sine PWM output

    Not sure of a solution yet, but from watching the posted video, I am guessing the problem is some kind of timing issue. I don't think you have things configured wrong as the output looks great most of the time. Rather I think there are some times when a counter gets reset of an interrupt gets interrupted. It glitches then goes right back to perfect wave.

    If you watch it and don't alter the frequency, does the glitch happen at regular intervals, or is it random in nature?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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