Author Topic: How to test a counter  (Read 6412 times)

0 Members and 1 Guest are viewing this topic.

Offline Sbampato12Topic starter

  • Regular Contributor
  • *
  • Posts: 221
  • Country: it
How to test a counter
« on: November 17, 2013, 01:41:52 am »
Hi everybody,

I'm working in a digital counter (maybe in future becomes a frequency counter, who knows...) to my workbench, and I got this question:
How can I test my circuit?
Working on that I thought, if I use a function generator, I can feed a square wave (example), with a determined frequency, but can I determine how many pulses (or transitions, or level changes) did I feed in my hardware?
I do not have any function gen here, just some dmm, psu and a scope.
The function gen have some configurations that allow me do that?

PS: The project will be published when it is finished, open hardware.

Thanks in advance!
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: How to test a counter
« Reply #1 on: November 17, 2013, 02:11:41 am »
Quote
How can I test my circuit?

Depending on how your counter works. If it counts pulses within a given period of time, you can simply use a pulse generator (a crystal oscillator for example).

If the counter requires gating, you can use the oscillator and then divide it up to generate the gating information and feed both to your counter.
================================
https://dannyelectronics.wordpress.com/
 

Offline Sbampato12Topic starter

  • Regular Contributor
  • *
  • Posts: 221
  • Country: it
Re: How to test a counter
« Reply #2 on: November 17, 2013, 02:33:01 am »
Ok, but I need to know if me readings are ok. Like if I need another (good) counter, to compare the readings.

I need this, because I want to test how far I can go with frequency in the input.
I will get higher frequencies, and need to know if the counter still getting good readings, if it is not loosing any pulse. Or at what frequency it starts to loose pulses.
 

Offline Paul Moir

  • Frequent Contributor
  • **
  • Posts: 927
  • Country: ca
Re: How to test a counter
« Reply #3 on: November 17, 2013, 03:21:20 am »
How close do you want to know?  If 2x is enough, feed a high frequency crystal oscillator into a (or a few ganged) 74HC4040, which will provide osc/2, osc/4/ osc/8, etc.  You can validate the counter at lower frequencies with a stopwatch or wall clock. Then move up until it doesn't read right.
If you want to go beyond say 40MHz, you'll need to get careful.


« Last Edit: November 17, 2013, 03:23:21 am by Paul Moir »
 

Offline Sbampato12Topic starter

  • Regular Contributor
  • *
  • Posts: 221
  • Country: it
Re: How to test a counter
« Reply #4 on: November 17, 2013, 12:57:10 pm »
I was thinking in something like this, but as I never needed or never saw someone doing something like this, I just wanted to check if there is a more elegant way to do this.
I never worked in a high frequency project (or at least, nothing above 20MHz), so I don't know how hard it could be to do the board layout to get this working above 30 or 40Mhz, but by the datasheets, the ICs should work at least 60MHz...

I will finish the layout until the components doesn't arrive (about 20 days), and then start some tests.
 

Offline G0HZU

  • Super Contributor
  • ***
  • Posts: 3351
  • Country: gb
Re: How to test a counter
« Reply #5 on: November 17, 2013, 01:10:44 pm »
Why not program up a PIC/AVR chip to send out a predetermined qty of pulses from one of its ports? You could have anything you like from 1 pulse to something like 2^32 pulses (or even more if you wanted)

You could get it to keep repeating the test and you could log the results and maybe do hundreds of repeated tests per second to see how repeatable it is.
 

Offline Sbampato12Topic starter

  • Regular Contributor
  • *
  • Posts: 221
  • Country: it
Re: How to test a counter
« Reply #6 on: November 17, 2013, 01:46:54 pm »
Why not program up a PIC/AVR chip to send out a predetermined qty of pulses from one of its ports? You could have anything you like from 1 pulse to something like 2^32 pulses (or even more if you wanted)

You could get it to keep repeating the test and you could log the results and maybe do hundreds of repeated tests per second to see how repeatable it is.

This is good if the frequency is low. But I need to generate the pulses at least 40 or 50MHz, which is the frequency that I expect start to get some errors.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: How to test a counter
« Reply #7 on: November 17, 2013, 02:00:48 pm »
Quote
I expect start to get some errors.

Your mcu would not count above 20Mhz or so, without external help (a prescaler for example).

The first design you have to answer is if you want to read prescalers (both internal and external).
================================
https://dannyelectronics.wordpress.com/
 

Offline Sbampato12Topic starter

  • Regular Contributor
  • *
  • Posts: 221
  • Country: it
Re: How to test a counter
« Reply #8 on: November 17, 2013, 03:41:19 pm »
Quote
I expect start to get some errors.

Your mcu would not count above 20Mhz or so, without external help (a prescaler for example).

The first design you have to answer is if you want to read prescalers (both internal and external).

I'm not using a mcu to count.
I'm doing this using a dedicated ICs (binary counters, 7 seg. decoders and dividers).
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: How to test a counter
« Reply #9 on: November 17, 2013, 04:07:52 pm »
Then google sc3610 for an all-in-one digital solution; Or use a F-to-V chip or even a PLL for an analog solution.
================================
https://dannyelectronics.wordpress.com/
 

Offline edavid

  • Super Contributor
  • ***
  • Posts: 3562
  • Country: us
Re: How to test a counter
« Reply #10 on: November 17, 2013, 07:33:27 pm »
There's no magic way.  Probably the simplest thing is to borrow a commercial counter and make sure your design gives the same results.  You could also use a good logic analyzer or DSO.
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: How to test a counter
« Reply #11 on: November 18, 2013, 09:20:17 am »
if you are using dedicated chips, then it will count as fast as the chips can transition, and it will be as accurate as your reference clock is.

For example, you need a crystal clock as a reference, and counters and a gate. You can easily do that up to 50Mhz, if that is your goal.
50Mhz is a 20ns period, or a transition every 10ns. Typical logic level counters and dividers are much faster than this.

The only way to check the accuracy of your unit is to compare it to a known good frequency counter.

If you have a good reference clock, it will be as accurate as that clock is.

 

Offline ajc

  • Contributor
  • Posts: 30
  • Country: au
Re: How to test a counter
« Reply #12 on: November 18, 2013, 09:27:24 am »

I do not have any function gen here, just some dmm, psu and a scope.

Does your DMM have a frequency counter function?  If it does, you could use it to cross check. Might not go up to the higher frequencies though...
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: How to test a counter
« Reply #13 on: November 18, 2013, 11:36:22 am »
Good frequency sources are fairly easy: use crystals / crystal oscillators or TC(V)XO.

The counting / latching / displaying can be done with a variety of means, from very simple (FPGA/MCU) to moderately challenging (40110) to quite challenging (discrete ring oscillators).
================================
https://dannyelectronics.wordpress.com/
 

Offline Sbampato12Topic starter

  • Regular Contributor
  • *
  • Posts: 221
  • Country: it
Re: How to test a counter
« Reply #14 on: November 18, 2013, 04:34:14 pm »
Yeap, I think I will find a good oscilator, and use this method to confirm that the counter is ok.

Thanks for everyone!
 

Offline olsenn

  • Frequent Contributor
  • **
  • Posts: 993
Re: How to test a counter
« Reply #15 on: November 18, 2013, 04:38:24 pm »
Quote
Yeap, I think I will find a good oscilator, and use this method to confirm that the counter is ok.


This is definately your best option. Works far better than "one mississippi, two mississippi..."

Make sure to get at least an ovenized crystal, and preferably an atomic clock (Rb Std. oscillator). The latter has better long term stability, so it's probably what you want. Frankly though, you likely won't need 9 digits of resolution, so even the 1KHz square wave calibrator on your DSO will probably be good enough for most purposes.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: How to test a counter
« Reply #16 on: November 18, 2013, 05:02:43 pm »
A (stand-alone) crystal oscillator is cheap and easy to find. You can get a few (or one + a divider) to get a sense of your counter's range.

Alternatively, you can use one crystal / oscillator on HC4060 and get a variety of frequency output.
================================
https://dannyelectronics.wordpress.com/
 

Offline Jon86

  • Frequent Contributor
  • **
  • Posts: 526
  • Country: gb
Re: How to test a counter
« Reply #17 on: November 18, 2013, 05:55:03 pm »
AD9850 module? They're a few bucks on ebay and supposedly go up to 40Mhz. I've no experience with them myself, but if someone knows more about them then please pitch in.
Death, taxes and diode losses.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: How to test a counter
« Reply #18 on: November 18, 2013, 10:38:07 pm »
The sine output from a ad9850 doesn't have a sufficient swing to drive a gate directly. Designing an afe isn't easy.

The square wave output doesn't go sufficiently high in frequency.
================================
https://dannyelectronics.wordpress.com/
 

Offline Sbampato12Topic starter

  • Regular Contributor
  • *
  • Posts: 221
  • Country: it
Re: How to test a counter
« Reply #19 on: November 19, 2013, 12:20:48 am »
I have access to a function generator up to 20MHz, an old agilent (or hp).
I'll try to get a function gen with more Hz, and check if anywhere in my work the could have a easy access to a good stable oscillator.

Maybe use the function gen (20MHz) as a base, and one with higher freq to drive the inputs.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf