HPWM statement problems with 18F45K20


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2013
    Posts
    1,123

    Default HPWM statement problems with 18F45K20

    According to datasheet, 18F45K20 has up to 5 CCP/PWM modules, which itself have 4 PWM ports and can be configured independently.

    However, Picbasic pro has problem with them - none of them works, and in code like below, you can write ANY port number - no errors will be given.

    Code:
    hpwm 1,100,1000
    hpwm 2,100,1000
    hpwm 3,100,1000
    hpwm 99,100,1000
    What is the problem?

  2. #2
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: HPWM statement problems with 18F45K20

    In your defines you have to state what pin PWM 1 is (as well as 2, 3, 99, etc.; page 148 of the Manual). It looks like this:

    DEFINE CCP1_REG PORTC
    DEFINE CCP1_BIT 2
    DEFINE CCP2_REG PORTC
    DEFINE CCP2_BIT 1

    Hope this helps.

  3. #3
    Join Date
    Feb 2013
    Posts
    1,123


    Did you find this post helpful? Yes | No

    Default Re: HPWM statement problems with 18F45K20

    I meant a slightly different thing.

    Say I have 16F870. No specific DEFINE's added.

    Since this chip has 1 hpwm channel only, hpwm 1,100,1000 works. But if I type hpwm 4,100,1000, compiler will give error, since there's no such hardware port. In case of 18F45K20, compiler absolutely does not cares, what port address you enter in hpwm statement. This is the problem.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: HPWM statement problems with 18F45K20

    Does 16F870 have PWM enabled by default?

    What about 18F45K20?

    I make it a habit not to assume and set feature registers as required.

    Robert

  5. #5
    Join Date
    Feb 2013
    Posts
    1,123


    Did you find this post helpful? Yes | No

    Default Re: HPWM statement problems with 18F45K20

    According to manual, HPWM statement does all required configs by itself.

    Here not problem in HPWM not working, here problem is compiler passing any garbage to hpwm statement without error.

Similar Threads

  1. Configuration bits 18F45K20
    By robertg in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th September 2013, 08:31
  2. Replies: 3
    Last Post: - 23rd October 2011, 12:53
  3. Blink.Bas on 18f45k20 Newbie seeks working example.
    By DiscoEd in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th December 2009, 03:36
  4. 16F883 and Problems with HIGH statement
    By aaanekre in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th October 2009, 01:09
  5. HPWM problems
    By Samoele in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th November 2006, 07:23

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