Help Choosing the correct PIC for 2 Channel PWM


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Posts
    64

    Default Help Choosing the correct PIC for 2 Channel PWM

    Hi,
    I could use some help choosing the correct PIC. I need to have 2 independent PWM outputs to be used for generating two distinct tones. The only other thing required is to have two input pins to trigger the PWM outputs and a few inputs for dip switches to select the frequencies. I have spare 16f1938, 18F14k22 chips. I would like to keep the pin count as small as possible. The 16f1938 shows 3 ECCP ports, which I thought was all you need, but then it shows 0 for stand alone PWM. The Hardware PWM seems confusing to me once you go over one output so I want to make sure I am at least stating with a micro that can do what I need to do since I don’t really have enough hair left to pull out.
    I am using PicBasic 2.6c

    Thanks,
    Jim

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


    Did you find this post helpful? Yes | No

    Default Re: Help Choosing the correct PIC for 2 Channel PWM

    Hi Jim,
    As far as I can see the 1938 has three ECCP modules (for which HPWM might not work, I don't know for sure) AND two standard CCP (for which the HPWM command "should" work). And in the event you should find that HPWM doesn't work it's not that hard to setup manually - and it gives you more "power", like being able to have more than 8bits of resolution. I'll promise to help you out if you need, just make a post here.

    So, if you already have the 1938 on hand and it's suitable from other perspectives then I'd use that.

    /Henrik.

  3. #3
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Help Choosing the correct PIC for 2 Channel PWM

    Thanks Henrik. I will give it a try and let you know if (When?) I run into problems.

    Jim

    Quote Originally Posted by HenrikOlsson View Post
    Hi Jim,
    As far as I can see the 1938 has three ECCP modules (for which HPWM might not work, I don't know for sure) AND two standard CCP (for which the HPWM command "should" work). And in the event you should find that HPWM doesn't work it's not that hard to setup manually - and it gives you more "power", like being able to have more than 8bits of resolution. I'll promise to help you out if you need, just make a post here.

    So, if you already have the 1938 on hand and it's suitable from other perspectives then I'd use that.

    /Henrik.

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Help Choosing the correct PIC for 2 Channel PWM

    I don't think you will be able to generate 2 distinct tones. From the PBP manual:

    Frequency is the desired frequency of the PWM signal. On devices
    with 2 channels, the Frequency must be the same on both channels.

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,580


    Did you find this post helpful? Yes | No

    Default Re: Help Choosing the correct PIC for 2 Channel PWM

    That's a very valid point, one that I totally missed when reading Jims initial post, sorry about that!

    That limitation comes from the fact that the CCP module(s) are (historically) tied to the same timebase so they need to have the same output frequency. Thankfully things have changed over the years and the CCP modules on the 16F1938 can individually be assigned any of TMR2/TMR4/TMR6 as their timebase. It does however mean that HPWM is out (at least I Think it is) and you'll need to setup the CCP modules manually.

    /Henrik.

  6. #6
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Help Choosing the correct PIC for 2 Channel PWM

    So that means directly writing to the correct ports might do what I want? I didn't start testing yet. I did purchase an LED 3 channel 8-bit PWM driver to try (TLC59731DR). I thought it was SPI, but it isn't, and It also controls duty cycle. There are plenty of external devices available that look like they might work, but I'll wait until after I rule out the 16F1938 as an option.

    Thanks

    Quote Originally Posted by HenrikOlsson View Post
    That's a very valid point, one that I totally missed when reading Jims initial post, sorry about that!

    That limitation comes from the fact that the CCP module(s) are (historically) tied to the same timebase so they need to have the same output frequency. Thankfully things have changed over the years and the CCP modules on the 16F1938 can individually be assigned any of TMR2/TMR4/TMR6 as their timebase. It does however mean that HPWM is out (at least I Think it is) and you'll need to setup the CCP modules manually.

    /Henrik.

Similar Threads

  1. max frequency on pwm channel 16f88
    By queenidog in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st June 2013, 16:47
  2. Replies: 1
    Last Post: - 4th March 2013, 22:57
  3. 3 channel PWM with customize duty cycle
    By photoelectric in forum mel PIC BASIC Pro
    Replies: 56
    Last Post: - 16th May 2011, 14:49
  4. Is this the correct PIC?
    By The Master in forum Off Topic
    Replies: 8
    Last Post: - 6th May 2008, 17:44
  5. Help choosing right PIC
    By Darrenmac in forum General
    Replies: 2
    Last Post: - 13th June 2006, 08:51

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts