Shop OBEX P1 Docs P2 Docs Learn Events
PWM sinewave generation — Parallax Forums

PWM sinewave generation

Robert SchadeRobert Schade Posts: 27
edited 2010-10-06 02:27 in Propeller 1
I've written some pasm that allows me to control the amplitude of a 1KHz sinewave generated by the prop.

Unfortunately the pwm signal generated uses the DUTY mode of a counter and that means 40MHz which is not feasible for a power mosfet.

Question: Is there a way to implement a prescaler or something of that nature to make the pwm operate in the 100KHz to 150KHz range????

Rob

Comments

  • bill190bill190 Posts: 769
    edited 2010-10-01 08:49
    The following is a handy document on this. See NCO mode...

    AN001 - Propeller Counters...
    http://www.parallax.com/Portals/0/Downloads/appnt/prop/AN001-PropellerCountersv1.1.zip
  • TubularTubular Posts: 4,717
    edited 2010-10-01 13:13
    Also this one from Drone using an external resistor network:-
    http://forums.parallax.com/showthread.php?t=121470
  • Robert SchadeRobert Schade Posts: 27
    edited 2010-10-01 13:40
    Thanks Bill

    I've already got that doc. I've probably missed something in there but not sure how it will help.

    The whole point of the prop program is to make a variac replacement. The mains suppply is rectified and then I want to pwm the dc into a psuedo sinewave to feed through a transformer. The sinewave's amplitude will be controlled so that the heat dissipation will be minimized in the linear regulator on the secondary side of the transformer.

    The duty mode of the counters is great for fine control of the amplitude and gives a very good pseudo sinewave, I just need to reduce the frequency the pwm operates at, but how????
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-10-01 15:02
    You can't reduce the DUTY mode frequency. The OBEX has some PWM objects that you can use to get the slower rate you're after.

    -Phil
  • Robert SchadeRobert Schade Posts: 27
    edited 2010-10-06 02:27
    I've modified one of the objects from the exchange and am getting a reasonable sine wave of 830HZ and a PWM frequency of 20KHz.

    I can adjust the amplitude over the full range via a serial link which will end up being rs485 in the finished unit.

    The sine value is output every 15 degrees so quite fine with acceptable distortion.

    Thanks for all the help guys.
Sign In or Register to comment.