Trying to get started w/ HPWM


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156

    Default Trying to get started w/ HPWM

    I have a 18F67J60, and I'm trying to understand how to use the HPWM output on PORTB.3. Because I've not used HPWM before, getting started is very confusing. The datasheet refers to this pin as "ECCP2 Enhanced PWM output, channel A", but the PBP manual is talking about Channel NUMBERS.

    Another concern is that I'm using DT-INTs and using TMR0 and TMR1 already. Is this a problem? Any pointers to get me started in the right direction would sure be appreciated.

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by circuitpro View Post
    I have a 18F67J60, and I'm trying to understand how to use the HPWM output on PORTB.3. Because I've not used HPWM before, getting started is very confusing. The datasheet refers to this pin as "ECCP2 Enhanced PWM output, channel A", but the PBP manual is talking about Channel NUMBERS.
    Your channel numbers are 1, 2, 3, 4, and 5 for ECCP1, ECCP2, ECCP3, CCP4 and CCP5. But none of them are on port B.3. They are a little all over the place on the chip. But ECCP1 is on PortC.2, and ECCP2 is on PortC.1

    Another concern is that I'm using DT-INTs and using TMR0 and TMR1 already. Is this a problem? Any pointers to get me started in the right direction would sure be appreciated.
    Not a problem, you will be ok here because PWM uses Timer 2 or Timer 4
    Last edited by ScaleRobotics; - 19th February 2010 at 07:12.

  3. #3
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    I guess it's time to just get a stand-alone HPWM working on the right port/pins, and then try to integrate it with what I've got already got. Thanks.

  4. #4
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Angry

    Oops. Missed the footnote on PortB.3!

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Hey Circuitpro,

    Yes, the PBP "HPWM" command uses the hardware PWM pins on the chip. These are defined in the datasheet. To use "HPWM", you need to use one of the available HPWM pins.

    You could use the PBP "PWM" command, but this does not work for continuous PWM, only a defined number of cycles.

    Your only option (if you need to get continuous PWM on portb.3) is to use DT Interrupts and make your own pwm on any pin ... but this is a little more complicated. (maybe you could still use the same board if you do this ... not quite sure what your options are with your particular project.)

    Edit: forgot about this option, Darrel has made it easier for everyone. http://darreltaylor.com/DT_INTS-14/SPWM.html
    Last edited by ScaleRobotics; - 19th February 2010 at 19:30.

  6. #6
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by scalerobotics View Post

    Edit: forgot about this option, Darrel has made it easier for everyone. http://darreltaylor.com/DT_INTS-14/SPWM.html
    But this uses Timer1, so I guess you are on the DIY route with interrupts, or DT Interrupts.

Similar Threads

  1. need help on hpwm
    By helmut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th August 2007, 15:49
  2. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 15:05
  3. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  4. HPWM and A to D interaction question 18F252
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 10th May 2006, 03:50
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43

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