Newbee Hardware PWM clarification needed


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2006
    Posts
    35

    Default Newbee Hardware PWM clarification needed

    I found this code in the forums . And will be a good beginning for my project. What do I need to be able to compile it in PICBASIC without so many errors? A 16f877 at 4 Mhz

    Begin:

    PVAL = 1000 ' Start with 1kHz
    For Duty = 64 to 250
    HPWM 1,Duty,PVAL
    PAUSE 100
    NEXT Duty

    Duty = 127 ' 50% Duty-cycle
    For PVAL = 1000 to 10000 step 100 ' Increments of 100. Change as needed
    HPWM 1,Duty,PVAL
    PAUSE 100
    Next PVAL

    GOTO Begin

    END

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


    Did you find this post helpful? Yes | No

    Default

    regular PBC or PBP (pro)?

    If you didn't define the variables or you're using PBC, i don't see the error source

    PBC don't have the HPWM statement, you'll need to POKE the PIC registers as per the PIC datasheet.
    Steve

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

  3. #3
    Join Date
    Jun 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    So it would work with PBP? I have the demo and it comes up with a bunch of syntax and bad expression errors Thanks Emmett

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


    Did you find this post helpful? Yes | No

    Default

    Ok i try again..

    If you didn't define the variables ... i don't see the error source

    X Var BYte
    tada var word

    etc
    etc
    Steve

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

Similar Threads

  1. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  2. Hardware PWM Question?
    By jhorsburgh in forum General
    Replies: 1
    Last Post: - 18th August 2008, 03:07
  3. Inverting the o/p of hardware PWM
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 7th August 2008, 19:36
  4. PWM: Vernacular/Function (Newbee)
    By TerryN in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd July 2008, 16:58
  5. Help needed - MOSFET driven by PWM
    By bcd in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 2nd April 2008, 05:02

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