I am having a bit of trouble creating a pulse counter. I have created an oscillator to produce a square wave with upper values of 5.5V and lower values of 3.3V and I would like to get an idea of the RC constant for a given circuit based on the pulse count. The frequency of the pulse is in the MHz range and I want to avoid using interrupts as much as possible due to successive compounding delays.
My idea is to create 2 counters, the first counts the raw amount of impulses and the second record every 10,000 impulses. Then it should display the count on counter 2 and the remainder of counter 1. The purpose of 2 counters is that I would like to run an ISR (interrupt service routine) every time the count restarts (i.e every 10,000). I am using an arduino teensy 3.6 with 8, 32, and 64 bit registers.
Google for ‘frequency meter teensy’.
What is the upper frequency?
Are you prepared to do some external signal conditioning before feeding the oscillator signal into the teensy?
Can you show a schematic of the oscillator which you have to test ?
From the nature of the requirements, I am guessing that this is school work. You should say if it is school work otherwise you will have to deal with numerous counter suggestions which don’t fit with the exercise.
Sounds like a highly unusual way of measuring an RC time constant indeed. And a highly unusual block wave - you'll have to do something about those voltage levels to bring it to a 0/3.3V wave (a comparator comes to mind).
Some Teensies are 5V tolerant so the high voltage of the block wave may be fine, but 3.3V is also read as high so unless you bring that down sufficiently you can't do any pulse counting.
Thank you all for replying, this is my first time posting to the forum.
This use to be apart of a school project but I wanted to revisit it to improve on a design that I had at the time.
To Faraday Member:
The upper frequency is 20 MHz
I have never delt with signal conditioning before but just by reading about the function of the components it seems like a combination of attenuation and isolation could be used to negate the upper Voltage readings.
To Tesla Member:
It is a very strange method of analysis, and truly the schematic diagram I provided will be a basic building block in the design. I like the idea of adding a comparator to reduce the output values, so long as the quality of the signal isn't diminished and the impedance hasn't reduced I should still get a clean output. I do not care whether I am counting the peaks or the troughs as long as I get the number of pulses.
OK. You are using a Schmitt Trigger Oscillator e.g. Schmitt Trigger Oscillator - Online Digital Electronics Course
If it is powered by the same power supply as the Teensy, you should get a 0 to 3.3 volt swing and not the 3.3volt to 5.5 volt swing you mentioned in the OP. Or have you still a requirement that the voltage swing is 3.3 to 5.5 volts ?
I guess that 20MHz is on the limit of what you you can measure easily with the Teensy. You can bring add a prescaler IC to divide the frequency down before it hits the MPU. E.g. MC12080 .
How many digits each are counter 1 and counter 2 to display ? Four ?
AH, Yes, I misspoke. I had been using a 5V source previously but upon switching power sources to the teensy my swing is from 0 to 3.3 V as expected. The limit on the Teensy 3.6 is 180MHz.
I like the idea of using a prescaler IC so long as I am able to deduce the real output frequency as it will be related to the RC frequency of a given oscillator, I imagine that will just be a matter of multiplying by a factor. There should be 5 digits displayed.
I am having a bit of trouble creating a pulse counter. I have created an oscillator to produce a square wave with upper values of 5.5V and lower values of 3.3V and I would like to get an idea of the RC constant for a given circuit based on the pulse count. The frequency of the pulse is in the MHz range and I want to avoid using interrupts as much as possible due to successive compounding delays.
So you'll need a rail-to-rail high speed comparator to turn that waveform to a logic signal in the first place,
beware most comparators don't go close to the positive rail.
My idea is to create 2 counters, the first counts the raw amount of impulses and the second record every 10,000 impulses. Then it should display the count on counter 2 and the remainder of counter 1. The purpose of 2 counters is that I would like to run an ISR (interrupt service routine) every time the count restarts (i.e every 10,000). I am using an arduino teensy 3.6 with 8, 32, and 64 bit registers.
I've used the 74LV8154 dual-16-bit counter chip before, does the work for you, doesn't need interrupts or lose cycles.