Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

The use of Adjacent Counters in Measure Frequency (NI-TIO).vi

I want to measure frequency of TTL pulses using my PCI-6602 card. I referred to the shipping example Measure Frequency (NI-TIO).vi for help. I understood that the first half of the program counts the number of pulses in the specified channel. However, I am not entirely sure what the next half of the program is doing. I don't know why it requires the use of adjacent counters. I tried to do some rewiring and changed the value of the counter of the bottom half of the code. I found out that if my input counter is counter 0 for the first half of the code, I must use counter 1 for the second half of the code in order for the program to run properly.

What I wanted to achieve is to measure frequency from
2 channels simultaneously. I do not need any triggering mode. Since I also have the BNC-2121, I would like to measure frequency from counter 0 and counter 1 because I can easily access the BNC connectors of these channels. However, with the limitation of this code, I can't seem to utilize both channels that way. I would like to understand more about the 2nd half of the code, and perhaps I can remove/modify some code that I can measure from counter 0 and 1 simultaneously.
0 Kudos
Message 1 of 2
(3,264 Views)
Deanna,

First, I would point you toward the example 'Measure Buffered Period (NI-TIO)' as (very likely) a better starting point for your app. This method only requires one counter per measurement channel and is well suited to low and medium frequency inputs. Just realize that your sampling rate is going to be equal to the pulse rate coming in. If your signal comes in at 50 kHz, you'll be collecting 50000 period meaurements per second and need to size your buffers accordingly.
You can easily set up separate buffered period measurements on counters 0 and 1 simultaneously -- just be sure to define a unique group # to each when calling "Counter Group Config.vi". Since frequency is simply 1/period, you can easily generate your frequency arrays.
If you only need a single average value, you could use the mean or median of each array.

Now a quick explanation of the example you were trying. First off, the idea of "adjacent counter" has a very specific meaning. The following are the only pairs that can be considered "adjacent" on the 6602: (0,1), (2,3), (4,5), (6,7). 1 and 2 are not considered adjacent to one another.
The purpose of the 2nd half of your example was to "gate" the counting operation in the first half. The first counter would only count while the second counter's output was high. The second counter generates a single pulse which precisely defines the first counter's counting time. Then frequency is given by (# counts) / (pulse time).

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 2
(3,264 Views)