HPWM issues on 16F88


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171

    Default HPWM issues on 16F88

    I've looked through data sheets, manual and searched the other files on here - but can't make sence of why this isn't working - probably a complete lack of understanding.

    ANy help setting up the chip would be very thankfully recieved - thanks

    Here is the code so far:
    @ DEVICE INTRC_OSC, WDT_OFF, MCLR_OFF
    DEFINE OSC 8
    DEFINE CCP1_REG PORTB 'HPwm 1 pin port
    DEFINE CCP1_BIT 1 'HPwm 1 pin BIT
    TRISA = %00000011 'Set I/O
    TRISB = %00000000 'Set I/O
    CMCON = %00000111 'Disable analog comparators
    ANSEL = %00000001 'Set PORTA.0 analog rest digital
    ADCON1 = %10000000 'Right justify result
    OSCCON = %01110000 'Set internal osc to 8MHz
    speed VAR WORD

    speed = 127

    Start:

    Pause 1000

    Pwr = 1

    GoSub ReadVals

    HPwm 1,speed,2000

    blah blah blah

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Not all frequency offers the same resolution

    Hi there,

    If you need to configure the HPWM manually then this tiny utility may help you.

    You will need the VB runtimes.

    Regards
    Attached Files Attached Files

  3. #3
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171


    Did you find this post helpful? Yes | No

    Default

    Thanks, tho can't seem to make it run - it says "component 'TABCTL32.OCX' or one of it's dependencies not correctly registered: a file is missing or invalid.

    I tried all yesterday different combinations, but still nothing, anyone else got a clue as to what I might be doing wrong? I think I'm slipping up on pin select but not sure

    Thanks
    Last edited by George; - 1st November 2005 at 18:43.

  4. #4
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default What is not working

    Hi there,

    Try changing the speed variable to a BYTE !! Or just hardcode a 127 (50% duty cycle).

    Did you use an oscilloscope to check for the 2KHz?

    Regards
    Sougata

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


    Did you find this post helpful? Yes | No

    Default

    On the PIC16F88, hardware PWM is not on RB1. It can be on RB0 or RB3 depending on how you configure the CCPMX config fuse bit.
    Regards,

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

  6. #6
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171


    Did you find this post helpful? Yes | No

    Default

    Yeah i did use a scope, will try doing it hard tho.

    Bruce, does that mean i go pwm 0,127,2000?

    You said to set it up with the CCPMX register - I'm a bit of a beginner and have no idea how to do that, I did see it in the datasheet - but unfortunatly they rn't datasheets for dummies. I used this as per pbp manual:

    DEFINE CCP1_REG PORTB 'HPwm 1 pin port
    DEFINE CCP1_BIT 1 'HPwm 1 pin BIT

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


    Did you find this post helpful? Yes | No

    Default

    Hi George,

    PBP has default config fuse settings in each device header file. For the 16F88 look in your 16F88.inc file in your PBP directory.

    Each PIC family has a device specific header file that contains these default settings. Looks something like this;

    Code:
    NOLIST
        ifdef PM_USED
            LIST
            include 'M16F88.INC'	; PM header
            device  pic16F88, hs_osc, wdt_on, lvp_off, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 16F88, r = dec, w = -302
            INCLUDE "P16F88.INC"	; MPASM  Header
            __config _CONFIG1, _HS_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
            NOLIST
        endif
            LIST
    If you're using the default PM assembler, the first section is used at compile time to set default config fuse settings. With MPASM, the 2nd.

    Assuming you're using the PM assembler, you can change or over-ride these default settings by adding your own config fuse settings to your code like this;

    @ DEVICE INTRC_OSC, CCPMX_OFF, MCLR_OFF, LVP_OFF, WDT_OFF
    ' CCPMX_ON = PWM ON B.3, CCPMX_OFF = PWM ON B.0
    ' CCPMX is the CCP multiplex config option

    Or simply change them with your programmer software before burning your code into the target.

    There are several threads on config fuse settings here, so I won't go into details rehashing something that's already here, but that should get you started.
    Regards,

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

  8. #8
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Post

    I can understand your frustration with the datasheets George. I did a quick search through the forum and came onto THIS. Hopefully, this thread with the datasheet will help explain it a little better.
    ...oops, looks like Bruce beat me to it.
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

  9. #9
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171


    Did you find this post helpful? Yes | No

    Default

    Great - IT'S ALIVE!!! Thanks so much guys really appreciate the help

  10. #10
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Thanks Bruce

    Dear Bruce,

    Thanks Bruce.

    I should have gone through the datasheet before commenting.

    Regards

    Sougata

Similar Threads

  1. Multiple HPWM question
    By Johan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th October 2007, 13:00
  2. need help on hpwm
    By helmut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th August 2007, 15:49
  3. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 15:05
  4. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  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