• AVR Freaks

Hot!Timer0 as counter

Author
binaryme
New Member
  • Total Posts : 15
  • Reward points : 0
  • Joined: 2019/10/21 04:07:43
  • Location: 0
  • Status: offline
2019/11/08 06:43:05 (permalink)
0

Timer0 as counter

Hi everyone
Timer0 is clocked ext on RA4 and RA4 is a Schmitt Trigger all the other PORTA pins is TTL.
Timer0 can count pulses up to 50Mhz.
Where in the datasheet is the speed specified that RA4 will no longer be able to count?
Thanks in advance.
#1

13 Replies Related Threads

    1and0
    Access is Denied
    • Total Posts : 10190
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Timer0 as counter 2019/11/08 06:48:00 (permalink)
    +1 (1)
    binaryme
    Timer0 is clocked ext on RA4 and RA4 is a Schmitt Trigger all the other PORTA pins is TTL.
    Timer0 can count pulses up to 50Mhz.
    Where in the datasheet is the speed specified that RA4 will no longer be able to count?

    The "Electrical Characteristics" chapter of your PIC datasheet.
    #2
    du00000001
    Just Some Member
    • Total Posts : 3310
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: online
    Re: Timer0 as counter 2019/11/08 15:40:09 (permalink)
    +1 (1)
    Which PIC?

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #3
    binaryme
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2019/10/21 04:07:43
    • Location: 0
    • Status: offline
    Re: Timer0 as counter 2019/11/15 02:15:13 (permalink)
    0
    Sorry for no PIC info.
    16F876A Datasheet DS39582B
    18f252  Datasheet DS39564C
     
    I have been searching these datasheets ,found lots of timing info.
    But cannot find anything on the MAX external clock speed of TMR0 or TMR1.
    What datasheet what page?
     
    Thanks.
    #4
    du00000001
    Just Some Member
    • Total Posts : 3310
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: online
    Re: Timer0 as counter 2019/11/15 02:49:08 (permalink)
    0
    PIC16F876A:  expect Fosc/6, maybe Fosc/5 (not quite sure about the latter). DS chapter 5.2
     
    PIC18F252: DS table 22-8, although I wouldn't be on the parameter #42 (expecting Tcy + 20).
     
    Why couldn't YOU find these?

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #5
    binaryme
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2019/10/21 04:07:43
    • Location: 0
    • Status: offline
    Re: Timer0 as counter 2019/11/15 03:43:54 (permalink)
    0
    I was looking for +- 50Mhz or 0.02nS clock speed.
    Not Tcy +20.
    TMR0 as a Counter clocked external is independant of crystal osc freq.
     
    #6
    JPortici
    Super Member
    • Total Posts : 873
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Timer0 as counter 2019/11/15 04:06:22 (permalink)
    0
    Rephrasing what du's already told you.
     
    Look at the schematic diagram for Timer 0.
    In the PIC16F876A you can see that the external clock is still syncronized to the device clock. So, it's not really independent.
    Timer 1 instead can bypass the syncronization and be clocked from RC0 but can't go to 50MHz either. Table 17-6
     
    In the PIC18F252, figure that out
    #7
    binaryme
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2019/10/21 04:07:43
    • Location: 0
    • Status: offline
    Re: Timer0 as counter 2019/11/15 04:17:13 (permalink)
    0
    Thanks .
    What about TMR0 for 50Mhz,there is lots of 50Mhz freq counters on the internet for 16F628 and 16f877?
    I also build a sample I found many years back and its working fine for the 16F628.
    Just curious about the max counting if TMR0 can do +-50Mhz will TMR1 also do that? 
    At work now not easy to check all your info and replies,but I will check all this out later.  
     
    #8
    du00000001
    Just Some Member
    • Total Posts : 3310
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: online
    Re: Timer0 as counter 2019/11/15 04:55:22 (permalink)
    +1 (1)
    @binaryme
    50 MHz equals 20 ns, not 0.02 ns.
    Anyway: on the '252 the T0CKI does work up to 50 MHz, but only when using the prescaler with a high-enough divider.
    The counters for the 16Fs you mention usually employ an external prescaler plus often a level converter, protective circuitry etc. (Most frequencies that high have voltage levels that are not compatible with TTL or CMOS inputs.)
    BTW: You should be able to dig-up schematics for such a counter in the net - no need to reinvent the wheel again and again.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #9
    du00000001
    Just Some Member
    • Total Posts : 3310
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: online
    Re: Timer0 as counter 2019/11/15 04:57:18 (permalink)

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #10
    Mysil
    Super Member
    • Total Posts : 3544
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: Timer0 as counter 2019/11/15 05:05:47 (permalink)
    0
    Hi,
    In some of the newer PIC18F devices, you may get to 50 MHz on Timer 0 if you have a very clean signal
    with equal high and low time,  and use the Prescaler to divide by 4 or higher.
     
        Mysil
    #11
    binaryme
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2019/10/21 04:07:43
    • Location: 0
    • Status: offline
    Re: Timer0 as counter 2019/11/15 06:09:18 (permalink)
    0

    PIC16F628 independant of the crystal ,will work with 4,10,20Mhz crystal.
    I also build build a freq counter with a 16F876A.
    All I want to find out is if TMR1 can also read +-50Mhz and how do I find it in the datasheet.
    Yes to many zero's I counted it wrong 50Mhz is indeed 20nS or 0.02 uS.
     
    Thanks for all the replies.


    #12
    du00000001
    Just Some Member
    • Total Posts : 3310
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: online
    Re: Timer0 as counter 2019/11/15 06:53:55 (permalink)
    0
    @ binaryme
    OK - I've found most of the data about the above counter:
    http://electronics-diy.com/electronic_schematic.php?id=550
     
    Based on PIC16F84 - running at a prescaler value of at least 16.
     
    And by now you should know how to find the T1CKI limits in the datasheet.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #13
    1and0
    Access is Denied
    • Total Posts : 10190
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Timer0 as counter 2019/11/15 09:59:07 (permalink)
    0
    binaryme
    16F876A Datasheet DS39582B
    18f252  Datasheet DS39564C
     
    I have been searching these datasheets ,found lots of timing info.
    But cannot find anything on the MAX external clock speed of TMR0 or TMR1.
    What datasheet what page?
     

    Search the datasheets for "T0CKI High" or "T0CKI Low" and you'll find Parameters 40 and 41, which state minimum pulse widths of 10 ns when using the prescaler. That yields a minimum period of 20 ns; that is, 50 MHz maximum.
     
    binaryme
    What about TMR0 for 50Mhz,there is lots of 50Mhz freq counters on the internet for 16F628 and 16f877?
    I also build a sample I found many years back and its working fine for the 16F628.
    Just curious about the max counting if TMR0 can do +-50Mhz will TMR1 also do that? 

    binaryme
    All I want to find out is if TMR1 can also read +-50Mhz and how do I find it in the datasheet.

    Look at Parameters 45 - 47. ;)
     
    #14
    Jump to:
    © 2020 APG vNext Commercial Version 4.5