Newb timer problems


Closed Thread
Results 1 to 9 of 9

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Thanks DT - yr a genius, the first thing i did worked so didn't try the others. Why did it need that pause for it to work - i would have thought it would have just cycled around in the loop

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by George View Post
    ..., the first thing i did worked so didn't try the others. ...
    Well that's unfortunate.
    Trying the other 2, may have answered your question.

    Why did it need that pause for it to work - i would have thought it would have just cycled around in the loop
    It does "just cycled around in the loop".
    But, there's nothing in there to clear the WatchDogTimer. And without it, the processor will reset every ~18ms.
    Timer0 was set up with 1:256 prescaler, so it would interrupt after 65.536 ms had passed. But it never made it that far.

    PAUSE, automatically clears the WDT every so often, so that caused it to work.

    The second example just clears the WDT by using the ASM statement CLRWDT.

    And the third example turns the WDT OFF so that it doesn't need to be cleared.

    Any one of the three examples should have made it work.
    <br>
    DT

  3. #3
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Red face

    Quote Originally Posted by Darrel Taylor View Post
    Hi George,

    Try this ...
    Code:
    Start:
        PAUSE 1
    goto start
    Or, this ...
    Code:
    Start:
        @ CLRWDT
    goto start
    Or, maybe ...
    Code:
    @ DEVICE PIC16F676, XT_OSC, WDT_OFF, MCLR_OFF, PROTECT_OFF, BOD_ON, CPD_OFF
    <br>
    Quote Originally Posted by George View Post
    Thanks DT - yr a genius, the first thing i did worked so didn't try the others. Why did it need that pause for it to work - i would have thought it would have just cycled around in the loop
    Yes i have the same question:
    Why was that "pause 1" needed for it to work??

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


    Did you find this post helpful? Yes | No

    Default

    Just after I turned the wdt off and got rid of the pause 1 and it worked also, detailed knowlegde certainly helps with these things doesn't it

    Cheers for your help

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  3. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  5. timer interupt help 16f73
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2005, 08:41

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