Increase timer resolution

Discussion in 'Embedded Systems and Microcontrollers' started by samjesse, May 8, 2014.

  1. samjesse

    Thread Starter Active Member

    Sep 14, 2008
    202
    0
    Hi
    With AVR uC, if timer's prescaler trades resolution for duration.
    What way is used to trade duration for resolution much higher above the frequency of the uC?
    I am imaging running more than one timer in an off-sync.

    Many Thx
     
  2. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    There's no easy way, because the timer is driven from the micro's oscillator.

    What are you timing?

    The best/easiest method is just to time multiple contiguous events, the resolution scales up with the number of events tested.

    My high resolution capacitance meter project here;
    http://www.romanblack.com/onesec/CapMeter.htm
    increases the resolution by timing multiple contiguous periods until the total timer count is > 2 million. So the recorded period resolution is as low as 0.5 parts per million.

    Basically it's a high resolution timer that times the periods of a capacitor oscillator.
     
  3. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    The best way is to combine the longest possible hardware timer with an appropriate number of software words to produce a high resolution long count timer.
     
  4. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Hi Papabravo, how does that give a greater resolution than the native timer count frequency?

    From my understanding you need to either increaase the timer count frequency and/or time multiple contiguous periods.
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    It doesn't. I only meant to suggest that, to time reasonable length intervals with the best resolution available in the hardware you need to extend the length of the hardware timer with software.
     
  6. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
    You can use a higher speed external oscillator with an external counter IC.

    74FCT191 can handle a 100Mhz clock. Use that as an external prescale counter.

    If you can freeze the count then you can capture the value of those 4 bits and you can append them to the internal counter to define an 16x higher resolution.

    But it is much simpler to go with some MCU that uses a fast clock and 32 bit counters.

    PIC32

    ARM

    Many choices.
     
    Last edited: May 14, 2014
  7. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    My apologies Papabravo, it was a misunderstanding of your word use. :)

    To me, to "time" an interval referred only to measuring its time with the micro. I missed the point you were making about generating a timer interval and assumed the OP wanted to measure time periods, not generate them.
     
Loading...