FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

Low Frequency Measurements using counter timers

I am trying to measure multiple speeds using FP-CTR-502 modules.  I am having a resolution problem.  Looking at the post at the following URL (http://forums.ni.com/ni/board/message?board.id=110&message.id=3601&query.id=42252#M3601) looks like exactly what I need to do, but I'm not sure how to program this.  Does anyone have any example code to get me headed in the right direction?
 
 
0 Kudos
Message 1 of 12
(5,878 Views)

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.

0 Kudos
Message 2 of 12
(5,852 Views)
If I'm reading this correctly that means I need double the channels for my counter timers?  I need one channel for my source and a seperate channel for my gate.  So counter 0 and counter 1, then the next frequency measurement would be at counter 2 and counter 3? 
0 Kudos
Message 3 of 12
(5,818 Views)

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.

0 Kudos
Message 4 of 12
(5,801 Views)

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

0 Kudos
Message 5 of 12
(5,773 Views)
Hal,
 
Your documentation is fine as it is.  Pin 9 can be wired to Pin13.  The gates are not linked to any specific counter.  Therefore you can gate counter 1 off of gate input 0. 
 
I have it running and reading frequencies as low as 0.3 Hz.
 
Thank you for all your help.
 
Tara
0 Kudos
Message 6 of 12
(5,742 Views)

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.

0 Kudos
Message 7 of 12
(5,736 Views)
Hal,
 
I used the example program you attached to this exchange and followed the instructions in the example, but unfortunately my gate input 0 never changes. I physically wired output 0 to gate input 0.  The source for output 0 is channel 0.  
 
My signal source is a 200 Hz square wave.  I also tried 100 Hz, 10 Hz. And the gate never changes. 
 
Do you know why the gate input might not be changing?
 
On a side note, I believe the gate input connection is working correctly because if I wire my signal source to the gate input directly, then the gate input changes value.
 
Let me know if you need more information.
 
Russell
 
 
Director of Engineering
G Systems, www.gsystems.com
Certified LabVIEW Architect
Certified LabVIEW Embedded Systems Developer
Certified Professional Instructor
GCentral
0 Kudos
Message 8 of 12
(5,607 Views)

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.

0 Kudos
Message 9 of 12
(5,585 Views)

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  

 

Director of Engineering
G Systems, www.gsystems.com
Certified LabVIEW Architect
Certified LabVIEW Embedded Systems Developer
Certified Professional Instructor
GCentral
0 Kudos
Message 10 of 12
(5,582 Views)