Shop OBEX P1 Docs P2 Docs Learn Events
40 MHz frequency counter w/ 1/10000 part resolution — Parallax Forums

40 MHz frequency counter w/ 1/10000 part resolution

ArchiverArchiver Posts: 46,084
edited 2002-04-09 07:04 in General Discussion
I am looking for a clever way to use the Stamp as a frequency counter
with a maximum input frequency of 40 MHz. Obviously, the stamp cant
directly count this frequency, particularly to the resolution i need.
I would like to avoid building an off-board frequency counter that
interfaces to the Stamp,if i can help it, although a series of
prescalars would be acceptable if you can point me in the right
direction for jitter stability.
The straight forward way to do this is to prescale the 40MHZ by say
1,000,000 so that i get a 40 Hz signal, measure the period using
Pulsein, and since the fastest Stamp has a 0.75uS resolution i would
have 1/40 => 25mS/0.75uS => 1 part in 33,333 resolution. Great in
theory but dividing down by 1,000,000 with all the delay, jitter, etc.
scares me into believing that 1 part in 33K resolution is a pipe
dream.
Any suggestions?, surely someone has tackled this problem before??
Feel free to email me directly or respond in the group.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-04-08 19:13
    At 05:46 PM 4/8/02 +0000, you wrote:
    >I am looking for a clever way to use the Stamp as a frequency counter
    >with a maximum input frequency of 40 MHz. Obviously, the stamp cant
    >directly count this frequency, particularly to the resolution i need.
    >I would like to avoid building an off-board frequency counter that
    >interfaces to the Stamp,if i can help it, although a series of
    >prescalars would be acceptable if you can point me in the right
    >direction for jitter stability.
    >The straight forward way to do this is to prescale the 40MHZ by say
    >1,000,000 so that i get a 40 Hz signal, measure the period using
    >Pulsein, and since the fastest Stamp has a 0.75uS resolution i would
    >have 1/40 => 25mS/0.75uS => 1 part in 33,333 resolution. Great in
    >theory but dividing down by 1,000,000 with all the delay, jitter, etc.
    >scares me into believing that 1 part in 33K resolution is a pipe
    >dream.
    >Any suggestions?, surely someone has tackled this problem before??
    >Feel free to email me directly or respond in the group.
    >

    You could design a BFO (Beat Frequency Oscillator) around 40MHz but that
    could get nasty if your input frequency has a wide frequency range.
    Beau Schwabe Mask Designer IV - ATL
    National Semiconductor Enterprise Networking Business Unit
    500 Pinnacle Court, Suite 525 Wired Communications Division
    Mail Stop GA1 Norcross, GA 30071
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-09 07:04
    I don't see how jitter stability would be an issue. The output
    period should be very stable. Prescalers do not introduce jitter.
    If the input frequency is stable, there would be only a 1 bit bobble
    in the output count from PULSIN.

    The maximum period for a PULSIN command on a BS2p is 49.125
    milliseconds, so your minimum allowable frequency with the /1M
    divider would be about 20 megahertz. You have to calculate the
    reciprocal of period to get back to frequency.

    Another approach is to COUNT the frequency, and the math is easier.
    The BS2 and BS2e can count frequencies up to 120 kilohertz, the BS2sx
    up to 300 kilohertz, and the BS2p up to 416.7 kilohertz. If you use
    a prescaler of /400, then 40mhz comes out at 100khz. If you count
    cycles for 0.4 second, you get an answer of 40000. No reciprocal
    required. You could also use a straight binary divider as a
    prescaler, say, /256, which at 40mhz input is 156250 hz output.
    (That is within range '2p) Count for 256 milliseconds, and again
    the answer comes out at 40000.

    -- Tracy


    >I am looking for a clever way to use the Stamp as a frequency counter
    >with a maximum input frequency of 40 MHz. Obviously, the stamp cant
    >directly count this frequency, particularly to the resolution i need.
    >I would like to avoid building an off-board frequency counter that
    >interfaces to the Stamp,if i can help it, although a series of
    >prescalars would be acceptable if you can point me in the right
    >direction for jitter stability.
    >The straight forward way to do this is to prescale the 40MHZ by say
    >1,000,000 so that i get a 40 Hz signal, measure the period using
    >Pulsein, and since the fastest Stamp has a 0.75uS resolution i would
    >have 1/40 => 25mS/0.75uS => 1 part in 33,333 resolution. Great in
    >theory but dividing down by 1,000,000 with all the delay, jitter, etc.
    >scares me into believing that 1 part in 33K resolution is a pipe
    >dream.
    >Any suggestions?, surely someone has tackled this problem before??
    >Feel free to email me directly or respond in the group.
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the
    >Subject and Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sign In or Register to comment.