16F690 HWPM - outputting PWM on a different HPWM port/pin - brainache!


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default 16F690 HWPM - outputting PWM on a different HPWM port/pin - brainache!

    Now I'm sure this ought to be simple, but I'm getting unfeasibly confsued wrt register settings on the 16F690 ECCP module.

    Firstly I've got HPWM working with my 16F690 (& got the right PICBasic command too!).

    This seem to do the job...

    Code:
    CCP1CON    = %00001100 'Select PWM Mode
    CCPR1L     = 0
    PR2        = 255
    
    
    HPWM 1,350,20000
    The thing is, because of easier (intended) PCB track layout, I'd much rather the HPWM came out of Pin 7 (vs the default pin 5 from that code above), my problem is associated with the CCP1CONN register explanation on p129 of the datasheet...

    http://ww1.microchip.com/downloads/e...Doc/41262E.pdf

    ...it's not clear to me how to actually select P1C (PIN 7) as the pin for the HPWM stream to output on - Is it even possible to have the PWM stream come out of P1C in single output?

    Any help greatfully received!

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    One of the problems with using hardware is you can not change things around.
    For a single PWM output you are stuck with P1A being modulated.
    Maybe you could set it up as a half or full bridge and not use P1a but I do not know what problems that will cause.

    I will bet a jumper on the PCB will be easier to deal with
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    If you don't really need 20Khz, you might be able to use -

    http://www.pbpgroup.com/modules/wfse...hp?articleid=6
    Charles Linquist

  4. #4
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Thanks guys ...hey ho, looks like I'm stuck with Pin 5 then - sheesh, hardware schmardware (I do need 20Khz - but that a useful 'solution' to tuck away though)

  5. #5


    Did you find this post helpful? Yes | No

    Default HPWM limited to 255, how do you get 350?

    You show a command HPWM 1,350,20000 which implies you have 9 or 10 bit HPWM.

    Is the 350 a typo or have you got something special in your HPWM command?

    Cheers
    Brian

  6. #6
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BrianT View Post
    You show a command HPWM 1,350,20000 which implies you have 9 or 10 bit HPWM.

    Is the 350 a typo or have you got something special in your HPWM command?

    Cheers
    Brian
    Hi Brian,

    Good spot - it was a typo - I didn't cut/paste from my program buy I just hastily typed it in to the post. (as it goes, I use 10 bit PWM, which might account for me getting carried away with the numbers for the duty cycle!)

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