Unstable sine PWM output


Results 1 to 30 of 30

Threaded View

  1. #13


    Did you find this post helpful? Yes | No

    Default Re: Unstable sine PWM output

    Thanks for your help.

    So I've tried first to set a fixed reload value (64594) without calculations (to obtain 120Hz sine, the max. frequency). The sine wave was perfectly stable on the oscilloscope.

    This :
    dum=dum1*dum2
    reload=DIV32 freq
    reload=(65535-reload)+8
    was removed and replaced with :

    reload=64594
    I've also applied Henrik tips, like this :

    Code:
    ' Frequency reference control by potentiometer
    potsense=(potsense<<6)**maxfreq
    IF potsense<>freq THEN 
    freq=potsense
    flag=%1
    endif
    And set the reload calculation routine into the main loop.

    Results : it's more stable, but the glitches still appears when I change the frequency of the sine (so the reload calculation routine is executed during this time).

    I'm pretty sure that the problem is caused by DIV32. However this routine is needed :

    dum=dum1*dum2
    reload=DIV32 freq
    reload=(65535-reload)+8
    How to replace the "DIV32" by an another thing? It is possible to use that : http://melabs.com/resources/fp.htm ? Or anything else?
    Last edited by pxidr84; - 13th May 2011 at 17:28.

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