12-05-2005 03:12 PM
12-06-2005 05:28 PM
Hi Tcrower,
Here is the example that Carl L. was describing in his forum post along with his instructions. Also, there are thorough instructions for using the program in the front panel as well as in File >> VI Properties >> Documentation.
You can measure frequency in two ways using a counter.
1) Measure the time it takes for a set number of pulses to pass or,
2) Count the number of pulses that pass in a set amount of time.
For low-frequency signals it is best to measure the time duration of a set number of pulses. If we tried to calculate the number of pulses that passed in a set amount of time, we would need a long gate period to get accurate results.
The drawback of measuring the amount of time it takes for a set number of pulses to pass is that the sample period varies with the frequency of the signal.
To accurately measure low frequencies with a CTR module, select two counter channels, one output channel, and one gate input channel. Count Input 0 counts the pulses of the signal that we are measuring. The output of the counter is set to high for x pulses and low for x pulses, which is used as the gate of Count Input 1. The source of Count Input 1 is the internal clock reference (the example can be modified to use an external clock reference). During the high phase of Count Input 0, Count Input 1 counts the pulses of the clock reference.
During the low phase, we read channel 1 and reset the counter.
For example, if the output of Count Input 0 is set to high for 4 pulses and the signal has a frequency of 20 Hz, the output of Count Input 0 is high for 200 ms. During the high phase, we will count 200 counts if we are using the 1 kHz internal clock reference. So to calculate the frequency, we have F = #pulses/duration = timebase * terminal count/counts = 1000 Hz * 4 terminal counts/200 counts = 20 Hz.
Regards,
Hal L.
12-15-2005 12:25 PM
12-16-2005 03:48 PM
Hi Tcrower,
Each counter has a source and a gate, so you will only need counter 0 and counter 1 to run the example program. To run this example, you will need to connect your input signal to the source of counter 0 and connect the output of counter 0 to the gate of counter 1. The source of counter 1 will be an internal timebase. More information about the connections is available in the documentation of the example on the front panel.
I want to point out that the example says to connect pin 13 to pin 9 (counter 0 out to counter 0 gate). This should actually be pin 13 to pin 10 ( counter 0 out to counter 1 gate). I am editing the documentation for this example.
Regards,
Hal L.
12-19-2005 11:44 AM
Alright Hal,
I'm currently at my customer's unit and I cannot get even the example program to run. My counter 1 counts seem to be counting with no signal on counter 0. It also does not look like the counter 1 is being reset upon each read of the value. I have an optical pick up on a motor shaft with half of the shaft taped off for even pulses on the signal for counter 0. The optical device is wired into counter 0. I have followed all of the directions on teh example to setup the iak file. I wired the output of counter 0 to the gate of counter 1.
What am I missing???? You seem to be the only person that understands this well enough to help us out. And as always, the customer is on a deadline that I am trying to make. 🙂
If you can find anything wrong in what I've told you it would be a tremendous help!!!!
Thank you for all your help thus far.
Tara
12-20-2005 01:50 PM
12-20-2005 03:59 PM
Hi Tara,
You are absolutely right: the original documentation is correct for this example. I was looking further into your problem and I noticed that as well. I'm glad that you have everything working now. Please let me know if you run into any further problems.
Regards,
Hal L.
02-07-2006 01:50 PM
02-08-2006 02:00 PM
Hi Russell,
It is always a good idea to make sure that your FieldPoint Module is receiving power. I think that this is probably fine in your case because you are able to see a change in the gate input when you connect your signal. Is the square wave signal TTL compliant or is it just a simple analog square wave? This could be the cause of the problem. Have you tried to output a pulse train and wire that signal to the gate?
Regards,
Hal L.
02-08-2006 03:50 PM
Hal,
Thank you for the response.
The fieldpoint module is receving power because the LEDs for the counter inputs and outputs are blinking. My signal is actually not TTL the amplitude goes from 0 to 14 V. I am using the CTR 500 and the CTR 500 will not work with a TTL signal. The high level threshold is 10V and above (not 5 V like TTL).
When you asked, "Have you tried to output a pulse train and wire that signal to the gate?"
Do you mean generate an external pulse train and wire it directly to the gate input?
If so I have technically already tried that since the signal I am generating is basically a pulse train (continuous squarewave).
If not let me know what you had in mind so I can try it.
Again thank you for you response.
Russell