Multiple PWM and port C


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Multiple PWM and port C

    I've recorded the wave form when using the hardware PWM modules on the chip to explain the issue I'm getting.



    If you compare this to using the multi_swpm file and port D you notice there are loads of spikes in the HWPM signal and some harmonics ? - the amplitude is also a lot less (I had to increase the volume for the HWPM to get a similar trace)


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


    Did you find this post helpful? Yes | No

    Default Re: Multiple PWM and port C

    As I've said a couple of times now:
    You can not run the hardware PWM at a frequency below 1221Hz - it's not a bug in PBP and not a hardware issue with the PIC or the circuit, it's just the way it is.

    The reason is because TMR2, which is used for the PWM timebase is 8 bits wide and has a prescaler with a maximum ratio of 1:16. At 20MHz the timer ticks at 5MHz, so 5,000,000/256/16=1220.7Hz. If you try anything lower than that it will not work properly and I'm pretty sure that's what you're seeing when trying to run it at 200Hz.

    To prove or disprove, try it again at 1500Hz and see if the waveform looks better. I understand that it won't work in your particular application due to the LED drivers but it'll show that actual problem is that you're trying to run the PWM at a frequency (200Hz) which the module is incapable of producing.

    /Henrik.

Similar Threads

  1. Multiple PWM pins
    By Scampy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th November 2013, 19:23
  2. Darrel's Multiple Software PWM
    By passion1 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 15th October 2013, 15:21
  3. Drive multiple LED with one PWM
    By microuser in forum General
    Replies: 3
    Last Post: - 27th September 2007, 13:26
  4. Multiple Pics to One serial port
    By Rleonard in forum Serial
    Replies: 1
    Last Post: - 18th January 2007, 18:30
  5. Multiple IR LEDs from 1 port using transistor
    By belpe123 in forum General
    Replies: 3
    Last Post: - 20th May 2005, 22:07

Members who have read this thread : 1

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