PWM on PIC16F88


Closed Thread
Results 1 to 37 of 37

Thread: PWM on PIC16F88

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    DARGH! Maybe not, just read the datasheet and the PM >INC file CCPMX should set ON.
    Quote Originally Posted by 16F88.INC
    CCPMX_ON equ 2FFF0000h ; X0 XXXX XXXX XXXX
    CCPMX_OFF equ 2FFF1000h ; X1 XXXX XXXX XXXX
    in datasheet... you'll find
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=709&stc=1&d=1136747056 ">

    NOW, what about
    Code:
    @ DEVICE MCLR_OFF, INTRC_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_ON, CCPMX_ON
    OSCCON=$60 ' use internal 4MHZ osc
    PAUSE 100 ' start-up delay
    TRISB=0
    DEFINE CCP1_REG PORTB 
    DEFINE CCP1_BIT 3 
    HPWM 1,1000,128
    HERE: GOTO HERE
    Attached Images Attached Images  
    Steve

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

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve but I think Melanie is right - time for a lot of beer. Followed your code exactly and the PWM still comes out on RB0. Do you have any other ideas I can try when I get sober?

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


    Did you find this post helpful? Yes | No

    Default

    i'll check that later tonight with my own stuff.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    well i just tried that one...
    Code:
    @ DEVICE MCLR_ON, INTRC_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF, CCPMX_ON
    OSCCON=$60 ' use internal 4MHZ osc
    PAUSE 100 ' start-up delay
    TRISB=0
    DEFINE CCP1_REG PORTB 
    DEFINE CCP1_BIT 3 
    HPWM 1,128,1000
    HERE: GOTO HERE
    no big difference on the previous,just correcting the way i wrote HPWM, enable the MCLR and remove CodeProtect... it's working on RB3 as it's suppose to.

    BTW i'd attach the .HEX file to dump on your PIC. Let's assume that it could be a compiler problem... maybe.

    let us know.

    PS just rename .txt to .hex
    Attached Files Attached Files
    Steve

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

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Hi Steve. I copied your code exactly and it still outputs only on RB0. I suspect my programmer and/or software is the problem. There is an option "CCP1 on RB3" that works on the 16F818 but the option is "grayed out" when I program the 16F88. I guess it will not allow the use of RB3. I think it's time to get the latest hardware/software from Microchip. Thank you for your help.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    That was it. My software was forcing CCP1 onto RB0, while MPLAB software shows "CCP1 ON RB3". Thanks Everybody.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    peterdeco1,

    What programmer software and hardware are you using that causes the problem? We would all like to know. We want to avoid running in to the same difficulties.
    Last edited by Dick Ivers; - 21st January 2006 at 20:28.

Similar Threads

  1. Half-bridge PWM with a 16F684 ?
    By Byte_Butcher in forum General
    Replies: 7
    Last Post: - 17th January 2010, 23:18
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 07:03
  3. PWM setting PIC16F887
    By Gevo in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th June 2008, 08:24
  4. Replies: 8
    Last Post: - 7th December 2006, 16:42
  5. Tidying Up PWM Routine
    By Tissy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st February 2005, 01: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