Multiple PWM pins


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Multiple PWM pins

    Hi,
    The 4520 has 2 CCP modules so you can get two PWM-outputs, ie two PWM-signals with the same frequency but different dutycycle. The reference to "one, two or four outputs" probably refers to using the ECCP module in half or full bridge mode. Then the PWM signal "comes out" on multiple pins but it's still "the same" signal - basically.

    The 2331 also has 2 CCP modules plus the PCPWM-module with 3 PWM generators (the 4331 has 4) so all in all, using the 2331, you can get 5 PWM outputs. Note that the HPWM command does not work for PCPWM module in the 2331, you'll have to configure it "manually".

    If you don't need the extended features of the PCPWM module (which, by the sound of it you don't) then perhaps something like the 25K22 might work, it's a lot cheaper then the 2331. There are loads and loads of 18F series parts with 3 or more (E)CCP modules. I'm not entirely sure if the HPWM command supports more than 2 channels though but it's easy enough to configure the registers manually.

    /Henrik.

  2. #2
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Multiple PWM pins

    Quote Originally Posted by HenrikOlsson View Post
    There are loads and loads of 18F series parts with 3 or more (E)CCP modules. I'm not entirely sure if the HPWM command supports more than 2 channels though but it's easy enough to configure the registers manually.

    /Henrik.
    After doing hours of googling, I stumbled across this post on a forum http://www.sonsivri.to/forum/index.php?topic=24131.0

    Looking through his sample code it has

    Code:
    'PIC16F767 Device Controlling Red/White/Blue LED's
    'Written July 2, 2009
    'Copyright (c) PilotPTK
    'U1 Main LED Driver
    
    
    DEFINE OSC 20
    ADCON1 = %10001101	'Port A0,A1 Analog, VREF+ = VDD, Right Justified Result
    CCP1CON = %00001100	'CCP Setup (PWM Mode)
    CCP2CON = %00001100	'CCP Setup (PWM Mode)
    CCP3CON = %00001100	'CCP Setup (PWM Mode)
    And then later down

    Code:
    HPWM 1,0,5000
    HPWM 2,0,5000
    HPWM 3,0,5000
    So on that basis I would assume PBP's HPWM command support more than two channels.... so now to look for a chip that's 5v (as 3.3v is not supported on my development board) and has four ECCP modules, and then see if I can port the working code on the 18f4520 to it

Similar Threads

  1. Replies: 11
    Last Post: - 29th December 2010, 12:24
  2. Multiple Variables - Pins
    By GatorGuy in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st February 2010, 02:08
  3. Aliasing multiple pins
    By eshatara in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 25th April 2009, 15:53
  4. Drive multiple LED with one PWM
    By microuser in forum General
    Replies: 3
    Last Post: - 27th September 2007, 14:26
  5. using all pins of pwm in pic 18f2431
    By jorgequesada in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th May 2007, 22:43

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