PWM - Dutycycle affecting frequency?


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Post

    Heuuuu, ReuTeuFeuMeu ....

    [ PBP (by default) adds a ClearWDT instruction before every PBP instruction ]

    That's really new, skimask ... 2.48 release ???

    Worse than "ON INTERRUPT" ... if I understand.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Heuuuu, ReuTeuFeuMeu ....
    [ PBP (by default) adds a ClearWDT instruction before every PBP instruction ]
    That's really new, skimask ... 2.48 release ???
    Worse than "ON INTERRUPT" ... if I understand.
    Alain
    Check any .lst file, you'll see it. And it's explained (it's a bit vague, have to read between the lines a bit) under the CLEARWDT command.

    Compile a program, see how many bytes it takes up...
    Then add the 'DEFINE NO_CLRWDT 1', see how many fewer bytes it takes up.

    Incidentally, I didn't RTFM before I found this out awhile back. I was actually RTF.lst file and wondering what all those extra instructions were for Then I RTFM'd and found the info and confirmed that info with a quick search here on 'CLEARWDT'.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi,Skimask

    When Compiling a project, I Always have the MPLAB Program window under the eyes ... and can see how much CLRWDT are really added in the HEX ...

    Reading the manual, you'll find "automatically inserted at appropriate places" ... which is RIGHT !!!

    Just have a look to it to be convinced

    Alain

    OK for the DEFINE ... stops inserting CLRWDT.

    I sometimes use it if too close from the prog space limit ... to get some room.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Reading the manual, you'll find "automatically inserted at appropriate places" ... which is RIGHT !!!
    I'm still searching for what I was talking about. I KNOW I read somewhere awhile back that PBP was inserting the CLEARWDT before each PBP command (not PIC instruction) starting with one of the newer versions. It used to be after the command in the older versions, and it used to be not nearly as often as needed. Back when I first got PBP 2.3.something, the WDT would kick out once in awhile, and the .lst file showed CLEARWDT almost at random places, really didn't correspond well with how much time a specific sequence of instructions would use or anything.
    At any rate, yes, 'automatically inserted at appropriate places'...in which the appropriate place would be before an instruction vs. after it.

    Regardless, the faster you run thru the PWM routine posted earlier, with the smaller duty cycles, the greater the percentage of CLEARWDT instructions executed per unit time.

    Although I don't know in this case if those 'extra' CLEARWDT instructions would account for the 2x difference in frequency. Hardware/Interrupt driven PWM is still the way to go.

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


    Did you find this post helpful? Yes | No

    Default

    Sorry to interrupt, but i wonder why using pwm while the PIC have a CCP?

    And... Does this thread remind something familiar ?
    http://www.picbasic.co.uk/forum/show...highlight=duty
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default What is it about: knowledge ...and money!

    You're right Steeve,

    I could, I should and I actually use the CCP module of my 12F683.

    But not all "small" PICs have this option so I want to make sure I can get the same result in both cases (HPWM & PWM).

    The other aspect of the problem is costs related. For your information, the PIC's prices in Switzerland are "slightly" different as those I can see in MICROCHIP's website or on components suppliers out of my country. Where a 12F683 costs $ 0,87 in USA, I will pay CHF 5,49 ($ 4,47)!!!

    So, even for fun, I don't like to throw money out of my window
    Roger

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Red face a scope problem !!!

    Hi,Flotul

    Did you read what Melabs tell about PWM wave shape at $ 5.51 ??? ( First of all ... I thought you talked about Hpwm !!! ( RTFQuestion for me ...).

    I think your scope gave you the Low. Freq. ENVELOPE ot the signal ... may be ( surely ...) you should have a different picture on an analog scope !!!

    Digital scopes are fine ... yes, but with a comfortable sampling frequency !!!

    ~ 200 Euros ( 180 with your 20% "discount" ... ) scopes have their limits ... you just found some ...


    You won't have a neat wave shape with PWM ... Never. Try to borrow a 50 or 100 Mhz analog scope ... to see what PWM looks like.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default LeCroy = Jumbo Jet 747...

    You might be right: my cheap oscillo has its limits.

    I can grab a LeCroy at the office but to me, its like a "Jumbo Jet 747" (must have at least 30 contextual buttons on the front pannel and a 3 kilos user manual...).

    But maybe I'll try this anyway.

    Nothing is impossible...
    Roger

Similar Threads

  1. SLA battery charging with PWM but which frequency
    By showtime in forum mel PIC BASIC Pro
    Replies: 31
    Last Post: - 13th June 2017, 11:41
  2. Low freq PWM problem
    By ultiblade in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 17th February 2010, 07:09
  3. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  4. PWM 'channels ...what's that all about then!
    By HankMcSpank in forum General
    Replies: 5
    Last Post: - 23rd April 2009, 16:49
  5. Adjusting PWM frequency
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 14th March 2008, 18:12

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