HPWM on 16F88


Closed Thread
Results 1 to 8 of 8

Thread: HPWM on 16F88

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: HPWM on 16F88

    Hi Henrik,

    tried your suggestion, didnīt work.
    thought it was already in the defines, but tried that too.

    Any more ideas?

    thanks

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: HPWM on 16F88

    Hi,
    Now I'm a bit confused, it seems like it IS defaulting to PortB.0 and not PortB.3 as I said earlier, so you shouldn't have to change anything. Either way I've tried it here and it works.... I can switch the PWM output between RB0 and RB3 by changing the CONFIG like shown in the previous message.

    However, I don't see you setting the TRIS register anywhere and I don't know if HPWM does that for you, always best to do that your self.

    /Henrik.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: HPWM on 16F88

    If you are using MPASM for the assembler, defines need to be all uppercase.

    Code:
        define CCP1_REG PORTB
        DEFINE CCP1_bit 0
    DT

  4. #4
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: HPWM on 16F88

    Hello Darrel,

    nice you took a look at my childish problem.

    The config files you mentioned were in the upper part of the program
    do I have to put them in the .inc file? Iīm confused.

    And i was so frustrated I wrote code that used Portb.0 as switch
    inside my simple program because I feared the chip was blown but it works.

    it is just: I canīt get portb.0 as HPWM output AND the normal LCDout application at once. The LCD is the reason I canīt switch the port. got the boards already.

    sream, howl, and so on

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: HPWM on 16F88

    Try to set your fuse like this:
    Code:
    @ DEVICE PIC16F88, CCPMX_OFF
    where:
    0 = "ON" CCP1 on RB3
    1 = "OFF" CCP1 on RB0



    You also need to set a register:
    Code:
    CCP1CON = %00001100 'Select PWM Mode
    HTH
    Roger

  6. #6
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Use PWM instead

    Instead of using HPWM, try this:
    Code:
    PWM PORTB.0,speed,1000
    You won't need to declare/define T2CON, CCP1CON, PR2 and CCPR1L.

    PS: I'm using MCS
    Roger

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