Shop OBEX P1 Docs P2 Docs Learn Events
Frequency counter different approach idea — Parallax Forums

Frequency counter different approach idea

VinnieVinnie Posts: 15
edited 2006-08-04 00:16 in General Discussion
OK, as there is no such thing as a stupid question:

I was thinking about building a frequency counter with an sx·when I was struck by a different approach; don't know if it might work, but maybe some smart fellas here can comment..

traditionally one would use a high clock generator·and generate an interrupt with the signal to be measured..·(at least, thats what I think happens).. the only example I found counts up to 15mhz so I assume the interrupt routine than needs 5 clockcycles - what seems plausible

Now I was thinking out of the box:

What if we use the frequency to be counted as the clock input and a 4 Mhz crystal oscilator (or other)·as an interrupt generator.. and an algorithm that calculates the input clock based on the number of interrupts that have occured over a certain period of 'time' (time being relative to the input clock)?

Then we could count up to 75Mhz! Accuracy would off course be limited to a function of the input clock and the interrupt clock,·but still quite a performance!!!!

Theoretically it seems this could work..

any thoughts?

greetings,
Vinnie

Comments

  • pjvpjv Posts: 1,903
    edited 2006-08-02 21:36
    Hi Vinnie;

    Sure, its done all the time.

    For low frequencies the input signal (or several input cycles) is the "gate" for counting a clock, and that is inversed by a division to get frequency.

    For high frequencies the input cycles are counted for a specified period of time (the "gate"), and then (probably) scaled to get the range right.

    The point of switching from one mode to the other is up to the designer. Usually it is selected to give the optimum resolution.

    However, with an SX running at 100 MHz, the fastest input you can follow is half that speed; 50 Mhz, and that's a bit of a stretch. Still, if you settled on half of that as practical.....·not shabby.

    Cheers,

    Peter (pjv)

    Post Edited (pjv) : 8/2/2006 9:40:44 PM GMT
  • Clock LoopClock Loop Posts: 2,069
    edited 2006-08-04 00:16
    Like pjv said,

    At the max sx frequency of 75mhz, using the Nyquist–Shannon sampling theorem, you can only sample a max frequency of 75 / 2 = 37.5 mhz.

    http://en.wikipedia.org/wiki/Nyquist-Shannon_sampling_theorem

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Meh. Nothing here, move along.
Sign In or Register to comment.