Counting Timer0 and Timer1 overflows without any interrupt handler


Closed Thread
Results 1 to 33 of 33

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Counting Timer0 and Timer1 overflows without any interrupt handler

    Thanks Darrel,
    I didn't see the prescaler settings in setup code.
    I see "PSA [OPTION_REG.3] set to 0 which sets the prescaller from the WDT to Timer0
    But I don't see any settings for OPTION_REG.0, 1 and 2.
    Are they there in the code and I missed them?
    Thanks!!
    Duane

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


    Did you find this post helpful? Yes | No

    Default Re: Counting Timer0 and Timer1 overflows without any interrupt handler

    On power-up, the default value of OPTION_REG is %11111111.
    Which means the prescaler is already set to 1:256.
    There is no need to set it again in the code.

    Name:  Option_Reg_Defaults.gif
Views: 6875
Size:  14.0 KB
    DT

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


    Did you find this post helpful? Yes | No

    Default Re: Counting Timer0 and Timer1 overflows without any interrupt handler

    Hi Duane,
    If you look up OPTION_REG in the datasheet, you'll find that it defaults to "all ones", $FF, 255 whichever way you want to look at it.
    This means that the prescaler ratio, when assigned to TMR0 defaults to 1:256 - so no need to change it.

    /Henrik.

    EDIT: Damn, you're fast today Darrel!

  4. #4
    Join Date
    Jan 2007
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Counting Timer0 and Timer1 overflows without any interrupt handler

    Sweet!!
    Thanks!
    I had a suspicion that was the case, but I have an old habit of wanting to make sure in the code.
    This gives the old dog a new trick!! :-]

Similar Threads

  1. Expanding Timer1 counting range
    By sycluap in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 3rd February 2014, 22:00
  2. PIC18 timer0 interrupt handler, still not getting it
    By ImAnEE in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th April 2011, 00:25
  3. DT-INTs Interrupt handler question
    By circuitpro in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th January 2010, 00:06
  4. Synchronising Timer0 and Timer1
    By manxman in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 9th April 2008, 23:12
  5. 16F690 TIMER0 and TIMER1
    By nickdaprick in forum mel PIC BASIC
    Replies: 2
    Last Post: - 18th April 2007, 14:49

Members who have read this thread : 2

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