16F88 PWM troubles


Closed Thread
Results 1 to 9 of 9
  1. #1
    jpeakall's Avatar
    jpeakall Guest

    Default 16F88 PWM troubles

    Hi All,

    Sorry to bother evryone for such a simple question. I tried to search the archives, but when I entered "16F88+PWM" I was told that "PWM" was too small or too common to be included in the search.

    Anyway, while I have done it before, I can't get the PWM to work on a 16F88. Here is what I am trying:

    @ DEVICE PIC16F88,HS_OSC,MCLR_ON,LVP_OFF,WDT_OFF,PROTECT_OF F
    DEFINE OSC 20
    TRISB = 255
    CMCON = 0
    ADCON0 = 0
    ANSEL = 0
    PR2 = 122
    CCPR1L = 64
    T2CON = %00000100
    CCP1CON = %00001100
    output portb.3
    end

    Any ideas why this isn't working? As far as I remember, this was a working snip.

    Thanks,

    Jonathan

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    jpeakall, you have the port direction register set for all inputs.....

    Dave Purola,
    N8NTA

  3. #3
    jpeakall's Avatar
    jpeakall Guest


    Did you find this post helpful? Yes | No

    Default

    Dave,

    I have tried it the other way, as outputs. I guess that was still in there from me threshing around and trying everything I could think of.

    Thanks, see anything else?

    Jonathan

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    your code will work if you change End by Here: goto Here

    here's the fix
    Code:
    @ __CONFIG _CONFIG1, _CCP1_RB0 & _DEBUG_OFF & _LVP_OFF & _BODEN_ON & _MCLR_ON & _PWRTE_ON & _WDT_ON & _HS_OSC
    DEFINE OSC 20 
    TRISB = 0
    PR2 = 122 
    CCPR1L = 64 
    T2CON = %00000100 
    CCP1CON = %00001100 
    
    here: goto here
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    jpeakall's Avatar
    jpeakall Guest


    Did you find this post helpful? Yes | No

    Default

    Steve,

    Still no joy. Your config line won't compile for me, I am using I think PBP 2.42. I tried using my code with the here: goto here, and still no success.

    Thanks for the help. I am getting frustrated with this. All I want is a lil PWM...

    Jonathan

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    On this device CCP1 is multiplexed with RB0 & RB3. To switch CCP1 you
    use CCPMX in CONFIG1.

    With CCPMX left un-programmed, CCP1 defaults to RB0.

    Try this.
    Code:
    @ DEVICE HS_OSC,CCPMX_ON,MCLR_ON,LVP_OFF,WDT_OFF,PROTECT_OFF
        ' CCPMX_ON = PWM ON RB3, CCPMX_OFF = PWM ON RB0
    DEFINE OSC 20 
    TRISB = 0
    CMCON = 0
    ADCON0 = 0
    ANSEL = 0
    PR2 = 122 
    CCPR1L = 64 
    T2CON = %00000100 
    CCP1CON = %00001100 
    
    Here:
         GOTO Here
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Talking

    Funny ...

    16F88 is not supported by PBP 2.42 ....

    LOL

    Verify your release and upgrade ( 2.46 now ...)

    Alain
    Last edited by Acetronics2; - 12th May 2005 at 16:22.

  8. #8
    jpeakall's Avatar
    jpeakall Guest


    Did you find this post helpful? Yes | No

    Default

    Bruce,

    As always, you da man! Working great now. I beleive that the ADCON0 was the main source of the problem, as I was checking RB0 as well as RB3.

    What fun! I can get to work now instead of pounding my head on the keyboard.

    Ace, I haven't checked, but I must have 2.43 or something, because I can indeed program the 16F88. I am going to get the upgrades from Bruce soon.

    Thanks all!!

    Jonathan

  9. #9
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You had RB0 set as an input. That's why you didn't see your PWM
    signal output on RB0.

    I think you have at least V2.45. That's when support for the 16F88
    was added. I do recommend upgrading to V2.46. The new version
    adds a ton of new devices including the new 18F full-speed USB PICs.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Half-bridge PWM with a 16F684 ?
    By Byte_Butcher in forum General
    Replies: 7
    Last Post: - 17th January 2010, 22:18
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. PWM setting PIC16F887
    By Gevo in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th June 2008, 07:24
  4. 16F88 RA6 and RA7 troubles
    By gandora in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 3rd August 2007, 02:57
  5. Tidying Up PWM Routine
    By Tissy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st February 2005, 00:26

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