Multiple PWM and port C


Results 1 to 24 of 24

Threaded View

  1. #8
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Multiple PWM and port C

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    Took a quick look at the code you PM'd me and found this:
    Code:
    'If light=1 then                         ' If the variable is 1 then output full PWM to lights
    '    hpwm 1,255,200        
    '    hpwm 2,255,200
    'endif
    'If light=0 then                       ' If the variable is low then set value to 0 an turn off the lights
    '    hpwm 1,0,200        
    '    hpwm 2,0,200    
    'endif
    If this is where you're trying to set 100% dutycycle but ends up with a "jumpy" signal not at 100% then the problem is most likely that you're trying a frequency (200Hz) far below the specified minimum. If you look at the manual you'll see that for a 18F device running at 20MHz the minimum frequency is 1221Hz.

    The only other place in the code where HPWM was used had a frequency of 5kHz so that should've worked - did it?

    /Henrik.
    Hi,

    That section had been commented out from when I was using the hardware modules. It was intended as a manual over-ride so that I could turn the lights on or off via the push of a button. I never ran the module at high frequencies as the LED driver requires a PWM frequency of 100 hz - 1khz and at 1 Khz they resonated with a high pitched sound.

    The original code had
    Code:
    '*******************************************************************************
    'Send pulses to drivers
    
        hpwm 1,W_PWM,200        
        hpwm 2,B_PWM,200
        
    '*******************************************************************************
    Where W_PWM and B_PWM increased from 0 to 255 or decreased from 255 to 0 to fade the LEDs up and down
    Last edited by Scampy; - 11th December 2013 at 18:01.

Similar Threads

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