Counting Timer0 and Timer1 overflows without any interrupt handler


Results 1 to 33 of 33

Threaded View

  1. #27
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Darrel Taylor View Post
    The prescaler divides by 256, and TMR0 divides by 256.
    So the overflows only happen every 65536 counts.

    With a frequency of 301234, there will only be 4 overflows, with 39090 remaining.
    That's 152 in TMR0, and 178 in the prescaler.

    Another way to look at it is to convert the Frequency to a HEX number
    #301234 = $4:98B2

    Now it's easy to see that there will be 4 overflows, TMR0 will have $98 = 152, and the prescaler has $B2 = 178.

    HTH
    Hello Darrel,

    found your excellent example and i would like to build the same counter based on PIC16F870. From your above post i understand, that with prescaler 256 minimum measured frequency is 65536Hz, otherwise TMR0 will not overflow, or am i wrong? To measure lower frequencies i would have to change the OPTION_REG bits 2-0 , which will set prescaler to 1:2?

    P.S. My target measurement range is 1 HZ - 1 MHz.
    Last edited by Rufinus; - 16th March 2015 at 14:53.

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